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 |
|---|---|---|---|---|---|---|---|
public double getDouble(String name, double defaultValue) {
return mProperties.getDouble(name, defaultValue);
} | Exposed for testability
@param properties properties config | getDouble | 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 getLong(String name) {
return mProperties.getLong(name);
} | Exposed for testability
@param properties properties config | getLong | 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[] getStringArray(String name) {
return mProperties.getStringArray(name);
} | Exposed for testability
@param properties properties config | getStringArray | 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 getThriftProtocolClass() {
return mProperties.getString("secor.thrift.protocol.class");
} | Exposed for testability
@param properties properties config | getThriftProtocolClass | 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 getMetricsCollectorClass() {
return getString("secor.monitoring.metrics.collector.class");
} | Exposed for testability
@param properties properties config | getMetricsCollectorClass | 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 getMicroMeterCollectorJmxEnabled() {
return getBoolean("secor.monitoring.metrics.collector.micrometer.jmx.enabled", false);
} | Exposed for testability
@param properties properties config | getMicroMeterCollectorJmxEnabled | 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 getMicroMeterCollectorStatsdEnabled() {
return getBoolean("secor.monitoring.metrics.collector.micrometer.statsd.enabled", false);
} | Exposed for testability
@param properties properties config | getMicroMeterCollectorStatsdEnabled | 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 getMicroMeterCollectorPrometheusEnabled() {
return getBoolean("secor.monitoring.metrics.collector.micrometer.prometheus.enabled", false);
} | Exposed for testability
@param properties properties config | getMicroMeterCollectorPrometheusEnabled | 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 getMicroMeterCacheSize() {
return getInt("secor.monitoring.metrics.collector.micrometer.cache.size", 500);
} | Exposed for testability
@param properties properties config | getMicroMeterCacheSize | 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 Map<String, String> getPropertyMapForPrefix(String prefix) {
Iterator<String> keys = mProperties.getKeys(prefix);
Map<String, String> map = new HashMap<String, String>();
while (keys.hasNext()) {
String key = keys.next();
String value = mProperties.getString(key);
... | This method is used for fetching all the properties which start with the given prefix.
It returns a Map of all those key-val.
e.g.
a.b.c=val1
a.b.d=val2
a.b.e=val3
If prefix is a.b then,
These will be fetched as a map {c = val1, d = val2, e = val3}
@param prefix property prefix
@return | getPropertyMapForPrefix | 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 Map<String, String> getORCMessageSchema() {
return getPropertyMapForPrefix("secor.orc.message.schema");
} | This method is used for fetching all the properties which start with the given prefix.
It returns a Map of all those key-val.
e.g.
a.b.c=val1
a.b.d=val2
a.b.e=val3
If prefix is a.b then,
These will be fetched as a map {c = val1, d = val2, e = val3}
@param prefix property prefix
@return | getORCMessageSchema | 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 Map<String, String> getAvroMessageSchema() {
return getPropertyMapForPrefix("secor.avro.message.schema");
} | This method is used for fetching all the properties which start with the given prefix.
It returns a Map of all those key-val.
e.g.
a.b.c=val1
a.b.d=val2
a.b.e=val3
If prefix is a.b then,
These will be fetched as a map {c = val1, d = val2, e = val3}
@param prefix property prefix
@return | getAvroMessageSchema | 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 getORCSchemaProviderClass(){
return getString("secor.orc.schema.provider");
} | This method is used for fetching all the properties which start with the given prefix.
It returns a Map of all those key-val.
e.g.
a.b.c=val1
a.b.d=val2
a.b.e=val3
If prefix is a.b then,
These will be fetched as a map {c = val1, d = val2, e = val3}
@param prefix property prefix
@return | getORCSchemaProviderClass | 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 Schema getSchema(String topic) {
Schema schema = schemas.get(topic);
if (schema == null) {
try {
SchemaMetadata schemaMetadata = schemaRegistryClient.getLatestSchemaMetadata(topic + "-value");
schema = schemaRegistryClient.getByID(schemaMetadata.getId()... | Get Avro schema of a topic. It uses the cache that either is set by calling {@link #deserialize(String, byte[])}
or querying this method to avoid hitting Schema Registry for each call.
It uses standard "subject name" strategy and it is topic_name-value.
@param topic a Kafka topic to query the schema for
@return Schema... | getSchema | java | pinterest/secor | src/main/java/com/pinterest/secor/common/SecorSchemaRegistryClient.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorSchemaRegistryClient.java | Apache-2.0 |
@Override
public byte[] serialize(String topic, GenericRecord record) throws IOException {
return serializer.serialize(topic, record);
} | Get Avro schema of a topic. It uses the cache that either is set by calling {@link #deserialize(String, byte[])}
or querying this method to avoid hitting Schema Registry for each call.
It uses standard "subject name" strategy and it is topic_name-value.
@param topic a Kafka topic to query the schema for
@return Schema... | serialize | java | pinterest/secor | src/main/java/com/pinterest/secor/common/SecorSchemaRegistryClient.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/SecorSchemaRegistryClient.java | Apache-2.0 |
public static void registerHook(int priority, Runnable hook) {
HOOKS.computeIfAbsent(priority, key -> new ArrayList<>()).add(hook);
LOG.info("Shut down hook with priority {} added to shut down hook registry", priority);
} | Registry for shutdown hooks.
Allows running shutdown hooks by specific order by executing multiple Runnables on single shutdown hook.
@author Paulius Dambrauskas (p.dambrauskas@gmail.com) | registerHook | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ShutdownHookRegistry.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ShutdownHookRegistry.java | Apache-2.0 |
public static void runHooks() {
HOOKS.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEach(entry -> {
LOG.info("Running hooks for priority {}", entry.getKey());
entry.getValue().parallelStream().forEach(Runnable::run);
});
} | Registry for shutdown hooks.
Allows running shutdown hooks by specific order by executing multiple Runnables on single shutdown hook.
@author Paulius Dambrauskas (p.dambrauskas@gmail.com) | runHooks | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ShutdownHookRegistry.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ShutdownHookRegistry.java | Apache-2.0 |
public String getTopic() {
return mTopic;
} | Topic partition describes a kafka message topic-partition pair.
@author Pawel Garbacki (pawel@pinterest.com) | getTopic | java | pinterest/secor | src/main/java/com/pinterest/secor/common/TopicPartition.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/TopicPartition.java | Apache-2.0 |
public int getPartition() {
return mPartition;
} | Topic partition describes a kafka message topic-partition pair.
@author Pawel Garbacki (pawel@pinterest.com) | getPartition | java | pinterest/secor | src/main/java/com/pinterest/secor/common/TopicPartition.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/TopicPartition.java | Apache-2.0 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TopicPartition that = (TopicPartition) o;
if (mPartition != that.mPartition) return false;
if (mTopic != null ? !mTopic.equals(that.mTopic) : t... | Topic partition describes a kafka message topic-partition pair.
@author Pawel Garbacki (pawel@pinterest.com) | equals | java | pinterest/secor | src/main/java/com/pinterest/secor/common/TopicPartition.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/TopicPartition.java | Apache-2.0 |
@Override
public int hashCode() {
int result = mTopic != null ? mTopic.hashCode() : 0;
result = 31 * result + mPartition;
return result;
} | Topic partition describes a kafka message topic-partition pair.
@author Pawel Garbacki (pawel@pinterest.com) | hashCode | java | pinterest/secor | src/main/java/com/pinterest/secor/common/TopicPartition.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/TopicPartition.java | Apache-2.0 |
@Override
public String toString() {
return "TopicPartition{" +
"mTopic='" + mTopic + '\'' +
", mPartition=" + mPartition +
'}';
} | Topic partition describes a kafka message topic-partition pair.
@author Pawel Garbacki (pawel@pinterest.com) | toString | java | pinterest/secor | src/main/java/com/pinterest/secor/common/TopicPartition.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/TopicPartition.java | Apache-2.0 |
public String getTopic() {
return mTopic;
} | Topic partition group describes a kafka message topic-partitions pair.
@author Henry Cai (hcai@pinterest.com) | getTopic | java | pinterest/secor | src/main/java/com/pinterest/secor/common/TopicPartitionGroup.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/TopicPartitionGroup.java | Apache-2.0 |
public int[] getPartitions() {
return mPartitions;
} | Topic partition group describes a kafka message topic-partitions pair.
@author Henry Cai (hcai@pinterest.com) | getPartitions | java | pinterest/secor | src/main/java/com/pinterest/secor/common/TopicPartitionGroup.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/TopicPartitionGroup.java | Apache-2.0 |
public List<TopicPartition> getTopicPartitions() {
List<TopicPartition> tps = new ArrayList<TopicPartition>();
for (int p : mPartitions) {
tps.add(new TopicPartition(mTopic, p));
}
return tps;
} | Topic partition group describes a kafka message topic-partitions pair.
@author Henry Cai (hcai@pinterest.com) | getTopicPartitions | java | pinterest/secor | src/main/java/com/pinterest/secor/common/TopicPartitionGroup.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/TopicPartitionGroup.java | Apache-2.0 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TopicPartitionGroup that = (TopicPartitionGroup) o;
if (!Arrays.equals(mPartitions, that.mPartitions)) return false;
if (mTopic != null ? !mTop... | Topic partition group describes a kafka message topic-partitions pair.
@author Henry Cai (hcai@pinterest.com) | equals | java | pinterest/secor | src/main/java/com/pinterest/secor/common/TopicPartitionGroup.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/TopicPartitionGroup.java | Apache-2.0 |
@Override
public int hashCode() {
int result = mTopic != null ? mTopic.hashCode() : 0;
result = 31 * result + Arrays.hashCode(mPartitions);
return result;
} | Topic partition group describes a kafka message topic-partitions pair.
@author Henry Cai (hcai@pinterest.com) | hashCode | java | pinterest/secor | src/main/java/com/pinterest/secor/common/TopicPartitionGroup.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/TopicPartitionGroup.java | Apache-2.0 |
@Override
public String toString() {
return "TopicPartitionGroup{" +
"mTopic='" + mTopic + '\'' +
", mPartitions=" + Arrays.toString(mPartitions) +
'}';
} | Topic partition group describes a kafka message topic-partitions pair.
@author Henry Cai (hcai@pinterest.com) | toString | java | pinterest/secor | src/main/java/com/pinterest/secor/common/TopicPartitionGroup.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/TopicPartitionGroup.java | Apache-2.0 |
@Override
public void close() throws IOException {
if (mCurator != null) {
mCurator.close();
}
} | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | close | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
private Iterable<InetSocketAddress> getZookeeperAddresses() {
String zookeeperQuorum = mConfig.getZookeeperQuorum();
String[] hostports = zookeeperQuorum.split(",");
LinkedList<InetSocketAddress> result = new LinkedList<InetSocketAddress>();
for (String hostport : hostports) {
... | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | getZookeeperAddresses | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
public void lock(String lockPath) {
assert mLocks.get(lockPath) == null: "mLocks.get(" + lockPath + ") == null";
InterProcessMutex distributedLock = new InterProcessMutex(mCurator, lockPath);
mLocks.put(lockPath, distributedLock);
try {
distributedLock.acquire();
} ca... | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | lock | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
public void unlock(String lockPath) {
InterProcessMutex distributedLock = mLocks.get(lockPath);
assert distributedLock != null: "mLocks.get(" + lockPath + ") != null";
try {
distributedLock.release();
} catch (Exception ex) {
throw new RuntimeException("Unexpected... | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | unlock | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
protected String getOffsetGroupPath(String subPath) {
String stripped = StringUtils.strip(mConfig.getKafkaZookeeperPath(), "/");
String path = Joiner.on("/").skipNulls().join(
"",
stripped.equals("") ? null : stripped,
"consumers",
mConfig.getKafkaGroup(),... | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | getOffsetGroupPath | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
protected String getCommittedOffsetGroupPath() {
if (Strings.isNullOrEmpty(mCommittedOffsetGroupPath)) {
String stripped = StringUtils.strip(mConfig.getKafkaZookeeperPath(), "/");
mCommittedOffsetGroupPath = getOffsetGroupPath("offsets");
}
return mCommittedOffsetGroupPat... | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | getCommittedOffsetGroupPath | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
protected String getLastSeenOffsetGroupPath() {
if (Strings.isNullOrEmpty(mLastSeenOffsetGroupPath)) {
String stripped = StringUtils.strip(mConfig.getKafkaZookeeperPath(), "/");
mLastSeenOffsetGroupPath = getOffsetGroupPath("lastSeen");
}
return mLastSeenOffsetGroupPath;
... | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | getLastSeenOffsetGroupPath | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
private String getCommittedOffsetTopicPath(String topic) {
return getCommittedOffsetGroupPath() + "/" + topic;
} | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | getCommittedOffsetTopicPath | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
private String getLastSeenOffsetTopicPath(String topic) {
return getLastSeenOffsetGroupPath() + "/" + topic;
} | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | getLastSeenOffsetTopicPath | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
private String getCommittedOffsetPartitionPath(TopicPartition topicPartition) {
return getCommittedOffsetTopicPath(topicPartition.getTopic()) + "/" +
topicPartition.getPartition();
} | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | getCommittedOffsetPartitionPath | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
private String getLastSeenOffsetPartitionPath(TopicPartition topicPartition) {
return getLastSeenOffsetTopicPath(topicPartition.getTopic()) + "/" +
topicPartition.getPartition();
} | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | getLastSeenOffsetPartitionPath | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
public long getCommittedOffsetCount(TopicPartition topicPartition) throws Exception {
String offsetPath = getCommittedOffsetPartitionPath(topicPartition);
try {
byte[] data = mCurator.getData().forPath(offsetPath);
return Long.parseLong(new String(data));
} catch (KeeperE... | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | getCommittedOffsetCount | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
public long getLastSeenOffsetCount(TopicPartition topicPartition) throws Exception {
String offsetPath = getLastSeenOffsetPartitionPath(topicPartition);
try {
byte[] data = mCurator.getData().forPath(offsetPath);
return Long.parseLong(new String(data));
} catch (KeeperExc... | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | getLastSeenOffsetCount | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
public List<Integer> getCommittedOffsetPartitions(String topic) throws Exception {
String topicPath = getCommittedOffsetTopicPath(topic);
List<String> partitions = mCurator.getChildren().forPath(topicPath);
LinkedList<Integer> result = new LinkedList<Integer>();
for (String partitionPath... | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | getCommittedOffsetPartitions | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
public List<Integer> getLastSeenOffsetPartitions(String topic) throws Exception {
String topicPath = getLastSeenOffsetTopicPath(topic);
List<String> partitions = mCurator.getChildren().forPath(topicPath);
LinkedList<Integer> result = new LinkedList<Integer>();
for (String partitionPath :... | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | getLastSeenOffsetPartitions | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
public List<String> getCommittedOffsetTopics() throws Exception {
String offsetPath = getCommittedOffsetGroupPath();
List<String> topics = mCurator.getChildren().forPath(offsetPath);
LinkedList<String> result = new LinkedList<String>();
for (String topicPath : topics) {
Strin... | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | getCommittedOffsetTopics | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
public List<String> getLastSeenOffsetTopics() throws Exception {
String offsetPath = getLastSeenOffsetGroupPath();
List<String> topics = mCurator.getChildren().forPath(offsetPath);
LinkedList<String> result = new LinkedList<String>();
for (String topicPath : topics) {
String[... | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | getLastSeenOffsetTopics | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
private void createMissingParents(String path) throws Exception {
Stat stat = mCurator.checkExists().forPath(path);
if (stat == null) {
mCurator.create()
.creatingParentsIfNeeded()
.withMode(CreateMode.PERSISTENT)
.withACL(ZooDefs.Ids.OPEN_ACL_UNSAFE)
... | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | createMissingParents | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
public void setCommittedOffsetCount(TopicPartition topicPartition, long count)
throws Exception {
String offsetPath = getCommittedOffsetPartitionPath(topicPartition);
LOG.info("creating missing parents for zookeeper path {}", offsetPath);
createMissingParents(offsetPath);
byt... | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | setCommittedOffsetCount | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
public void setLastSeenOffsetCount(TopicPartition topicPartition, long count)
throws Exception {
String offsetPath = getLastSeenOffsetPartitionPath(topicPartition);
LOG.info("creating missing parents for zookeeper path {}", offsetPath);
createMissingParents(offsetPath);
byte[] da... | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | setLastSeenOffsetCount | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
public void deleteCommittedOffsetTopicCount(String topic) throws Exception {
List<Integer> partitions = getCommittedOffsetPartitions(topic);
for (Integer partition : partitions) {
TopicPartition topicPartition = new TopicPartition(topic, partition);
String offsetPath = getCommitt... | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | deleteCommittedOffsetTopicCount | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
public void deleteLastSeenOffsetTopicCount(String topic) throws Exception {
List<Integer> partitions = getLastSeenOffsetPartitions(topic);
for (Integer partition : partitions) {
TopicPartition topicPartition = new TopicPartition(topic, partition);
String offsetPath = getLastSeenO... | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | deleteLastSeenOffsetTopicCount | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
public void deleteCommittedOffsetPartitionCount(TopicPartition topicPartition)
throws Exception {
String offsetPath = getCommittedOffsetPartitionPath(topicPartition);
LOG.info("deleting path {}", offsetPath);
mCurator.delete().forPath(offsetPath);
} | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | deleteCommittedOffsetPartitionCount | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
public void deleteLastSeenOffsetPartitionCount(TopicPartition topicPartition)
throws Exception {
String offsetPath = getLastSeenOffsetPartitionPath(topicPartition);
LOG.info("deleting path {}", offsetPath);
mCurator.delete().forPath(offsetPath);
} | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | deleteLastSeenOffsetPartitionCount | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
protected void setConfig(SecorConfig config) {
this.mConfig = config;
} | ZookeeperConnector implements interactions with Zookeeper.
@author Pawel Garbacki (pawel@pinterest.com) | setConfig | java | pinterest/secor | src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/ZookeeperConnector.java | Apache-2.0 |
public void start() {
Duration[] defaultLatchIntervals = {Duration.apply(1, TimeUnit.MINUTES)};
Map<String, CustomHttpHandler> handlers = mPrometheusEnabled ?
new Map.Map1<>("/prometheus", new PrometheusHandler()) : Map$.MODULE$.empty();
@SuppressWarnings("deprecation")
A... | OstrichAdminService initializes export of metrics to Ostrich.
@author Pawel Garbacki (pawel@pinterest.com) | start | java | pinterest/secor | src/main/java/com/pinterest/secor/common/monitoring/OstrichAdminService.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/monitoring/OstrichAdminService.java | Apache-2.0 |
@Override
public void handle(HttpExchange exchange) {
Optional<PrometheusMeterRegistry> registry = Metrics.globalRegistry.getRegistries().stream()
.filter(meterRegistry -> meterRegistry instanceof PrometheusMeterRegistry)
.map(meterRegistry -> (PrometheusMeterRegistry) meterR... | Initializes Http Endpoint for Prometheus
@author Paulius Dambrauskas (p.dambrauskas@gmail.com) | handle | java | pinterest/secor | src/main/java/com/pinterest/secor/common/monitoring/PrometheusHandler.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/common/monitoring/PrometheusHandler.java | Apache-2.0 |
private void init() throws Exception {
mOffsetTracker = new OffsetTracker();
if (mConfig.getDeterministicUpload()) {
mDeterministicUploadPolicyTracker = new DeterministicUploadPolicyTracker(
mConfig.getMaxFileTimestampRangeMillis(), mConfig.getMaxInputPayloadSizeBytes()
... | Consumer is a top-level component coordinating reading, writing, and uploading Kafka log
messages. It is implemented as a thread with the intent of running multiple consumer
concurrently.
Note that consumer is not fixed with a specific topic partition. Kafka rebalancing mechanism
allocates topic partitions to consum... | init | java | pinterest/secor | src/main/java/com/pinterest/secor/consumer/Consumer.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/consumer/Consumer.java | Apache-2.0 |
@Override
public void run() {
if (mCallingSystemExit) {
// We're shutting down because a consumer thread crashed. We don't want to do a final
// upload: we just want to exit. If this particular thread was the one that crashed,
// we would deadlock if ... | Consumer is a top-level component coordinating reading, writing, and uploading Kafka log
messages. It is implemented as a thread with the intent of running multiple consumer
concurrently.
Note that consumer is not fixed with a specific topic partition. Kafka rebalancing mechanism
allocates topic partitions to consum... | run | java | pinterest/secor | src/main/java/com/pinterest/secor/consumer/Consumer.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/consumer/Consumer.java | Apache-2.0 |
@Override
public void run() {
try {
try {
// init() cannot be called in the constructor since it contains logic dependent on the
// thread id.
init();
} catch (Exception e) {
throw new RuntimeException("Failed to initial... | Consumer is a top-level component coordinating reading, writing, and uploading Kafka log
messages. It is implemented as a thread with the intent of running multiple consumer
concurrently.
Note that consumer is not fixed with a specific topic partition. Kafka rebalancing mechanism
allocates topic partitions to consum... | run | java | pinterest/secor | src/main/java/com/pinterest/secor/consumer/Consumer.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/consumer/Consumer.java | Apache-2.0 |
protected void checkUploadPolicy(boolean forceUpload) {
try {
mUploader.applyPolicy(forceUpload);
} catch (Exception e) {
throw new RuntimeException("Failed to apply upload policy", e);
}
} | Consumer is a top-level component coordinating reading, writing, and uploading Kafka log
messages. It is implemented as a thread with the intent of running multiple consumer
concurrently.
Note that consumer is not fixed with a specific topic partition. Kafka rebalancing mechanism
allocates topic partitions to consum... | checkUploadPolicy | java | pinterest/secor | src/main/java/com/pinterest/secor/consumer/Consumer.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/consumer/Consumer.java | Apache-2.0 |
protected boolean consumeNextMessage() {
Message rawMessage = null;
try {
boolean hasNext = mMessageReader.hasNext();
if (!hasNext) {
return false;
}
rawMessage = mMessageReader.read();
} catch (LegacyConsumerTimeoutException e) {
... | Consumer is a top-level component coordinating reading, writing, and uploading Kafka log
messages. It is implemented as a thread with the intent of running multiple consumer
concurrently.
Note that consumer is not fixed with a specific topic partition. Kafka rebalancing mechanism
allocates topic partitions to consum... | consumeNextMessage | java | pinterest/secor | src/main/java/com/pinterest/secor/consumer/Consumer.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/consumer/Consumer.java | Apache-2.0 |
public OffsetTracker getOffsetTracker() {
return this.mOffsetTracker;
} | Helper to get the offset tracker (used in tests)
@return the offset tracker | getOffsetTracker | java | pinterest/secor | src/main/java/com/pinterest/secor/consumer/Consumer.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/consumer/Consumer.java | Apache-2.0 |
private void adjustOffsets(Message rawMessage) {
try {
mMessageWriter.adjustOffset(rawMessage, isLegacyConsumer);
} catch (IOException e) {
throw new RuntimeException("Failed to adjust offset.", e);
}
} | Helper to get the offset tracker (used in tests)
@return the offset tracker | adjustOffsets | java | pinterest/secor | src/main/java/com/pinterest/secor/consumer/Consumer.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/consumer/Consumer.java | Apache-2.0 |
private void writeMessage(Message rawMessage, ParsedMessage parsedMessage) throws Exception {
mMessageWriter.write(parsedMessage);
mBadMessages *= DECAY;
mMetricCollector.metric("consumer.message_size_bytes", rawMessage.getPayload().length,
rawMessage.getTopic());
mMetric... | Helper to get the offset tracker (used in tests)
@return the offset tracker | writeMessage | java | pinterest/secor | src/main/java/com/pinterest/secor/consumer/Consumer.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/consumer/Consumer.java | Apache-2.0 |
private void handleWriteError(Message rawMessage, ParsedMessage parsedMessage, Exception exception) {
mMetricCollector.increment("consumer.message_errors.count", rawMessage.getTopic());
mBadMessages++;
if (mMaxBadMessages != -1 && mBadMessages > mMaxBadMessages) {
throw new RuntimeEx... | Helper to get the offset tracker (used in tests)
@return the offset tracker | handleWriteError | java | pinterest/secor | src/main/java/com/pinterest/secor/consumer/Consumer.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/consumer/Consumer.java | Apache-2.0 |
public long getOffset() {
return this.mOffset;
} | Generic Object used to read next message from various file reader
implementations
@author Praveen Murugesan (praveen@uber.com) | getOffset | java | pinterest/secor | src/main/java/com/pinterest/secor/io/KeyValue.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/KeyValue.java | Apache-2.0 |
public byte[] getKafkaKey() {
return this.mKafkaKey;
} | Generic Object used to read next message from various file reader
implementations
@author Praveen Murugesan (praveen@uber.com) | getKafkaKey | java | pinterest/secor | src/main/java/com/pinterest/secor/io/KeyValue.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/KeyValue.java | Apache-2.0 |
public byte[] getValue() {
return this.mValue;
} | Generic Object used to read next message from various file reader
implementations
@author Praveen Murugesan (praveen@uber.com) | getValue | java | pinterest/secor | src/main/java/com/pinterest/secor/io/KeyValue.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/KeyValue.java | Apache-2.0 |
public long getTimestamp() {
return this.mTimestamp;
} | Generic Object used to read next message from various file reader
implementations
@author Praveen Murugesan (praveen@uber.com) | getTimestamp | java | pinterest/secor | src/main/java/com/pinterest/secor/io/KeyValue.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/KeyValue.java | Apache-2.0 |
public boolean hasKafkaKey() {
return this.mKafkaKey != null && this.mKafkaKey.length != 0;
} | Generic Object used to read next message from various file reader
implementations
@author Praveen Murugesan (praveen@uber.com) | hasKafkaKey | java | pinterest/secor | src/main/java/com/pinterest/secor/io/KeyValue.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/KeyValue.java | Apache-2.0 |
public boolean hasTimestamp(){
return this.mTimestamp != -1;
} | Generic Object used to read next message from various file reader
implementations
@author Praveen Murugesan (praveen@uber.com) | hasTimestamp | java | pinterest/secor | src/main/java/com/pinterest/secor/io/KeyValue.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/KeyValue.java | Apache-2.0 |
public List<MessageHeader> getHeaders() {
return mHeaders;
} | Generic Object used to read next message from various file reader
implementations
@author Praveen Murugesan (praveen@uber.com) | getHeaders | java | pinterest/secor | src/main/java/com/pinterest/secor/io/KeyValue.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/KeyValue.java | Apache-2.0 |
@Override
public void run() {
try {
FileUtils.deleteDirectory(this.mStagingDir);
} catch (IOException e) {
LOG.error("Failed deleting file", e);
}
} | Runnable used to delete staging folder content.
Deletes folders content, while keeping folder itself.
@author Paulius Dambrauskas (p.dambrauskas@gmail.com) | run | java | pinterest/secor | src/main/java/com/pinterest/secor/io/StagingDirectoryCleaner.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/StagingDirectoryCleaner.java | Apache-2.0 |
@Override
public FileReader BuildFileReader(LogFilePath logFilePath,
CompressionCodec codec) throws Exception {
return new JsonORCFileReader(logFilePath, codec);
} | ORC reader/writer implementation
@author Ashish (ashu.impetus@gmail.com) | BuildFileReader | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java | Apache-2.0 |
@Override
public FileWriter BuildFileWriter(LogFilePath logFilePath,
CompressionCodec codec) throws Exception {
return new JsonORCFileWriter(logFilePath, codec);
} | ORC reader/writer implementation
@author Ashish (ashu.impetus@gmail.com) | BuildFileWriter | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java | Apache-2.0 |
@Override
public KeyValue next() throws IOException {
boolean endOfBatch = false;
StringWriter sw = new StringWriter();
if (rowIndex > batch.size - 1) {
endOfBatch = !rows.nextBatch(batch);
rowIndex = 0;
}
if (endOfBat... | ORC reader/writer implementation
@author Ashish (ashu.impetus@gmail.com) | next | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java | Apache-2.0 |
@Override
public void close() throws IOException {
rows.close();
} | ORC reader/writer implementation
@author Ashish (ashu.impetus@gmail.com) | close | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java | Apache-2.0 |
@Override
public long getLength() throws IOException {
return writer.getRawDataSize();
} | ORC reader/writer implementation
@author Ashish (ashu.impetus@gmail.com) | getLength | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java | Apache-2.0 |
@Override
public void write(KeyValue keyValue) throws IOException {
JsonElement jsonElement = gson.fromJson(new String(keyValue.getValue()), JsonElement.class);
if (jsonElement instanceof JsonObject) {
writeOne((JsonObject) jsonElement);
} else if (jsonElement... | ORC reader/writer implementation
@author Ashish (ashu.impetus@gmail.com) | write | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java | Apache-2.0 |
private void writeOne(JsonObject object) throws IOException {
rowIndex = batch.size++;
VectorColumnFiller.fillRow(rowIndex, converters, schema, batch, object);
if (batch.size == batch.getMaxSize()) {
writer.addRowBatch(batch);
batch.reset();
... | ORC reader/writer implementation
@author Ashish (ashu.impetus@gmail.com) | writeOne | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java | Apache-2.0 |
@Override
public void close() throws IOException {
writer.addRowBatch(batch);
writer.close();
} | ORC reader/writer implementation
@author Ashish (ashu.impetus@gmail.com) | close | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java | Apache-2.0 |
private CompressionKind resolveCompression(CompressionCodec codec) {
if (codec instanceof Lz4Codec)
return CompressionKind.LZ4;
else if (codec instanceof SnappyCodec)
return CompressionKind.SNAPPY;
// although GZip and ZLIB are not same thing
// there is no better... | Used for returning the compression kind used in ORC
@param codec
@return | resolveCompression | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java | Apache-2.0 |
@Override
public FileReader BuildFileReader(LogFilePath logFilePath, CompressionCodec codec) throws Exception {
return new MessagePackSequenceFileReader(logFilePath);
} | Sequence file reader writer implementation
@author Praveen Murugesan (praveen@uber.com) | BuildFileReader | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/MessagePackSequenceFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/MessagePackSequenceFileReaderWriterFactory.java | Apache-2.0 |
@Override
public FileWriter BuildFileWriter(LogFilePath logFilePath, CompressionCodec codec) throws IOException {
return new MessagePackSequenceFileWriter(logFilePath, codec);
} | Sequence file reader writer implementation
@author Praveen Murugesan (praveen@uber.com) | BuildFileWriter | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/MessagePackSequenceFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/MessagePackSequenceFileReaderWriterFactory.java | Apache-2.0 |
@Override
public KeyValue next() throws IOException {
if (mReader.next(mKey, mValue)) {
try(MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(mKey.getBytes())) {
int mapSize = unpacker.unpackMapHeader();
long offset = 0;
... | Sequence file reader writer implementation
@author Praveen Murugesan (praveen@uber.com) | next | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/MessagePackSequenceFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/MessagePackSequenceFileReaderWriterFactory.java | Apache-2.0 |
@Override
public void close() throws IOException {
this.mReader.close();
} | Sequence file reader writer implementation
@author Praveen Murugesan (praveen@uber.com) | close | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/MessagePackSequenceFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/MessagePackSequenceFileReaderWriterFactory.java | Apache-2.0 |
@Override
public long getLength() throws IOException {
return this.mWriter.getLength();
} | Sequence file reader writer implementation
@author Praveen Murugesan (praveen@uber.com) | getLength | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/MessagePackSequenceFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/MessagePackSequenceFileReaderWriterFactory.java | Apache-2.0 |
@Override
public void write(KeyValue keyValue) throws IOException {
byte[] kafkaKey = keyValue.hasKafkaKey() ? keyValue.getKafkaKey() : new byte[0];
long timestamp = keyValue.getTimestamp();
final int timestampLength = (keyValue.hasTimestamp()) ? 10 : 0;
// output... | Sequence file reader writer implementation
@author Praveen Murugesan (praveen@uber.com) | write | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/MessagePackSequenceFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/MessagePackSequenceFileReaderWriterFactory.java | Apache-2.0 |
@Override
public void close() throws IOException {
this.mWriter.close();
} | Sequence file reader writer implementation
@author Praveen Murugesan (praveen@uber.com) | close | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/MessagePackSequenceFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/MessagePackSequenceFileReaderWriterFactory.java | Apache-2.0 |
private int numberOfFieldsMappedInHeader(KeyValue keyValue) {
int fields = 1;
if (keyValue.hasKafkaKey())
fields++;
if (keyValue.hasTimestamp())
fields++;
return fields;
} | Sequence file reader writer implementation
@author Praveen Murugesan (praveen@uber.com) | numberOfFieldsMappedInHeader | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/MessagePackSequenceFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/MessagePackSequenceFileReaderWriterFactory.java | Apache-2.0 |
@Override
public FileReader BuildFileReader(LogFilePath logFilePath, CompressionCodec codec) throws Exception {
return new ProtobufParquetFileReader(logFilePath, codec);
} | Implementation for reading/writing protobuf messages to/from Parquet files.
@author Michael Spector (spektom@gmail.com) | BuildFileReader | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/ProtobufParquetFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/ProtobufParquetFileReaderWriterFactory.java | Apache-2.0 |
@Override
public FileWriter BuildFileWriter(LogFilePath logFilePath, CompressionCodec codec) throws Exception {
return new ProtobufParquetFileWriter(logFilePath, codec);
} | Implementation for reading/writing protobuf messages to/from Parquet files.
@author Michael Spector (spektom@gmail.com) | BuildFileWriter | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/ProtobufParquetFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/ProtobufParquetFileReaderWriterFactory.java | Apache-2.0 |
@Override
public KeyValue next() throws IOException {
Builder messageBuilder = (Builder) reader.read();
if (messageBuilder != null) {
return new KeyValue(offset++, messageBuilder.build().toByteArray());
}
return null;
} | Implementation for reading/writing protobuf messages to/from Parquet files.
@author Michael Spector (spektom@gmail.com) | next | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/ProtobufParquetFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/ProtobufParquetFileReaderWriterFactory.java | Apache-2.0 |
@Override
public void close() throws IOException {
reader.close();
} | Implementation for reading/writing protobuf messages to/from Parquet files.
@author Michael Spector (spektom@gmail.com) | close | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/ProtobufParquetFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/ProtobufParquetFileReaderWriterFactory.java | Apache-2.0 |
@Override
public long getLength() throws IOException {
return writer.getDataSize();
} | Implementation for reading/writing protobuf messages to/from Parquet files.
@author Michael Spector (spektom@gmail.com) | getLength | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/ProtobufParquetFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/ProtobufParquetFileReaderWriterFactory.java | Apache-2.0 |
@Override
public void write(KeyValue keyValue) throws IOException {
Message message = protobufUtil.decodeProtobufOrJsonMessage(topic, keyValue.getValue());
writer.write(message);
} | Implementation for reading/writing protobuf messages to/from Parquet files.
@author Michael Spector (spektom@gmail.com) | write | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/ProtobufParquetFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/ProtobufParquetFileReaderWriterFactory.java | Apache-2.0 |
@Override
public void close() throws IOException {
writer.close();
} | Implementation for reading/writing protobuf messages to/from Parquet files.
@author Michael Spector (spektom@gmail.com) | close | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/ProtobufParquetFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/ProtobufParquetFileReaderWriterFactory.java | Apache-2.0 |
@Override
public FileReader BuildFileReader(LogFilePath logFilePath, CompressionCodec codec) throws Exception {
return new SequenceFileReader(logFilePath);
} | Sequence file reader writer implementation
@author Praveen Murugesan (praveen@uber.com) | BuildFileReader | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/SequenceFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/SequenceFileReaderWriterFactory.java | Apache-2.0 |
@Override
public FileWriter BuildFileWriter(LogFilePath logFilePath, CompressionCodec codec) throws IOException {
return new SequenceFileWriter(logFilePath, codec);
} | Sequence file reader writer implementation
@author Praveen Murugesan (praveen@uber.com) | BuildFileWriter | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/SequenceFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/SequenceFileReaderWriterFactory.java | Apache-2.0 |
@Override
public KeyValue next() throws IOException {
if (mReader.next(mKey, mValue)) {
return new KeyValue(mKey.get(), Arrays.copyOfRange(mValue.getBytes(), 0, mValue.getLength()));
} else {
return null;
}
} | Sequence file reader writer implementation
@author Praveen Murugesan (praveen@uber.com) | next | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/SequenceFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/SequenceFileReaderWriterFactory.java | Apache-2.0 |
@Override
public void close() throws IOException {
this.mReader.close();
} | Sequence file reader writer implementation
@author Praveen Murugesan (praveen@uber.com) | close | java | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/SequenceFileReaderWriterFactory.java | https://github.com/pinterest/secor/blob/master/src/main/java/com/pinterest/secor/io/impl/SequenceFileReaderWriterFactory.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.