pub struct CommitStamp(pub u64); Fields
0 | u64 |
|---|
Implements
Clone, Copy, StructuralPartialEq, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Default, From<CommitStamp>CommitStampThe position of a commit in commit order, visible to every snapshot whose read stamp is at or above it.pub struct CommitStamp(pub u64); 0 | u64 |
|---|
Clone, Copy, StructuralPartialEq, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Default, From<CommitStamp>IsolationThe isolation the in-memory engine delivers to the transactions of a database.pub enum Isolation StrictSerializable | 0 | Reads and writes both take part in one serial order. |
|---|---|---|
Snapshot | 1 | A transaction reads the snapshot it began at and conflicts only on what it wrote. |
Clone, Copy, StructuralPartialEq, PartialEq, Eq, Debug, Default, Hash, Display, FromStrReadStampThe stamp a transaction or a snapshot reads at, which a stage reports and the commit after it validates against.pub struct ReadStamp(pub u64); 0 | u64 |
|---|
Clone, Copy, StructuralPartialEq, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, DefaultTransactionAn optimistic transaction grouping reads and writes across collections and modalities.8pub struct Transaction<'db> It serves one call at a time, so a call on a transaction that serves an unfinished deferred one finishes with
Status::Contended. It is freed before its database closes, which the borrow of the database carries, and
dropping it waits for every deferred call naming it to finish.
Debug, Drop, SendcollectionThe collection name addresses inside this transaction, which watches what it touches.pub fn collection(&self, name: &str) -> Result<Collection<'_, Transaction<'db>>> The name resolves at the head, where a first write creates a missing collection at once, since collections are
created nowhere else. The collection borrows the transaction, so no call goes through it after
Transaction::commit.
viewThe view every call inside this transaction addresses, watching the keys it touches or not.pub fn view(&self, watch: Watch) -> On<'_, Transaction<'db>> onThe view of this transaction watching the keys it touches, with every call through it running on executor.pub fn on<'with>(&'with self, executor: &'with Executor) -> On<'with, Transaction<'db>> deferredThe view of this transaction watching the keys it touches, with every verb deferred on executor.pub fn deferred<'with>(
&'with self,
executor: &'with Executor,
) -> DeferredOn<'with, Transaction<'db>> stageStages the writes as the first phase of a two-phase commit, reporting the stamp the transaction reads at.pub fn stage(&mut self) -> Result<ReadStamp> commitCommits the writes, reporting the commit's position in commit order.pub fn commit(&mut self, durability: Durability) -> Result<CommitStamp> A conflict is reported rather than retried, and the transaction keeps its contents either way, so a caller
may stage them again after Transaction::rollback or start over after Transaction::reset.
rollbackWithdraws a stage, releasing whatever it claimed, while keeping the reads and writes to stage again.pub fn rollback(&mut self) -> Result<()> resetDiscards the reads and writes and reopens the transaction on the newest state, ready for another try.pub fn reset(&mut self) -> Result<()> WatchWhether the calls of a transaction watch the keys they touch for conflicts, as ustore_watch_t spells it.pub enum Watch Only a transaction watches anything, so the head of a database and a snapshot never carry this, and
it changes what a call does only at [Isolation::Snapshot]: a strictly serializable transaction puts
every read it makes into the one serial order whatever this says.
Keys | 0 | Every key the view reads or writes is recorded, so a concurrent writer conflicts at the commit. |
|---|---|---|
None | 1 | Nothing the view touches is watched, so a snapshot-isolated transaction commits over a concurrent writer instead of conflicting with it. |
Clone, Copy, StructuralPartialEq, PartialEq, Eq, Debug, Default, Hash, Display, FromStrStageThe first phase of a two-phase commit; see On::stage.CommitA commit of a transaction; see On::commit.RollbackA withdrawal of a stage; see On::rollback.ResetA reset of a transaction for another try; see On::reset.