Skip to content

IJournalStorage Methods

Provides journal storage.

AppendAsync(ReadOnlySequence<byte>, CancellationToken)

abstract
public abstract ValueTask AppendAsync(ReadOnlySequence<byte> value, CancellationToken cancellationToken)
Appends the provided segment to the journal atomically.

Parameters

valueReadOnlySequence<byte>
The encoded journal bytes to append. The storage provider must not retain this buffer after the returned task completes.
cancellationTokenCancellationToken
The cancellation token.

Returns

A System.Threading.Tasks.ValueTask representing the operation.

CreateIfNotExistsAsync(IReadOnlyDictionary<string, string>, CancellationToken)

virtual
View source
public virtual ValueTask<bool> CreateIfNotExistsAsync(IReadOnlyDictionary<string, string>? metadata = null, CancellationToken cancellationToken = default(CancellationToken))
Creates this journal storage instance if it does not already exist.

Parameters

metadataIReadOnlyDictionary<string, string>
Initial caller-owned metadata properties.
cancellationTokenCancellationToken
The cancellation token.

Returns

true if storage was created; otherwise, false.

DeleteAsync(CancellationToken)

abstract
public abstract ValueTask DeleteAsync(CancellationToken cancellationToken)
Deletes the journal atomically.

Parameters

cancellationTokenCancellationToken
The cancellation token.

Returns

A System.Threading.Tasks.ValueTask representing the operation.

GetMetadataAsync(CancellationToken)

virtual
View source
public virtual ValueTask<IJournalMetadata?> GetMetadataAsync(CancellationToken cancellationToken = default(CancellationToken))
Gets metadata for this journal storage instance.

Parameters

cancellationTokenCancellationToken
The cancellation token.

Returns

The metadata, or null if the storage instance does not exist.

ReadAsync(IJournalStorageConsumer, CancellationToken)

abstract
public abstract ValueTask ReadAsync(IJournalStorageConsumer consumer, CancellationToken cancellationToken)
Reads all journal data belonging to this instance and sends it to consumer.

Parameters

consumerIJournalStorageConsumer
The consumer of ordered raw journal data. Chunk boundaries are not journal-entry boundaries.
cancellationTokenCancellationToken
The cancellation token.

Returns

A System.Threading.Tasks.ValueTask representing the operation.

ReplaceAsync(ReadOnlySequence<byte>, CancellationToken)

abstract
public abstract ValueTask ReplaceAsync(ReadOnlySequence<byte> value, CancellationToken cancellationToken)
Replaces the journal with the provided value atomically.

Parameters

valueReadOnlySequence<byte>
The encoded journal bytes to write. The storage provider must not retain this buffer after the returned task completes.
cancellationTokenCancellationToken
The cancellation token.

Returns

A System.Threading.Tasks.ValueTask representing the operation.

UpdateMetadataAsync(IReadOnlyDictionary<string, string>, IEnumerable<string>, string?, CancellationToken)

virtual
View source
public virtual ValueTask<IJournalMetadata?> UpdateMetadataAsync(IReadOnlyDictionary<string, string>? set = null, IEnumerable<string>? remove = null, string? expectedETag = null, CancellationToken cancellationToken = default(CancellationToken))
Conditionally updates caller-owned metadata properties.

Parameters

setIReadOnlyDictionary<string, string>
Metadata properties to set.
removeIEnumerable<string>
Metadata properties to remove.
expectedETagstring?
The expected metadata ETag, or null for an unconditional update.
cancellationTokenCancellationToken
The cancellation token.

Returns

The current metadata if the update was applied or made no changes; otherwise, null.