public override void Init(ProcessorContext context)
        {
            base.Init(context);

            if (this.queryableName != null)
            {
                store          = (ITimestampedKeyValueStore <K, V>)context.GetStateStore(queryableName);
                tupleForwarder = new TimestampedTupleForwarder <K, V>(this, sendOldValues);
            }
        }
Exemple #2
0
        /// <summary>
        /// Get the <see cref="IReadOnlyKeyValueStore{K,V}"/> or <see cref="ITimestampedKeyValueStore{K,V}"/> with the given name.
        /// The store can be a "regular" or global store.
        /// <p>
        /// If the registered store is a <see cref="ITimestampedKeyValueStore{K,V}"/> this method will return a value-only query
        /// interface.
        /// </p>
        /// </summary>
        /// <typeparam name="K">key type</typeparam>
        /// <typeparam name="V">value type</typeparam>
        /// <param name="name">the name of the store</param>
        /// <returns>the key value store, or null if no <see cref="IReadOnlyKeyValueStore{K,V}"/> or <see cref="ITimestampedKeyValueStore{K,V}"/> has been registered with the given name</returns>
        public IReadOnlyKeyValueStore <K, V> GetKeyValueStore <K, V>(string name)
        {
            var store = behavior.GetStateStore <K, V>(name);

            return(store switch
            {
                ITimestampedKeyValueStore <K, V> valueStore => new ReadOnlyKeyValueStoreFacade <K, V>(valueStore),
                IReadOnlyKeyValueStore <K, V> keyValueStore => keyValueStore,
                _ => null
            });
 public void Setup()
 {
     wStore             = this.CreateMockStore <IWindowStore <object, object> >();
     kvStore            = this.CreateMockStore <IKeyValueStore <object, object> >();
     timestampedKVStore = this.CreateMockStore <ITimestampedKeyValueStore <object, object> >();
     timestampWStore    = this.CreateMockStore <ITimestampedWindowStore <object, object> >();
     stores             = new Dictionary <string, IStateStore> {
         { "kv-store", kvStore },
         { "ts-kv-store", timestampedKVStore },
         { "ws-store", wStore },
         { "ts-w-store", timestampWStore }
     };
 }
Exemple #4
0
        public override void Init(ProcessorContext context)
        {
            base.Init(context);

            if (queryableStoreName != null)
            {
                store          = (ITimestampedKeyValueStore <KS, VS>)context.GetStateStore(queryableStoreName);
                tupleForwarder = new TimestampedTupleForwarder <K, V>(this, sendOldValues);
            }

            if (throwException && (queryableStoreName == null || store == null || tupleForwarder == null))
            {
                throw new StreamsException($"{logPrefix}Processor {Name} doesn't have queryable store name. Please set a correct name to materialed view !");
            }
        }
 public ReadOnlyKeyValueStoreFacade(ITimestampedKeyValueStore <K, V> store)
 {
     innerStore = store;
 }
Exemple #6
0
 public void Init(ProcessorContext context) =>
 store = (ITimestampedKeyValueStore <K, V>)context.GetStateStore(storeName);
 public override void Init(ProcessorContext context)
 {
     base.Init(context);
     store          = (ITimestampedKeyValueStore <K1, V1>)context.GetStateStore(storeName);
     tupleForwarder = new TimestampedTupleForwarder <K, V>(this, sendOldValues);
 }