Table of Contents

Class ReadStreamRequest

Namespace
DynaSharp.Streams
Assembly
DynaSharp.dll

Reads every shard of a stream in one process, for ReadStreamAsync(ReadStreamRequest, CancellationToken).

public sealed record ReadStreamRequest : IEquatable<ReadStreamRequest>
Inheritance
ReadStreamRequest
Implements
Inherited Members

Remarks

The position is one of two: TrimHorizon for everything still kept, or Latest for what is written from now on. It applies to the shards open at the start; a shard that starts later is read from its first sequence number. There is no position to resume at: to resume, read the shard of a record with ReadShardAsync(ReadShardRequest, CancellationToken) and AfterSequenceNumber. To read the stream of a table without its ARN, see ReadStreamAsync<T>(Table<T>, DynamoDbStreamsClient, ShardIteratorType, TimeSpan?, Action?, CancellationToken).

Constructors

ReadStreamRequest()

public ReadStreamRequest()

Properties

EmptyPageDelay

Gets how long the reader of a shard waits after a page without records before it asks again, on TimeProvider, as EmptyPageDelay does. The default is one second.

public TimeSpan EmptyPageDelay { get; init; }

Property Value

TimeSpan

Remarks

The same wait, but at least a second, comes between two looks for the children of a closed shard while the stream is still enabled and DynamoDB lists none yet. Zero asks a shard again at once. The delay must stay below the 15 minutes an iterator lives.

OnJoined

Gets what is called once when the reading holds a position in every shard it starts with, or null for nothing. A write that DynamoDB acknowledges after the call is read, unless the reading ends before.

public Action? OnJoined { get; init; }

Property Value

Action

Remarks

The shards it starts with are those read at the start: with Latest every shard that is open then, with TrimHorizon every shard whose parent is not listed. A shard holds a position once GetShardIterator gave it an iterator, or said that it has nothing to read. A write after the call lands in one of those shards behind that position, or in a shard that is read from its first record: a child, or a shard listed later. So a test, or a view that loads the table and then follows its changes, writes or loads once this was called, and the changes from then on come through the reading.

It is called on the task of a reader, after the first MoveNextAsync and before or after the first record, never more than once, and not at all when the reading fails or is stopped before. A stream without a shard to start with calls it once it is listed. A shard that a transient failure holds up delays it, see ReadStreamAsync(ReadStreamRequest, CancellationToken). Keep it short, such as TrySetResult(): the readers wait while it runs, and an exception from it ends the reading with that exception.

ShardIteratorType

Gets where reading starts in the shards that are open at the start: TrimHorizon or Latest.

public required ShardIteratorType ShardIteratorType { get; init; }

Property Value

ShardIteratorType

Remarks

With TrimHorizon the shards that are closed at the start are read too, from their oldest record, each before its children. With Latest they have nothing to read from now on, so only their open descendants are, from the start of the reading on, and a child listed after the start, of a split in progress, from its first record.

StreamArn

Gets the ARN of the stream, LatestStreamArn of its table.

public required string StreamArn { get; init; }

Property Value

string

Methods

Equals(ReadStreamRequest?)

public bool Equals(ReadStreamRequest? other)

Parameters

other ReadStreamRequest

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

Operators

operator ==(ReadStreamRequest?, ReadStreamRequest?)

public static bool operator ==(ReadStreamRequest? left, ReadStreamRequest? right)

Parameters

left ReadStreamRequest
right ReadStreamRequest

Returns

bool

operator !=(ReadStreamRequest?, ReadStreamRequest?)

public static bool operator !=(ReadStreamRequest? left, ReadStreamRequest? right)

Parameters

left ReadStreamRequest
right ReadStreamRequest

Returns

bool