Skip to content

[Feature]: Add Async/Await support in Cortex.States #158

@eneshoxha

Description

@eneshoxha

New async interface

We are introducing IAsyncDataStore for not introducing a breaking change in IDataSource

public interface IAsyncDataStore<TKey, TValue> : IDataStore<TKey, TValue>
{
    ValueTask<TValue?> GetAsync(
        TKey key,
        CancellationToken cancellationToken = default);

    ValueTask PutAsync(
        TKey key,
        TValue value,
        CancellationToken cancellationToken = default);

    ValueTask<bool> ContainsKeyAsync(
        TKey key,
        CancellationToken cancellationToken = default);

    ValueTask RemoveAsync(
        TKey key,
        CancellationToken cancellationToken = default);

#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_0_OR_GREATER
    IAsyncEnumerable<KeyValuePair<TKey, TValue>> GetAllAsync(
        CancellationToken cancellationToken = default);

    IAsyncEnumerable<TKey> GetKeysAsync(
        CancellationToken cancellationToken = default);
#endif

    ValueTask<IDictionary<TKey, TValue>> GetManyAsync(
        IEnumerable<TKey> keys,
        CancellationToken cancellationToken = default);

    ValueTask PutManyAsync(
        IEnumerable<KeyValuePair<TKey, TValue>> items,
        CancellationToken cancellationToken = default);
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestfeatureThis label is in use for minor version increments

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions