Table of Contents

Class ConsistencyOptions

Namespace
Excalibur.Data.CloudNative
Assembly
Excalibur.Data.Abstractions.dll

Default implementation of IConsistencyOptions.

public sealed class ConsistencyOptions : IConsistencyOptions
Inheritance
ConsistencyOptions
Implements
Inherited Members

Constructors

ConsistencyOptions(ConsistencyLevel, string?, TimeSpan?, long?)

Initializes a new instance of the ConsistencyOptions class.

public ConsistencyOptions(ConsistencyLevel consistencyLevel, string? sessionToken = null, TimeSpan? maxStaleness = null, long? maxVersionLag = null)

Parameters

consistencyLevel ConsistencyLevel

The desired consistency level.

sessionToken string

Optional session token for session consistency.

maxStaleness TimeSpan?

Optional maximum staleness for bounded staleness.

maxVersionLag long?

Optional maximum version lag for bounded staleness.

Fields

Default

Gets the default consistency options (uses database default).

public static readonly ConsistencyOptions Default

Field Value

ConsistencyOptions

Eventual

Gets eventual consistency options.

public static readonly ConsistencyOptions Eventual

Field Value

ConsistencyOptions

Strong

Gets strong consistency options.

public static readonly ConsistencyOptions Strong

Field Value

ConsistencyOptions

Properties

ConsistencyLevel

Gets the desired consistency level for the operation.

public ConsistencyLevel ConsistencyLevel { get; }

Property Value

ConsistencyLevel

MaxStaleness

Gets the maximum staleness for bounded staleness consistency.

public TimeSpan? MaxStaleness { get; }

Property Value

TimeSpan?

The maximum allowed staleness duration, or null if not using bounded staleness.

MaxVersionLag

Gets the maximum version lag for bounded staleness consistency.

public long? MaxVersionLag { get; }

Property Value

long?

The maximum number of versions the read can lag behind, or null if not applicable.

SessionToken

Gets the session token for session-level consistency.

public string? SessionToken { get; }

Property Value

string

The session token, or null if session consistency is not used. Session tokens are typically returned from write operations and passed to subsequent read operations to ensure read-your-writes consistency.

Methods

WithBoundedStaleness(TimeSpan, long?)

Creates bounded staleness options with the specified parameters.

public static ConsistencyOptions WithBoundedStaleness(TimeSpan maxStaleness, long? maxVersionLag = null)

Parameters

maxStaleness TimeSpan

Maximum time staleness allowed.

maxVersionLag long?

Maximum version lag allowed (optional).

Returns

ConsistencyOptions

Bounded staleness consistency options.

WithSession(string)

Creates session consistency options with the specified session token.

public static ConsistencyOptions WithSession(string sessionToken)

Parameters

sessionToken string

The session token from a previous write operation.

Returns

ConsistencyOptions

Session consistency options.