pub enum PreconditionFailure {
Present {
collection: String,
key: String,
},
Missing {
collection: String,
key: String,
},
Version {
collection: String,
key: String,
expected: u64,
actual: u64,
},
Epoch {
collection: String,
key: String,
expected: u64,
actual: u64,
},
Lease {
collection: String,
key: String,
expected: String,
actual: Option<String>,
},
Fence {
collection: String,
key: String,
expected: String,
actual: String,
},
}Expand description
Which predicate failed, and what the authority actually holds.
Structured rather than a formatted string, because the caller has to tell a lost race from a broken deployment: the first is retried with fresh state, the second is not retried at all.
Variants§
Present
Required absent, but the record exists.
Missing
A predicate was given for a record that does not exist.
Version
Epoch
Lease
Fence
State named by a read basis changed after the basis was read.
The tokens are kept for diagnostics inside the authority but never serialized: a refusal says that the basis changed, not what it digests.
Implementations§
Source§impl PreconditionFailure
impl PreconditionFailure
Sourcepub fn public_json(&self, layout: &ReadLayout) -> Value
pub fn public_json(&self, layout: &ReadLayout) -> Value
The refusal as every transport serializes it: predicate, the
application’s collection (never a storage namespace), the record id,
its key as collection:id, and expected / actual where the
predicate has them. A fence names the first fenced collection and
key: "read-basis", with no id and no tokens.
layout is where the authority addressed the record: the direct route
keys rows collection:id under collection; an application namespace
keys them by id under namespace:collection.
Trait Implementations§
Source§impl Clone for PreconditionFailure
impl Clone for PreconditionFailure
Source§fn clone(&self) -> PreconditionFailure
fn clone(&self) -> PreconditionFailure
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more