Interface IStateStoreClient
- Namespace
- Azure.Iot.Operations.Services.StateStore
- Assembly
- Azure.Iot.Operations.Services.dll
The interface for interacting with a generic state store.
public interface IStateStoreClient : IAsyncDisposable
- Inherited Members
Remarks
StateStoreClient provides an implementation of this interface for the state store that is part of Akri MQ.
Methods
DeleteAsync(StateStoreKey, StateStoreDeleteRequestOptions?, TimeSpan?, CancellationToken)
Delete the provided key from the State Store.
Task<StateStoreDeleteResponse> DeleteAsync(StateStoreKey key, StateStoreDeleteRequestOptions? options = null, TimeSpan? requestTimeout = null, CancellationToken cancellationToken = default)
Parameters
key
StateStoreKeyThe key to delete from the State Store.
options
StateStoreDeleteRequestOptionsThe optional parameters for this request. OnlyDeleteIfValueEquals allows for conditional deletion.
requestTimeout
TimeSpan?The request timeout.
cancellationToken
CancellationTokenCancellation token.
Returns
- Task<StateStoreDeleteResponse>
The details of the service response.
DisposeAsync(bool)
ValueTask DisposeAsync(bool disposing)
Parameters
disposing
bool
Returns
GetAsync(StateStoreKey, TimeSpan?, CancellationToken)
Get the value of a key from the State Store.
Task<StateStoreGetResponse> GetAsync(StateStoreKey key, TimeSpan? requestTimeout = null, CancellationToken cancellationToken = default)
Parameters
key
StateStoreKeyThe key to get the value of.
requestTimeout
TimeSpan?The optional timeout for this request.
cancellationToken
CancellationTokenCancellation token.
Returns
- Task<StateStoreGetResponse>
The service response containing the current value of the key in the State Store.
ObserveAsync(StateStoreKey, TimeSpan?, CancellationToken)
Begin receiving events each time the provided key is updated, deleted, or created. Events will be delivered via KeyChangeMessageReceivedAsync.
Task ObserveAsync(StateStoreKey key, TimeSpan? requestTimeout = null, CancellationToken cancellationToken = default)
Parameters
key
StateStoreKeyThe key to receive notifications about.
requestTimeout
TimeSpan?The optional timeout for this request.
cancellationToken
CancellationTokenCancellation token.
Returns
Remarks
This method does not support using wildcard characters to subscribe to multiple keys at once.
SetAsync(StateStoreKey, StateStoreValue, StateStoreSetRequestOptions?, TimeSpan?, CancellationToken)
Set the value of a key in the State Store.
Task<StateStoreSetResponse> SetAsync(StateStoreKey key, StateStoreValue value, StateStoreSetRequestOptions? options = null, TimeSpan? requestTimeout = null, CancellationToken cancellationToken = default)
Parameters
key
StateStoreKeyThe key to set in the State Store.
value
StateStoreValueThe value to assign
key
in the State Store.options
StateStoreSetRequestOptionsThe parameters for this request including the key and value to use. Condition allows for conditional setting/overwriting of values.
requestTimeout
TimeSpan?The optional timeout for this request.
cancellationToken
CancellationTokenCancellation token.
Returns
- Task<StateStoreSetResponse>
The service response detailing if the operation succeeded and (optionally) the previous value of this key.
UnobserveAsync(StateStoreKey, TimeSpan?, CancellationToken)
Stop receiving events each time the provided key is updated, created, or deleted.
Task UnobserveAsync(StateStoreKey key, TimeSpan? requestTimeout = null, CancellationToken cancellationToken = default)
Parameters
key
StateStoreKeyThe key to stop receiving events about.
requestTimeout
TimeSpan?The optional timeout for this request.
cancellationToken
CancellationTokenCancellation token.
Returns
Remarks
This method does not support using wildcard characters to unsubscribe from multiple keys at once.
Events
KeyChangeMessageReceivedAsync
The event that executes each time an observed key is changed.
event Func<object?, KeyChangeMessageReceivedEventArgs, Task>? KeyChangeMessageReceivedAsync