Interface IStateStore
- Assembly
- GroupeIsa.Neos.ClusterCommunication.dll
Provides the functionalities of a distributed state store.
public interface IStateStore
Methods
DeleteBulkStateAsync(IReadOnlyList<BulkStateStoreItem>, CancellationToken)
Deletes a list of items
from the state store.
Task DeleteBulkStateAsync(IReadOnlyList<BulkStateStoreItem> items, CancellationToken cancellationToken = default)
Parameters
items
IReadOnlyList<BulkStateStoreItem>The list of items to delete.
cancellationToken
CancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
DeleteStateAsync(string, StateStoreConsistency, StateStoreConcurrency, CancellationToken)
Deletes the value associated with the provided key
in the state store.
Task DeleteStateAsync(string key, StateStoreConsistency stateStoreConsistency = StateStoreConsistency.Strong, StateStoreConcurrency stateStoreConcurrency = StateStoreConcurrency.LastWrite, CancellationToken cancellationToken = default)
Parameters
key
stringThe state key.
stateStoreConsistency
StateStoreConsistencystateStoreConcurrency
StateStoreConcurrencyThe concurrency mode StateStoreConcurrency.
cancellationToken
CancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
GetStateAsync<TValue>(string, StateStoreConsistency, CancellationToken)
Gets the current value associated with the key
from the state store.
Task<(TValue? Value, string ETag)> GetStateAsync<TValue>(string key, StateStoreConsistency stateStoreConsistency = StateStoreConsistency.Strong, CancellationToken cancellationToken = default)
Parameters
key
stringThe state key.
stateStoreConsistency
StateStoreConsistencyThe consistency mode StateStoreConsistency.
cancellationToken
CancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<(TValue Value, string ETag)>
A Task<TResult> that will return the value when the operation has completed.
Type Parameters
TValue
The data type of the value to read.
QueryStateAsync<TValue>(StateStoreQuery, IReadOnlyCollection<string>?, CancellationToken)
Queries the specified statestore with the given query. The query is a object representation of the query.
Task<StateStoreQueryResult<TValue>> QueryStateAsync<TValue>(StateStoreQuery query, IReadOnlyCollection<string>? indexes = null, CancellationToken cancellationToken = default)
Parameters
query
StateStoreQueryThe query StateStoreQuery.
indexes
IReadOnlyCollection<string>The list of indexes to be searched.
cancellationToken
CancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<StateStoreQueryResult<TValue>>
A StateStoreQueryResult<TValue> that may be paginated, use PaginationToken to continue the query.
Type Parameters
TValue
The data type of the value to read.
SaveBulkStateAsync<TValue>(IReadOnlyList<BulkStateStoreItem<TValue>>, CancellationToken)
Saves a list of items
to the state store.
Task SaveBulkStateAsync<TValue>(IReadOnlyList<BulkStateStoreItem<TValue>> items, CancellationToken cancellationToken = default)
Parameters
items
IReadOnlyList<BulkStateStoreItem<TValue>>The list of items to save.
cancellationToken
CancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
Type Parameters
TValue
The type of the data that will be JSON serialized and stored in the state store.
SaveStateAsync<TValue>(string, TValue, StateStoreConsistency, StateStoreConcurrency, CancellationToken)
Saves the provided value
associated with the provided key
to the state store.
store.
Task SaveStateAsync<TValue>(string key, TValue value, StateStoreConsistency stateStoreConsistency = StateStoreConsistency.Strong, StateStoreConcurrency stateStoreConcurrency = StateStoreConcurrency.LastWrite, CancellationToken cancellationToken = default)
Parameters
key
stringThe state key.
value
TValueThe data that will be JSON serialized and stored in the state store.
stateStoreConsistency
StateStoreConsistencyThe consistency mode StateStoreConsistency.
stateStoreConcurrency
StateStoreConcurrencyThe concurrency mode StateStoreConcurrency.
cancellationToken
CancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
Type Parameters
TValue
The type of the data that will be JSON serialized and stored in the state store.
TrySaveStateAsync<TValue>(string, TValue, string, StateStoreConsistency, StateStoreConcurrency, CancellationToken)
Tries to save the statevalue
associated with the providedkey
using the etag
to the state store.
Task<bool> TrySaveStateAsync<TValue>(string key, TValue value, string etag, StateStoreConsistency stateStoreConsistency = StateStoreConsistency.Strong, StateStoreConcurrency stateStoreConcurrency = StateStoreConcurrency.LastWrite, CancellationToken cancellationToken = default)
Parameters
key
stringThe state key.
value
TValueThe data that will be JSON serialized and stored in the state store.
etag
stringThe etag.
stateStoreConsistency
StateStoreConsistencyThe consistency mode StateStoreConsistency.
stateStoreConcurrency
StateStoreConcurrencyThe concurrency mode StateStoreConcurrency.
cancellationToken
CancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
Type Parameters
TValue
The type of the data that will be JSON serialized and stored in the state store.