code
stringlengths
23
201k
docstring
stringlengths
17
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
72
path
stringlengths
11
317
url
stringlengths
57
377
license
stringclasses
7 values
@Test public void test_TokenizeFullSentence() { final Trie trie = trie( GREEK_LETTERS ); final Collection<Token> tokens = trie.tokenize( "Hear: Alpha team first, Beta from the rear, Gamma in reserve" ); assertEquals( 7, tokens.size() ); final Iterator<Token> tokensIt = tokens.iterator(); a...
Test the {@link Trie} class functionality.
test_TokenizeFullSentence
java
robert-bor/aho-corasick
src/test/java/org/ahocorasick/trie/TrieTest.java
https://github.com/robert-bor/aho-corasick/blob/master/src/test/java/org/ahocorasick/trie/TrieTest.java
Apache-2.0
@Test public void test_TokenizeTokensInSequence() { final Trie trie = trie( GREEK_LETTERS ); final Collection<Token> tokens = trie.tokenize( "Alpha Beta Gamma" ); assertEquals( 5, tokens.size() ); }
Test boundary check with case-insensitive matches with whole words.
test_TokenizeTokensInSequence
java
robert-bor/aho-corasick
src/test/java/org/ahocorasick/trie/TrieTest.java
https://github.com/robert-bor/aho-corasick/blob/master/src/test/java/org/ahocorasick/trie/TrieTest.java
Apache-2.0
@Test public void test_ZeroLength() { final Trie trie = Trie.builder() .ignoreOverlaps() .onlyWholeWords() .ignoreCase() .addKeyword( "" ) .build(); trie.tokenize( "Try a n...
Fix adding a word of size 0 ("") as a dictionary. A bug in the dictionary parsing code (at end of line) caused it to generate words of 0 length, which were being added to the trie. Removing the additional commas resolved the issue.
test_ZeroLength
java
robert-bor/aho-corasick
src/test/java/org/ahocorasick/trie/TrieTest.java
https://github.com/robert-bor/aho-corasick/blob/master/src/test/java/org/ahocorasick/trie/TrieTest.java
Apache-2.0
@Test public void test_Emit_PunctuatedKeyword_AllOffsetsFound() { final String keyword = "{{var}}"; final int len = keyword.length() - 1; final Trie trie = builder() .ignoreOverlaps() .addKeyword( keyword ) .build(); final Collection<Emit> emits = trie.parseText( forma...
Fix adding a word of size 0 ("") as a dictionary. A bug in the dictionary parsing code (at end of line) caused it to generate words of 0 length, which were being added to the trie. Removing the additional commas resolved the issue.
test_Emit_PunctuatedKeyword_AllOffsetsFound
java
robert-bor/aho-corasick
src/test/java/org/ahocorasick/trie/TrieTest.java
https://github.com/robert-bor/aho-corasick/blob/master/src/test/java/org/ahocorasick/trie/TrieTest.java
Apache-2.0
@Test public void test_PartialMatchWhiteSpaces() { final Trie trie = Trie.builder() .onlyWholeWordsWhiteSpaceSeparated() .addKeyword( "#sugar-123" ) .build(); final Collection<Emit> emits = trie.parseText( "#sugar-123 #sugar...
Notice the capital I with a dot. The code used to compute the offsets at (6, 9), which caused {@link Trie#tokenize(String)} to crash because 9 is past the end of the string. That character is two bytes wide, so it pushes the offset calculation off.
test_PartialMatchWhiteSpaces
java
robert-bor/aho-corasick
src/test/java/org/ahocorasick/trie/TrieTest.java
https://github.com/robert-bor/aho-corasick/blob/master/src/test/java/org/ahocorasick/trie/TrieTest.java
Apache-2.0
@Test public void test_LargeString() { final int interval = 100; final int textSize = 1000000; final String keyword = FOOD[ 1 ]; final StringBuilder text = randomNumbers( textSize ); injectKeyword( text, keyword, interval ); final Trie trie = Trie.builder() .onlyWho...
Notice the capital I with a dot. The code used to compute the offsets at (6, 9), which caused {@link Trie#tokenize(String)} to crash because 9 is past the end of the string. That character is two bytes wide, so it pushes the offset calculation off.
test_LargeString
java
robert-bor/aho-corasick
src/test/java/org/ahocorasick/trie/TrieTest.java
https://github.com/robert-bor/aho-corasick/blob/master/src/test/java/org/ahocorasick/trie/TrieTest.java
Apache-2.0
@Test(timeout = 30_000) public void test_ParallelSearch() throws InterruptedException { final int interval = 100; final int textSize = 1000000; final String keyword = FOOD[ 1 ]; final StringBuilder matchingText = randomNumbers( textSize ); injectKeyword( matchingText, keyword, interval ); fina...
Notice the capital I with a dot. The code used to compute the offsets at (6, 9), which caused {@link Trie#tokenize(String)} to crash because 9 is past the end of the string. That character is two bytes wide, so it pushes the offset calculation off.
test_ParallelSearch
java
robert-bor/aho-corasick
src/test/java/org/ahocorasick/trie/TrieTest.java
https://github.com/robert-bor/aho-corasick/blob/master/src/test/java/org/ahocorasick/trie/TrieTest.java
Apache-2.0
private void checkEmit( Emit next, int expectedStart, int expectedEnd, String expectedKeyword ) { assertEquals( "Start of emit should have been " + expectedStart, expectedStart, next.getStart() ); assertEquals( "End of emit should have been " + expec...
Notice the capital I with a dot. The code used to compute the offsets at (6, 9), which caused {@link Trie#tokenize(String)} to crash because 9 is past the end of the string. That character is two bytes wide, so it pushes the offset calculation off.
checkEmit
java
robert-bor/aho-corasick
src/test/java/org/ahocorasick/trie/TrieTest.java
https://github.com/robert-bor/aho-corasick/blob/master/src/test/java/org/ahocorasick/trie/TrieTest.java
Apache-2.0
public void track(Message message) { track(new TopicPartition(message.getTopic(), message.getKafkaPartition()), message.getTimestamp(), message.getPayload().length); }
DeterministicUploadPolicyTracker stores the range of timestamps seen so far for a given TopicPartition. It lets us implement a "time-based" upload policy that is still deterministic.
track
java
pinterest/secor
src/main/java/com/pinterest/secor/common/DeterministicUploadPolicyTracker.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/DeterministicUploadPolicyTracker.java
Apache-2.0
public void track(TopicPartition topicPartition, KeyValue kv) { track(topicPartition, kv.getTimestamp(), kv.getValue().length); }
DeterministicUploadPolicyTracker stores the range of timestamps seen so far for a given TopicPartition. It lets us implement a "time-based" upload policy that is still deterministic.
track
java
pinterest/secor
src/main/java/com/pinterest/secor/common/DeterministicUploadPolicyTracker.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/DeterministicUploadPolicyTracker.java
Apache-2.0
private void track(TopicPartition topicPartition, long timestamp, long inputPayloadSizeBytes) { if (timestamp <= 0 && mMaxFileTimestampRangeMillis != Long.MAX_VALUE) { throw new RuntimeException("Message without timestamp incompatible with secor.max.file.timestamp.range.millis"); } final TopicPartitio...
DeterministicUploadPolicyTracker stores the range of timestamps seen so far for a given TopicPartition. It lets us implement a "time-based" upload policy that is still deterministic.
track
java
pinterest/secor
src/main/java/com/pinterest/secor/common/DeterministicUploadPolicyTracker.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/DeterministicUploadPolicyTracker.java
Apache-2.0
public void reset(TopicPartition topicPartition) { mStats.remove(topicPartition); }
DeterministicUploadPolicyTracker stores the range of timestamps seen so far for a given TopicPartition. It lets us implement a "time-based" upload policy that is still deterministic.
reset
java
pinterest/secor
src/main/java/com/pinterest/secor/common/DeterministicUploadPolicyTracker.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/DeterministicUploadPolicyTracker.java
Apache-2.0
public boolean shouldUpload(TopicPartition topicPartition) { final TopicPartitionStats stats = mStats.get(topicPartition); if (stats == null) { // No messages at all: definitely not ready for upload. return false; } return stats.totalInputPayloadSizeBytes >= mMaxInputPayloadSizeBytes ...
DeterministicUploadPolicyTracker stores the range of timestamps seen so far for a given TopicPartition. It lets us implement a "time-based" upload policy that is still deterministic.
shouldUpload
java
pinterest/secor
src/main/java/com/pinterest/secor/common/DeterministicUploadPolicyTracker.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/DeterministicUploadPolicyTracker.java
Apache-2.0
public Collection<TopicPartition> getTopicPartitions() { Collection<TopicPartitionGroup> topicPartitions = getTopicPartitionGroups(); Set<TopicPartition> tps = new HashSet<TopicPartition>(); if (topicPartitions != null) { for (TopicPartitionGroup g : topicPartitions) { ...
Get all topic partitions. @return Collection of all registered topic partitions.
getTopicPartitions
java
pinterest/secor
src/main/java/com/pinterest/secor/common/FileRegistry.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/FileRegistry.java
Apache-2.0
public Collection<TopicPartitionGroup> getTopicPartitionGroups() { Set<TopicPartitionGroup> topicPartitions = mFiles.keySet(); Set<TopicPartitionGroup> tps = new HashSet<TopicPartitionGroup>(); if (topicPartitions != null) { tps.addAll(topicPartitions); } return tps; ...
Get all topic partitions. @return Collection of all registered topic partitions.
getTopicPartitionGroups
java
pinterest/secor
src/main/java/com/pinterest/secor/common/FileRegistry.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/FileRegistry.java
Apache-2.0
public Collection<LogFilePath> getPaths(TopicPartition topicPartition) { return getPaths(new TopicPartitionGroup(topicPartition)); }
Get paths in a given topic partition. @param topicPartition The topic partition to retrieve paths for. @return Collection of file paths in the given topic partition.
getPaths
java
pinterest/secor
src/main/java/com/pinterest/secor/common/FileRegistry.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/FileRegistry.java
Apache-2.0
public Collection<LogFilePath> getPaths(TopicPartitionGroup topicPartitionGroup) { HashSet<LogFilePath> logFilePaths = mFiles.get(topicPartitionGroup); if (logFilePaths == null) { return new HashSet<LogFilePath>(); } return new HashSet<LogFilePath>(logFilePaths); }
Get paths in a given topic partition. @param topicPartitionGroup The topic partition to retrieve paths for. @return Collection of file paths in the given topic partition.
getPaths
java
pinterest/secor
src/main/java/com/pinterest/secor/common/FileRegistry.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/FileRegistry.java
Apache-2.0
public FileWriter getWriter(LogFilePath path) throws Exception { return mWriters.get(path); }
Retrieve an existing writer for a given path. @param path The path to retrieve writer for. @return Writer for a given path or null if no writer has been created yet. @throws Exception on error
getWriter
java
pinterest/secor
src/main/java/com/pinterest/secor/common/FileRegistry.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/FileRegistry.java
Apache-2.0
public FileWriter getOrCreateWriter(LogFilePath path, CompressionCodec codec) throws Exception { FileWriter writer = mWriters.get(path); if (writer == null) { // Just in case. FileUtil.delete(path.getLogFilePath()); FileUtil.delete(path.getLogFileCrcPath()...
Retrieve a writer for a given path or create a new one if it does not exist. @param path The path to retrieve writer for. @param codec Optional compression codec. @return Writer for a given path. @throws Exception on error
getOrCreateWriter
java
pinterest/secor
src/main/java/com/pinterest/secor/common/FileRegistry.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/FileRegistry.java
Apache-2.0
public void deletePath(LogFilePath path) throws IOException { TopicPartitionGroup topicPartition = new TopicPartitionGroup(path.getTopic(), path.getKafkaPartitions()); HashSet<LogFilePath> paths = mFiles.get(topicPartition); paths.remove...
Delete a given path, the underlying file, and the corresponding writer. @param path The path to delete. @throws IOException on error
deletePath
java
pinterest/secor
src/main/java/com/pinterest/secor/common/FileRegistry.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/FileRegistry.java
Apache-2.0
public void deleteTopicPartition(TopicPartition topicPartition) throws IOException { deleteTopicPartitionGroup((new TopicPartitionGroup(topicPartition))); }
Delete all paths, files, and writers in a given topic partition. @param topicPartition The topic partition to remove. @throws IOException on error
deleteTopicPartition
java
pinterest/secor
src/main/java/com/pinterest/secor/common/FileRegistry.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/FileRegistry.java
Apache-2.0
public void deleteTopicPartitionGroup(TopicPartitionGroup topicPartitioGroup) throws IOException { HashSet<LogFilePath> paths = mFiles.get(topicPartitioGroup); if (paths == null) { return; } HashSet<LogFilePath> clonedPaths = (HashSet<LogFilePath>) paths.clone(); for ...
Delete all paths, files, and writers in a given topic partition. @param topicPartition The topic partition to remove. @throws IOException on error
deleteTopicPartitionGroup
java
pinterest/secor
src/main/java/com/pinterest/secor/common/FileRegistry.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/FileRegistry.java
Apache-2.0
public void deleteWriter(LogFilePath path) throws IOException { FileWriter writer = mWriters.get(path); if (writer == null) { LOG.warn("No writer found for path {}", path.getLogFilePath()); } else { LOG.info("Deleting writer for path {}", path.getLogFilePath()); ...
Delete writer for a given topic partition. Underlying file is not removed. @param path The path to remove the writer for. @throws IOException on error
deleteWriter
java
pinterest/secor
src/main/java/com/pinterest/secor/common/FileRegistry.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/FileRegistry.java
Apache-2.0
public void deleteWriters(TopicPartition topicPartition) throws IOException { deleteWriters(new TopicPartitionGroup(topicPartition)); }
Delete all writers in a given topic partition. Underlying files are not removed. @param topicPartition The topic partition to remove the writers for. @throws IOException on error
deleteWriters
java
pinterest/secor
src/main/java/com/pinterest/secor/common/FileRegistry.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/FileRegistry.java
Apache-2.0
public void deleteWriters(TopicPartitionGroup topicPartitionGroup) throws IOException { HashSet<LogFilePath> paths = mFiles.get(topicPartitionGroup); if (paths == null) { LOG.warn("No paths found for topic {} partition {}", topicPartitionGroup.getTopic(), Arrays.toString(topi...
Delete all writers in a given topic partition. Underlying files are not removed. @param topicPartition The topic partition to remove the writers for. @throws IOException on error
deleteWriters
java
pinterest/secor
src/main/java/com/pinterest/secor/common/FileRegistry.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/FileRegistry.java
Apache-2.0
public long getSize(TopicPartition topicPartition) throws IOException { return getSize(new TopicPartitionGroup(topicPartition)); }
Get aggregated size of all files in a given topic partition. @param topicPartition The topic partition to get the size for. @return Aggregated size of files in the topic partition or 0 if the topic partition does not contain any files. @throws IOException on error
getSize
java
pinterest/secor
src/main/java/com/pinterest/secor/common/FileRegistry.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/FileRegistry.java
Apache-2.0
public long getSize(TopicPartitionGroup topicPartitionGroup) throws IOException { Collection<LogFilePath> paths = getPaths(topicPartitionGroup); long result = 0; for (LogFilePath path : paths) { FileWriter writer = mWriters.get(path); if (writer != null) { ...
Get aggregated size of all files in a given topic partition. @param topicPartition The topic partition to get the size for. @return Aggregated size of files in the topic partition or 0 if the topic partition does not contain any files. @throws IOException on error
getSize
java
pinterest/secor
src/main/java/com/pinterest/secor/common/FileRegistry.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/FileRegistry.java
Apache-2.0
public long getModificationAgeSec(TopicPartition topicPartition) { return getModificationAgeSec(new TopicPartitionGroup(topicPartition)); }
Get the creation age of the most recently created file in a given topic partition. @param topicPartition The topic partition to get the age of. @return Age of the most recently created file in the topic partition or -1 if the partition does not contain any files.
getModificationAgeSec
java
pinterest/secor
src/main/java/com/pinterest/secor/common/FileRegistry.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/FileRegistry.java
Apache-2.0
public long getModificationAgeSec(TopicPartitionGroup topicPartitionGroup) { long now = System.currentTimeMillis() / 1000L; long result; if (mConfig.getFileAgeYoungest()) { result = Long.MAX_VALUE; } else { result = -1; } Collection<LogFilePath> pa...
Get the creation age of the most recently created file in a given topic partition. @param topicPartition The topic partition to get the age of. @return Age of the most recently created file in the topic partition or -1 if the partition does not contain any files.
getModificationAgeSec
java
pinterest/secor
src/main/java/com/pinterest/secor/common/FileRegistry.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/FileRegistry.java
Apache-2.0
public int getActiveFileCount() { return mWriters.size(); }
Get the creation age of the most recently created file in a given topic partition. @param topicPartition The topic partition to get the age of. @return Age of the most recently created file in the topic partition or -1 if the partition does not contain any files.
getActiveFileCount
java
pinterest/secor
src/main/java/com/pinterest/secor/common/FileRegistry.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/FileRegistry.java
Apache-2.0
private HostAndPort findLeader(TopicPartition topicPartition) { SimpleConsumer consumer = null; try { LOG.debug("looking up leader for topic {} partition {}", topicPartition.getTopic(), topicPartition.getPartition()); consumer = createConsumer( mConfig.getKafkaSee...
Kafka client encapsulates the logic interacting with Kafka brokers. @author Pawel Garbacki (pawel@pinterest.com)
findLeader
java
pinterest/secor
src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
Apache-2.0
private static String getClientName(TopicPartition topicPartition) { return "secorClient_" + topicPartition.getTopic() + "_" + topicPartition.getPartition(); }
Kafka client encapsulates the logic interacting with Kafka brokers. @author Pawel Garbacki (pawel@pinterest.com)
getClientName
java
pinterest/secor
src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
Apache-2.0
private long findLastOffset(TopicPartition topicPartition, SimpleConsumer consumer) { TopicAndPartition topicAndPartition = new TopicAndPartition(topicPartition.getTopic(), topicPartition.getPartition()); Map<TopicAndPartition, PartitionOffsetRequestInfo> requestInfo = ne...
Kafka client encapsulates the logic interacting with Kafka brokers. @author Pawel Garbacki (pawel@pinterest.com)
findLastOffset
java
pinterest/secor
src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
Apache-2.0
private Message getMessage(TopicPartition topicPartition, long offset, SimpleConsumer consumer) { LOG.debug("fetching message topic {} partition {} offset {}", topicPartition.getTopic(), topicPartition.getPartition(), offset); final int MAX_MESSAGE_SIZE_BYT...
Kafka client encapsulates the logic interacting with Kafka brokers. @author Pawel Garbacki (pawel@pinterest.com)
getMessage
java
pinterest/secor
src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
Apache-2.0
private SimpleConsumer createConsumer(String host, int port, String clientName) { return new SimpleConsumer(host, port, 100000, 64 * 1024, clientName); }
Kafka client encapsulates the logic interacting with Kafka brokers. @author Pawel Garbacki (pawel@pinterest.com)
createConsumer
java
pinterest/secor
src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
Apache-2.0
private SimpleConsumer createConsumer(TopicPartition topicPartition) { HostAndPort leader = findLeader(topicPartition); if (leader == null) { LOG.warn("no leader for topic {} partition {}", topicPartition.getTopic(), topicPartition.getPartition()); return null; } ...
Kafka client encapsulates the logic interacting with Kafka brokers. @author Pawel Garbacki (pawel@pinterest.com)
createConsumer
java
pinterest/secor
src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
Apache-2.0
@Override public int getNumPartitions(String topic) { SimpleConsumer consumer = null; try { consumer = createConsumer( mConfig.getKafkaSeedBrokerHost(), mConfig.getKafkaSeedBrokerPort(), "partitionLookup"); List<String> topics =...
Kafka client encapsulates the logic interacting with Kafka brokers. @author Pawel Garbacki (pawel@pinterest.com)
getNumPartitions
java
pinterest/secor
src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
Apache-2.0
@Override public Message getLastMessage(TopicPartition topicPartition) throws TException { SimpleConsumer consumer = null; try { consumer = createConsumer(topicPartition); if (consumer == null) { return null; } long lastOffset = findLas...
Kafka client encapsulates the logic interacting with Kafka brokers. @author Pawel Garbacki (pawel@pinterest.com)
getLastMessage
java
pinterest/secor
src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
Apache-2.0
@Override public Message getCommittedMessage(TopicPartition topicPartition) throws Exception { SimpleConsumer consumer = null; try { long committedOffset = mZookeeperConnector.getCommittedOffsetCount(topicPartition) - 1; if (committedOffset < 0) { return null;...
Kafka client encapsulates the logic interacting with Kafka brokers. @author Pawel Garbacki (pawel@pinterest.com)
getCommittedMessage
java
pinterest/secor
src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
Apache-2.0
@Override public void init(SecorConfig config) { mConfig = config; mZookeeperConnector = new ZookeeperConnector(mConfig); mKafkaMessageTimestampFactory = new KafkaMessageTimestampFactory(mConfig.getKafkaMessageTimestampClass()); }
Kafka client encapsulates the logic interacting with Kafka brokers. @author Pawel Garbacki (pawel@pinterest.com)
init
java
pinterest/secor
src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/LegacyKafkaClient.java
Apache-2.0
public void reInitiateOffset() { mLastSeenOffset = new HashMap<TopicPartition, Long>(); mCommittedOffsetCount = new HashMap<TopicPartition, Long>(); mFirstSeendOffset = new HashMap<TopicPartition, Long>(); }
Offset tracker stores offset related metadata. @author Pawel Garbacki (pawel@pinterest.com)
reInitiateOffset
java
pinterest/secor
src/main/java/com/pinterest/secor/common/OffsetTracker.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/OffsetTracker.java
Apache-2.0
public long getLastSeenOffset(TopicPartition topicPartition) { Long offset = mLastSeenOffset.get(topicPartition); if (offset == null) { return -2; } return offset.longValue(); }
Offset tracker stores offset related metadata. @author Pawel Garbacki (pawel@pinterest.com)
getLastSeenOffset
java
pinterest/secor
src/main/java/com/pinterest/secor/common/OffsetTracker.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/OffsetTracker.java
Apache-2.0
public long setLastSeenOffset(TopicPartition topicPartition, long offset) { long lastSeenOffset = getLastSeenOffset(topicPartition); mLastSeenOffset.put(topicPartition, offset); if (offset < lastSeenOffset + 1) { LOG.warn("offset for topic {} partition {} goes back from {} to {}", ...
Offset tracker stores offset related metadata. @author Pawel Garbacki (pawel@pinterest.com)
setLastSeenOffset
java
pinterest/secor
src/main/java/com/pinterest/secor/common/OffsetTracker.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/OffsetTracker.java
Apache-2.0
public long getTrueCommittedOffsetCount(TopicPartition topicPartition) { Long committedOffsetCount = mCommittedOffsetCount.get(topicPartition); if (committedOffsetCount == null) { return -1L; } return committedOffsetCount; }
Offset tracker stores offset related metadata. @author Pawel Garbacki (pawel@pinterest.com)
getTrueCommittedOffsetCount
java
pinterest/secor
src/main/java/com/pinterest/secor/common/OffsetTracker.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/OffsetTracker.java
Apache-2.0
public long getAdjustedCommittedOffsetCount(TopicPartition topicPartition) { long trueCommittedOffsetCount = getTrueCommittedOffsetCount(topicPartition); if (trueCommittedOffsetCount == -1L) { Long firstSeenOffset = mFirstSeendOffset.get(topicPartition); if (firstSeenOffset != nu...
Offset tracker stores offset related metadata. @author Pawel Garbacki (pawel@pinterest.com)
getAdjustedCommittedOffsetCount
java
pinterest/secor
src/main/java/com/pinterest/secor/common/OffsetTracker.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/OffsetTracker.java
Apache-2.0
public long setCommittedOffsetCount(TopicPartition topicPartition, long count) { long trueCommittedOffsetCount = getTrueCommittedOffsetCount(topicPartition); // Committed offsets should never go back. assert trueCommittedOffsetCount <= count: Long.toString(trueCommittedOffsetCount) + ...
Offset tracker stores offset related metadata. @author Pawel Garbacki (pawel@pinterest.com)
setCommittedOffsetCount
java
pinterest/secor
src/main/java/com/pinterest/secor/common/OffsetTracker.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/OffsetTracker.java
Apache-2.0
@Override protected SecorConfig initialValue() { // Load the default configuration file first Properties systemProperties = System.getProperties(); String configProperty = systemProperties.getProperty("config"); PropertiesConfiguration properties; try...
One-stop shop for Secor configuration options. @author Pawel Garbacki (pawel@pinterest.com)
initialValue
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public static SecorConfig load() throws ConfigurationException { return mSecorConfig.get(); }
One-stop shop for Secor configuration options. @author Pawel Garbacki (pawel@pinterest.com)
load
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getKafkaSeedBrokerHost() { return getString("kafka.seed.broker.host"); }
Exposed for testability @param properties properties config
getKafkaSeedBrokerHost
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public int getKafkaSeedBrokerPort() { return getInt("kafka.seed.broker.port"); }
Exposed for testability @param properties properties config
getKafkaSeedBrokerPort
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getKafkaZookeeperPath() { return getString("kafka.zookeeper.path"); }
Exposed for testability @param properties properties config
getKafkaZookeeperPath
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getZookeeperQuorum() { return StringUtils.join(getStringArray("zookeeper.quorum"), ','); }
Exposed for testability @param properties properties config
getZookeeperQuorum
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public int getConsumerTimeoutMs() { return getInt("kafka.consumer.timeout.ms"); }
Exposed for testability @param properties properties config
getConsumerTimeoutMs
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getConsumerAutoOffsetReset() { return getString("kafka.consumer.auto.offset.reset"); }
Exposed for testability @param properties properties config
getConsumerAutoOffsetReset
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String[] getKafkaTopicList() { return getStringArray("kafka.new.consumer.topic.list"); }
Exposed for testability @param properties properties config
getKafkaTopicList
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getNewConsumerAutoOffsetReset() { return getString("kafka.new.consumer.auto.offset.reset"); }
Exposed for testability @param properties properties config
getNewConsumerAutoOffsetReset
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public int getNewConsumerPollTimeoutSeconds() { return getInt("kafka.new.consumer.poll.timeout.seconds"); }
Exposed for testability @param properties properties config
getNewConsumerPollTimeoutSeconds
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getNewConsumerRequestTimeoutMs() { return getString("kafka.new.consumer.request.timeout.ms"); }
Exposed for testability @param properties properties config
getNewConsumerRequestTimeoutMs
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getSslKeyPassword() { return getString("kafka.new.consumer.ssl.key.password"); }
Exposed for testability @param properties properties config
getSslKeyPassword
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getSslKeystoreLocation() { return getString("kafka.new.consumer.ssl.keystore.location"); }
Exposed for testability @param properties properties config
getSslKeystoreLocation
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getSslKeystorePassword() { return getString("kafka.new.consumer.ssl.keystore.password"); }
Exposed for testability @param properties properties config
getSslKeystorePassword
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getSslTruststoreLocation() { return getString("kafka.new.consumer.ssl.truststore.location"); }
Exposed for testability @param properties properties config
getSslTruststoreLocation
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getSslTruststorePassword() { return getString("kafka.new.consumer.ssl.truststore.password"); }
Exposed for testability @param properties properties config
getSslTruststorePassword
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getIsolationLevel() { return getString("kafka.new.consumer.isolation.level"); }
Exposed for testability @param properties properties config
getIsolationLevel
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getMaxPollIntervalMs() { return getString("kafka.new.consumer.max.poll.interval.ms"); }
Exposed for testability @param properties properties config
getMaxPollIntervalMs
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getMaxPollRecords() { return getString("kafka.new.consumer.max.poll.records"); }
Exposed for testability @param properties properties config
getMaxPollRecords
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getSaslClientCallbackHandlerClass() { return getString("kafka.new.consumer.sasl.client.callback.handler.class"); }
Exposed for testability @param properties properties config
getSaslClientCallbackHandlerClass
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getSaslJaasConfig() { return getString("kafka.new.consumer.sasl.jaas.config"); }
Exposed for testability @param properties properties config
getSaslJaasConfig
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getSaslKerberosServiceName() { return getString("kafka.new.consumer.sasl.kerberos.service.name"); }
Exposed for testability @param properties properties config
getSaslKerberosServiceName
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getSaslLoginCallbackHandlerClass() { return getString("kafka.new.consumer.sasl.login.callback.handler.class"); }
Exposed for testability @param properties properties config
getSaslLoginCallbackHandlerClass
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getSaslLoginClass() { return getString("kafka.new.consumer.sasl.login.class"); }
Exposed for testability @param properties properties config
getSaslLoginClass
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getSaslMechanism() { return getString("kafka.new.consumer.sasl.mechanism"); }
Exposed for testability @param properties properties config
getSaslMechanism
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getSecurityProtocol() { return getString("kafka.new.consumer.security.protocol"); }
Exposed for testability @param properties properties config
getSecurityProtocol
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getSslEnabledProtocol() { return getString("kafka.new.consumer.ssl.enabled.protocols"); }
Exposed for testability @param properties properties config
getSslEnabledProtocol
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getSslKeystoreType() { return getString("kafka.new.consumer.ssl.keystore.type"); }
Exposed for testability @param properties properties config
getSslKeystoreType
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getSslProtocol() { return getString("kafka.new.consumer.ssl.protocol"); }
Exposed for testability @param properties properties config
getSslProtocol
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getSslProvider() { return getString("kafka.new.consumer.ssl.provider"); }
Exposed for testability @param properties properties config
getSslProvider
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getSslTruststoreType() { return getString("kafka.new.consumer.ssl.truststore.type"); }
Exposed for testability @param properties properties config
getSslTruststoreType
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getNewConsumerPartitionAssignmentStrategyClass() { return getString("kafka.new.consumer.partition.assignment.strategy.class"); }
Exposed for testability @param properties properties config
getNewConsumerPartitionAssignmentStrategyClass
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getPartitionAssignmentStrategy() { return getString("kafka.partition.assignment.strategy"); }
Exposed for testability @param properties properties config
getPartitionAssignmentStrategy
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getRebalanceMaxRetries() { return getString("kafka.rebalance.max.retries"); }
Exposed for testability @param properties properties config
getRebalanceMaxRetries
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getRebalanceBackoffMs() { return getString("kafka.rebalance.backoff.ms"); }
Exposed for testability @param properties properties config
getRebalanceBackoffMs
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getFetchMessageMaxBytes() { return getString("kafka.fetch.message.max.bytes"); }
Exposed for testability @param properties properties config
getFetchMessageMaxBytes
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getSocketReceiveBufferBytes() { return getString("kafka.socket.receive.buffer.bytes"); }
Exposed for testability @param properties properties config
getSocketReceiveBufferBytes
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getFetchMinBytes() { return getString("kafka.fetch.min.bytes"); }
Exposed for testability @param properties properties config
getFetchMinBytes
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getFetchMaxBytes() { return getString("kafka.fetch.max.bytes"); }
Exposed for testability @param properties properties config
getFetchMaxBytes
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getFetchWaitMaxMs() { return getString("kafka.fetch.wait.max.ms"); }
Exposed for testability @param properties properties config
getFetchWaitMaxMs
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getDualCommitEnabled() { return getString("kafka.dual.commit.enabled"); }
Exposed for testability @param properties properties config
getDualCommitEnabled
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getOffsetsStorage() { return getString("kafka.offsets.storage"); }
Exposed for testability @param properties properties config
getOffsetsStorage
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public boolean useKafkaTimestamp() { return getBoolean("kafka.useTimestamp", false); }
Exposed for testability @param properties properties config
useKafkaTimestamp
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getKafkaMessageTimestampClass() { return getString("kafka.message.timestamp.className"); }
Exposed for testability @param properties properties config
getKafkaMessageTimestampClass
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getKafkaMessageIteratorClass() { return getString("kafka.message.iterator.className"); }
Exposed for testability @param properties properties config
getKafkaMessageIteratorClass
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public String getKafkaClientClass() { return getString("kafka.client.className"); }
Exposed for testability @param properties properties config
getKafkaClientClass
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public int getGeneration() { return getInt("secor.generation"); }
Exposed for testability @param properties properties config
getGeneration
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public int getConsumerThreads() { return getInt("secor.consumer.threads"); }
Exposed for testability @param properties properties config
getConsumerThreads
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public int getMaxBadMessages() { return getInt("secor.consumer.max_bad_messages", 1000); }
Exposed for testability @param properties properties config
getMaxBadMessages
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public long getMaxFileSizeBytes() { return getLong("secor.max.file.size.bytes"); }
Exposed for testability @param properties properties config
getMaxFileSizeBytes
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public long getMaxFileAgeSeconds() { return getLong("secor.max.file.age.seconds"); }
Exposed for testability @param properties properties config
getMaxFileAgeSeconds
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public int getMaxActiveFiles() { return getInt("secor.max.file.count", -1); }
Exposed for testability @param properties properties config
getMaxActiveFiles
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0
public boolean getUploadOnShutdown() { return getBoolean("secor.upload.on.shutdown"); }
Exposed for testability @param properties properties config
getUploadOnShutdown
java
pinterest/secor
src/main/java/com/pinterest/secor/common/SecorConfig.java
https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorConfig.java
Apache-2.0