Skip to content

JournalStorageConsumerExtensions Methods

Helper methods for reading journal storage data.

Complete(IJournalStorageConsumer, IJournalMetadata?)

staticextension
View source
public static void Complete(this IJournalStorageConsumer consumer, IJournalMetadata? metadata)
Notifies consumer that no more data will be supplied.

Parameters

consumerIJournalStorageConsumer
The journal storage consumer.
metadataIJournalMetadata?
The metadata associated with the journal data being read, or null if no metadata is available.

Read(IJournalStorageConsumer, IEnumerable<ReadOnlyMemory<byte>>, IJournalMetadata?, bool)

staticextension
View source
public static void Read(this IJournalStorageConsumer consumer, IEnumerable<ReadOnlyMemory<byte>> segments, IJournalMetadata? metadata, bool complete)
Supplies ordered segments to consumer.

Parameters

consumerIJournalStorageConsumer
The journal storage consumer.
segmentsIEnumerable<ReadOnlyMemory<byte>>
The ordered bytes to read.
metadataIJournalMetadata?
The metadata associated with the journal data being read, or null if no metadata is available.
completebool
Whether to notify the consumer that no more data will be supplied. If false, the consumer must read all supplied bytes.

Read(IJournalStorageConsumer, ReadOnlyMemory<byte>, IJournalMetadata?, bool)

staticextension
View source
public static void Read(this IJournalStorageConsumer consumer, ReadOnlyMemory<byte> input, IJournalMetadata? metadata, bool complete)
Supplies input to consumer.

Parameters

consumerIJournalStorageConsumer
The journal storage consumer.
inputReadOnlyMemory<byte>
The bytes to read.
metadataIJournalMetadata?
The metadata associated with the journal data being read, or null if no metadata is available.
completebool
Whether to notify the consumer that no more data will be supplied. If false, the consumer must read all supplied bytes.

Read(IJournalStorageConsumer, ReadOnlySequence<byte>, IJournalMetadata?, bool)

staticextension
View source
public static void Read(this IJournalStorageConsumer consumer, ReadOnlySequence<byte> input, IJournalMetadata? metadata, bool complete)
Supplies input to consumer.

Parameters

consumerIJournalStorageConsumer
The journal storage consumer.
inputReadOnlySequence<byte>
The bytes to read.
metadataIJournalMetadata?
The metadata associated with the journal data being read, or null if no metadata is available.
completebool
Whether to notify the consumer that no more data will be supplied. If false, the consumer must read all supplied bytes.

ReadAsync(IJournalStorageConsumer, Stream, IJournalMetadata?, CancellationToken)

staticextension
View source
public static ValueTask<long> ReadAsync(this IJournalStorageConsumer consumer, Stream input, IJournalMetadata? metadata, CancellationToken cancellationToken)
Reads all bytes from input and incrementally supplies them to consumer.

Parameters

consumerIJournalStorageConsumer
The journal storage consumer.
inputStream
The stream to read from.
metadataIJournalMetadata?
The metadata associated with the journal data being read, or null if no metadata is available.
cancellationTokenCancellationToken
The cancellation token.

Returns

The number of bytes read from input.

ReadAsync(IJournalStorageConsumer, Stream, IJournalMetadata?, bool, CancellationToken)

staticextension
View source
public static ValueTask<long> ReadAsync(this IJournalStorageConsumer consumer, Stream input, IJournalMetadata? metadata, bool complete, CancellationToken cancellationToken)
Reads all bytes from input and incrementally supplies them to consumer.

Parameters

consumerIJournalStorageConsumer
The journal storage consumer.
inputStream
The stream to read from.
metadataIJournalMetadata?
The metadata associated with the journal data being read, or null if no metadata is available.
completebool
Whether to notify the consumer that no more data will be supplied. If false, the consumer must read all supplied bytes.
cancellationTokenCancellationToken
The cancellation token.

Returns

The number of bytes read from input.