public void Register(IStateStore store, StateRestoreCallback callback) { string storeName = store.Name; log.LogDebug("{LogPrefix}Registering state store {StoreName} to its state manager", logPrefix, storeName); if (registeredStores.ContainsKey(storeName)) { throw new ArgumentException($"{logPrefix} Store {storeName} has already been registered."); } var metadata = IsChangelogStateStore(storeName) ? new StateStoreMetadata { Store = store, ChangelogTopicPartition = GetStorePartition(storeName), RestoreCallback = callback, RecordConverter = StateManagerTools.ConverterForStore(store), Offset = null } : new StateStoreMetadata { Store = store, Offset = null }; registeredStores.Add(storeName, metadata); if (IsChangelogStateStore(storeName)) { changelogRegister.Register(GetStorePartition(storeName), this); } log.LogDebug($"{logPrefix}Registered state store {storeName} to its state manager"); }
public void Register(IStateStore store, StateRestoreCallback callback) { string storeName = store.Name; log.Debug($"{logPrefix}Registering state store {storeName} to its state manager"); if (registeredStores.ContainsKey(storeName)) { throw new ArgumentException($"{this.logPrefix} Store {storeName} has already been registered."); } // check that the underlying change log topic exist or not // TODO : Changelog topic //String topic = storeToChangelogTopic.get(storeName); //if (topic != null) //{ // final TopicPartition storePartition = new TopicPartition(topic, getPartition(topic)); // final RecordConverter recordConverter = converterForStore(store); // if (isStandby) // { // log.trace("Preparing standby replica of persistent state store {} with changelog topic {}", storeName, topic); // restoreCallbacks.put(topic, stateRestoreCallback); // recordConverters.put(topic, recordConverter); // } // else // { // final Long restoreCheckpoint = store.persistent() ? initialLoadedCheckpoints.get(storePartition) : null; // if (restoreCheckpoint != null) // { // checkpointFileCache.put(storePartition, restoreCheckpoint); // } // log.trace("Restoring state store {} from changelog topic {} at checkpoint {}", storeName, topic, restoreCheckpoint); // final StateRestorer restorer = new StateRestorer( // storePartition, // new CompositeRestoreListener(stateRestoreCallback), // restoreCheckpoint, // offsetLimit(storePartition), // store.persistent(), // storeName, // recordConverter // ); // changelogReader.register(restorer); // } // changelogPartitions.add(storePartition); //} registeredStores.Add(storeName, store); }
public void Register(IStateStore store, StateRestoreCallback callback) { // nothing to do here for now. Everything is handled in Initialize method. }
internal void Register(IStateStore store, StateRestoreCallback callback) { States.Register(store, callback); }