Table of Contents

Enum ConsistencyLevel

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

Defines consistency levels for cloud-native database operations.

public enum ConsistencyLevel

Fields

BoundedStaleness = 3

Bounded staleness: reads may lag behind writes by a configured time or version window. Provides predictable staleness bounds with good performance.

Use for:

  • Analytics dashboards
  • Reporting systems
  • Read-heavy workloads with acceptable lag
Default = 0

Use the default consistency level configured for the database account.

Eventual = 4

Eventual consistency: reads may not reflect recent writes. Lowest latency, weakest guarantees.

Use for:

  • Social media feeds
  • Product catalogs
  • Non-critical read operations
Session = 2

Session consistency: reads within a session see all writes from that session. Good balance of consistency and performance for single-user scenarios.

Use for:

  • User profile operations
  • Shopping cart management
  • Any single-session workflow
Strong = 1

Strong consistency: reads always return the most recent committed write. Highest latency, strongest guarantees.

Use for:

  • Financial transactions
  • Inventory management
  • Critical business operations

Remarks

Cloud-native databases offer various consistency models to balance latency, throughput, and data freshness. This enum provides a provider-agnostic abstraction that maps to specific database consistency settings.

Provider Mappings:

LevelCosmos DB | DynamoDB | Firestore
StrongStrong | Strongly consistent | Default
SessionSession | N/A (use strong) | N/A
BoundedStalenessBoundedStaleness | N/A | N/A
EventualEventual | Eventually consistent | N/A