/// <summary> /// Get a composite object wrapping the instances of the <see cref="Processors.IStateStore"/> with the provided /// storeName and <see cref="IQueryableStoreType{T, K, V}"/> /// </summary> /// <typeparam name="T">The expected type of the returned store</typeparam> /// <typeparam name="K">Key type</typeparam> /// <typeparam name="V">Value type</typeparam> /// <param name="storeQueryParameters">parameters to be used when querying for store</param> /// <returns>A composite object that wraps the store instances.</returns> public T GetStore <T, K, V>(StoreQueryParameters <T, K, V> storeQueryParameters) where T : class { IEnumerable <T> globalStore = globalStateStoreProvider.Stores(storeQueryParameters); if (globalStore.Any()) { return(storeQueryParameters.QueryableStoreType.Create(new GlobalStateStoreProviderFacade <T, K, V>(globalStateStoreProvider), storeQueryParameters.StoreName)); } IEnumerable <T> allStores = storeProviders .SelectMany(store => store.Stores(storeQueryParameters)); if (!allStores.Any()) { throw new InvalidStateStoreException($"The state store, {storeQueryParameters.StoreName}, may have migrated to another instance."); } return(storeQueryParameters .QueryableStoreType .Create( new WrappingStoreProvider <T, K, V>(storeProviders, storeQueryParameters), storeQueryParameters.StoreName)); }
public IEnumerable <T> Stores(string storeName, IQueryableStoreType <T, K, V> queryableStoreType) { return(globalStateStoreProvider.Stores(StoreQueryParameters.FromNameAndType(storeName, queryableStoreType))); }