pub enum TransactionPrecondition {
CollectionVersion {
collection: String,
version: u64,
},
StateVersion {
version: u64,
},
ApplicationRevision {
revision_id: String,
},
CausalCursor {
cursor: BTreeMap<String, u64>,
},
Record {
collection: String,
id: String,
require_absent: bool,
expected_version: Option<u64>,
expected_version_token: Option<String>,
expected_epoch: Option<u64>,
expected_lease_id: Option<String>,
},
}Variants§
CollectionVersion
StateVersion
ApplicationRevision
CausalCursor
Record
What must be true of one record for the transaction to commit.
Distinct from every variant above, and evaluated in a different place
for a reason: those compare counters that can be read before the commit
lock is taken, while this one compares the fields a caller reads back —
the document’s __version, its authority epoch, its lease — and must
therefore be evaluated inside the same lock as the writes. Checking it
against the pre-commit snapshot would be a client-side check wearing the
authority’s name: between the read and the write, another writer
commits.
It is also what makes putIfAbsent and updateIfVersion mean the same
thing against a managed authority as against the file runtime. Mapping
a caller’s expectedVersion onto if_version would not: that fences
the row’s internal storage sequence, which is a different number that
happens to share a name.
Trait Implementations§
Source§impl Clone for TransactionPrecondition
impl Clone for TransactionPrecondition
Source§fn clone(&self) -> TransactionPrecondition
fn clone(&self) -> TransactionPrecondition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more