@Override public void init(final ProcessorContext context, final StateStore root) { inner.init(context, root); final String topic = ProcessorStateManager.storeChangelogTopic(context.applicationId(), inner.name()); this.changeLogger = new StoreChangeLogger<>(inner.name(), context, new StateSerdes<>(topic, Serdes.Bytes(), Serdes.ByteArray())); // if the inner store is an LRU cache, add the eviction listener to log removed record if (inner instanceof MemoryLRUCache) { ((MemoryLRUCache<Bytes, byte[]>) inner).whenEldestRemoved(new MemoryLRUCache.EldestEntryRemovalListener<Bytes, byte[]>() { @Override public void apply(final Bytes key, final byte[] value) { // pass null to indicate removal changeLogger.logChange(key, null); } }); } }
@Override @SuppressWarnings("unchecked") public void init(final ProcessorContext context, final StateStore root) { inner.init(context, root); // construct the serde final StateSerdes<K, V> serdes = new StateSerdes<>( ProcessorStateManager.storeChangelogTopic(context.applicationId(), inner.name()), keySerde == null ? (Serde<K>) context.keySerde() : keySerde, valueSerde == null ? (Serde<V>) context.valueSerde() : valueSerde); this.changeLogger = new StoreChangeLogger<>(inner.name(), context, serdes); // if the inner store is an LRU cache, add the eviction listener to log removed record if (inner instanceof MemoryLRUCache) { ((MemoryLRUCache<K, V>) inner).whenEldestRemoved(new MemoryNavigableLRUCache.EldestEntryRemovalListener<K, V>() { @Override public void apply(final K key, final V value) { removed(key); } }); } }
@Override @SuppressWarnings("unchecked") public void init(ProcessorContext context, StateStore root) { inner.init(context, root); // construct the serde StateSerdes<K, V> serdes = new StateSerdes<>( ProcessorStateManager.storeChangelogTopic(context.applicationId(), inner.name()), keySerde == null ? (Serde<K>) context.keySerde() : keySerde, valueSerde == null ? (Serde<V>) context.valueSerde() : valueSerde); // Twitter Changed //this.changeLogger = new StoreChangeLogger<>(inner.name(), context, serdes); this.changeLogger = new StoreChangeFlushingLogger<>(inner.name(), context, serdes); // if the inner store is an LRU cache, add the eviction listener to log removed record if (inner instanceof MemoryLRUCache) { ((MemoryLRUCache<K, V>) inner).whenEldestRemoved(new MemoryNavigableLRUCache.EldestEntryRemovalListener<K, V>() { @Override public void apply(K key, V value) { removed(key); } }); } }
@SuppressWarnings("unchecked") private void initInternal(final ProcessorContext context) { this.context = (InternalProcessorContext) context; this.serdes = new StateSerdes<>(ProcessorStateManager.storeChangelogTopic(context.applicationId(), underlying.name()), keySerde == null ? (Serde<K>) context.keySerde() : keySerde, valueSerde == null ? (Serde<V>) context.valueSerde() : valueSerde); this.cache = this.context.getCache(); this.cacheName = ThreadCache.nameSpaceFromTaskIdAndStore(context.taskId().toString(), underlying.name()); cache.addDirtyEntryFlushListener(cacheName, new ThreadCache.DirtyEntryFlushListener() { @Override public void apply(final List<ThreadCache.DirtyEntry> entries) { for (final ThreadCache.DirtyEntry entry : entries) { putAndMaybeForward(entry, (InternalProcessorContext) context); } } }); }
public void init(final ProcessorContext context, final StateStore root) { final String storeName = bytesStore.name(); topic = ProcessorStateManager.storeChangelogTopic(context.applicationId(), storeName); bytesStore.init(context, root); serdes = new StateSerdes<>(topic, new AggregateKeySerde<>(), new KryoSerDe<>()); }
@Override @SuppressWarnings("unchecked") public void init(final ProcessorContext context, final StateStore root) { final String storeName = bytesStore.name(); topic = ProcessorStateManager.storeChangelogTopic(context.applicationId(), storeName); final Serde<MatchedEvent<K, V>> valueSerDes = new MatchedEventSerde<>( keySerde == null ? (Serde<K>) context.keySerde() : keySerde, valueSerde == null ? (Serde<V>) context.valueSerde() : valueSerde); this.serdes = new StateSerdes<>(topic, new KryoSerDe<Matched>(), valueSerDes); bytesStore.init(context, root); }
public void init(final ProcessorContext context, final StateStore root) { final String storeName = bytesStore.name(); topic = ProcessorStateManager.storeChangelogTopic(context.applicationId(), storeName); bytesStore.init(context, root); Serde<K> kSerde = keySerde == null ? (Serde<K>) context.keySerde() : keySerde; Serde<NFAStates<K, V>> serdes = new NFAStateValueSerde<>( new ComputationStageSerde<>(stages, kSerde, valueSerde == null ? (Serde<V>) context.valueSerde() : valueSerde)); this.serdes = new StateSerdes<>(topic, new RunnedKeySerde<>(kSerde), serdes); }