OxL Справочник OxL
РусскийEnglish

enum Consistency

Which replica a read of a clustered store is served from (§12.4, D-8220..D-8229).

Example:

oxl✓ проверяется в CI
use std.kv { Kv, Consistency }

fn modes(kv: Kv) -> Kv {
  let _ = Consistency.Linearizable
  let _ = Consistency.Stale
  kv.reading(Consistency.Follower)
}
pub(api) enum Consistency

С версии. 1.0.0-beta

Варианты

Linearizable

The shard leader, after it confirmed its leadership (ReadIndex): the default. A read sees every write that completed before it.

Follower

A replica on this node that is not the leader: it asks the leader for its read index and waits until it has applied it, then reads its own copy. Still linearizable (the same guarantee as Linearizable); the leader does not serve the data, so reads scale with the replicas. Falls back to the leader when this node holds no replica of the shard.

Stale

A replica on this node without asking the leader, as long as it heard from the leader within maxStale: bounded staleness. The answer may miss writes of the last maxStale (and the replication delay), is never older than what this process has already read from the store (monotonic reads) and may not contain the writes of this very process. Falls back to the leader path when the replica is too stale. Outside a cluster the three are the same.

Определено в: std/kv/kv.oxl:260

См. также