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
consistencyLevelConsistencyLevelThe desired consistency level.
sessionTokenstringOptional session token for session consistency.
maxStalenessTimeSpan?Optional maximum staleness for bounded staleness.
maxVersionLaglong?Optional maximum version lag for bounded staleness.
Fields
Default
Gets the default consistency options (uses database default).
public static readonly ConsistencyOptions Default
Field Value
Eventual
Gets eventual consistency options.
public static readonly ConsistencyOptions Eventual
Field Value
Strong
Gets strong consistency options.
public static readonly ConsistencyOptions Strong
Field Value
Properties
ConsistencyLevel
Gets the desired consistency level for the operation.
public ConsistencyLevel ConsistencyLevel { get; }
Property Value
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
maxStalenessTimeSpanMaximum time staleness allowed.
maxVersionLaglong?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
sessionTokenstringThe session token from a previous write operation.
Returns
- ConsistencyOptions
Session consistency options.