Search in sources :

Example 1 with TrieParser

use of com.ociweb.pronghorn.util.TrieParser in project GreenLightning by oci-pronghorn.

the class MessagePubSubStage method startup.

@Override
public void startup() {
    super.startup();
    tempSubject.initBuffers();
    int incomingPipeCount = incomingSubsAndPubsPipe.length;
    // for each pipe we must keep track of the consumed marks before sending the ack back
    int outgoingPipeCount = outgoingMessagePipes.length;
    consumedMarks = new long[incomingPipeCount][outgoingPipeCount];
    pendingAck = new boolean[incomingPipeCount];
    requiredConsumes = new int[incomingPipeCount];
    // maximum count of outgoing pipes * 2 for extra hash room
    deDupeTable = new IntHashTable(IntHashTable.computeBits(outgoingPipeCount * 2));
    this.subscriberLists = new int[initialSubscriptions * subscriberListSize];
    Arrays.fill(this.subscriberLists, (short) -1);
    // must support extraction for wild cards.
    this.localSubscriptionTrie = new TrieParser(initialSubscriptions * estimatedAvgTopicLength, 1, false, true);
    // this reader is set up for complete text only, all topics are sent in complete.
    this.localSubscriptionTrieReader = new TrieParserReader(2, true);
    this.pendingPublish = new int[subscriberListSize];
    processStartupSubscriptions(hardware.consumeStartupSubscriptions());
}
Also used : IntHashTable(com.ociweb.pronghorn.pipe.util.hash.IntHashTable) TrieParser(com.ociweb.pronghorn.util.TrieParser) TrieParserReader(com.ociweb.pronghorn.util.TrieParserReader)

Example 2 with TrieParser

use of com.ociweb.pronghorn.util.TrieParser in project PronghornPipes by oci-pronghorn.

the class JSONParser method stringEndParser.

private static TrieParser stringEndParser() {
    TrieParser trie = new TrieParser(256, 1, false, true);
    trie.setValue(JSONConstants.string5C1, STRING_PART | 0x5C00);
    trie.setValue(JSONConstants.string5C2, STRING_END | 0x5C00);
    trie.setValue(JSONConstants.string2F1, STRING_PART | 0x2F00);
    trie.setValue(JSONConstants.string2F2, STRING_END | 0x2F00);
    // backspace
    trie.setValue(JSONConstants.string621, STRING_PART | 0x0800);
    trie.setValue(JSONConstants.string622, STRING_END | 0x0800);
    // FF
    trie.setValue(JSONConstants.string661, STRING_PART | 0x0C00);
    // FF
    trie.setValue(JSONConstants.string662, STRING_END | 0x0C00);
    // NL
    trie.setValue(JSONConstants.string6E1, STRING_PART | 0x0A00);
    // NL
    trie.setValue(JSONConstants.string6E2, STRING_END | 0x0A00);
    // CR
    trie.setValue(JSONConstants.string721, STRING_PART | 0x0D00);
    // CR
    trie.setValue(JSONConstants.string722, STRING_END | 0x0D00);
    // tab
    trie.setValue(JSONConstants.string741, STRING_PART | 0x0900);
    // tab
    trie.setValue(JSONConstants.string742, STRING_END | 0x0900);
    trie.setValue(JSONConstants.string751, STRING_PART | 0x7500);
    trie.setValue(JSONConstants.string752, STRING_END | 0x7500);
    trie.setValue(JSONConstants.string221, STRING_PART | 0x2200);
    trie.setValue(JSONConstants.string222, STRING_END | 0x2200);
    return trie;
}
Also used : TrieParser(com.ociweb.pronghorn.util.TrieParser)

Example 3 with TrieParser

use of com.ociweb.pronghorn.util.TrieParser in project PronghornPipes by oci-pronghorn.

the class JSONParser method literalParser.

private static TrieParser literalParser() {
    TrieParser trie = new TrieParser(256, 1, false, true);
    trie.setValue(JSONConstants.number, NUMBER_ID);
    trie.setValue(JSONConstants.falseLiteral, FALSE_ID);
    trie.setValue(JSONConstants.nullLiteral, NULL_ID);
    trie.setValue(JSONConstants.trueLiteral, TRUE_ID);
    return trie;
}
Also used : TrieParser(com.ociweb.pronghorn.util.TrieParser)

Example 4 with TrieParser

use of com.ociweb.pronghorn.util.TrieParser in project PronghornPipes by oci-pronghorn.

the class JSONStreamParser method customParser.

public static <T extends Enum<T> & TrieKeyable> TrieParser customParser(Class<T> keys) {
    // 2 because we need 2 shorts for the number
    TrieParser trie = new TrieParser(256, 2, false, true);
    for (T key : keys.getEnumConstants()) {
        int value = toValue(key.ordinal());
        assert (value >= 0);
        trie.setUTF8Value("\"", key.getKey(), "\"", value);
    // TODO: should we add the same key without quotes ??
    }
    populateWithJSONTokens(trie);
    return trie;
}
Also used : TrieParser(com.ociweb.pronghorn.util.TrieParser)

Example 5 with TrieParser

use of com.ociweb.pronghorn.util.TrieParser in project PronghornPipes by oci-pronghorn.

the class JSONStreamParser method defaultParser.

private static TrieParser defaultParser() {
    TrieParser trie = new TrieParser(256, 1, false, true);
    populateWithJSONTokens(trie);
    return trie;
}
Also used : TrieParser(com.ociweb.pronghorn.util.TrieParser)

Aggregations

TrieParser (com.ociweb.pronghorn.util.TrieParser)17 TrieParserReader (com.ociweb.pronghorn.util.TrieParserReader)3 IntHashTable (com.ociweb.pronghorn.pipe.util.hash.IntHashTable)2 PubSubMethodListenerBase (com.ociweb.gl.impl.PubSubMethodListenerBase)1 Test (org.junit.Test)1