Enum ConsistencyLevel
- Namespace
- Excalibur.Data.CloudNative
- Assembly
- Excalibur.Data.Abstractions.dll
Defines consistency levels for cloud-native database operations.
public enum ConsistencyLevel
Fields
BoundedStaleness = 3Bounded 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 = 0Use the default consistency level configured for the database account.
Eventual = 4Eventual consistency: reads may not reflect recent writes. Lowest latency, weakest guarantees.
Use for:
- Social media feeds
- Product catalogs
- Non-critical read operations
Session = 2Session 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 = 1Strong 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:
| Level | Cosmos DB | DynamoDB | Firestore |
|---|---|
| Strong | Strong | Strongly consistent | Default |
| Session | Session | N/A (use strong) | N/A |
| BoundedStaleness | BoundedStaleness | N/A | N/A |
| Eventual | Eventual | Eventually consistent | N/A |