pub struct CommitOptions<'a> {
pub author: &'a str,
pub message: &'a str,
pub linearize: bool,
pub time_micros: Option<u64>,
pub change_id: Option<ChangeId>,
}Expand description
Options controlling the commit path.
The default (via Transaction::commit) is lock-free: concurrent
writers both succeed; the next reader merges. Setting
linearize to true enables SPEC §6.5
opportunistic concurrency - if any other writer has advanced
op-heads since this transaction started, the commit fails with
RepoError::Stale instead of appending a concurrent head.
Fields§
Commit author (UTF-8, stored on the new Commit + Operation).
message: &'a strCommit message.
linearize: boolOpt-in SPEC §6.5 linearize mode. Defaults to false.
time_micros: Option<u64>Override the commit + operation timestamp. Measured in
microseconds since Unix epoch. None (the default) calls
SystemTime::now() at commit time, which is what a human
workflow wants.
Set this to Some(...) when byte-identical CIDs across
machines matter: two processes that build the same logical
commit (same author, same message, same graph mutations,
same time, same change_id) will produce the same commit CID
and the same op-id. This is the escape hatch for
audit-replay, distributed-agent consensus, and regression
tests that assert on commit CIDs.
change_id: Option<ChangeId>Override the commit’s change_id. None (the default)
generates a fresh ChangeId::new_v7(), which embeds wall-
clock time and therefore varies per call. Deterministic-
replay workflows MUST supply this explicitly alongside
time_micros; otherwise the v7 randomness alone defeats the
byte-identical-CID contract.
Implementations§
Source§impl<'a> CommitOptions<'a>
impl<'a> CommitOptions<'a>
Sourcepub const fn new(author: &'a str, message: &'a str) -> Self
pub const fn new(author: &'a str, message: &'a str) -> Self
Construct with all deterministic-override fields set to None
(the caller-convenient default: auto-clock + auto-change-id).
Sourcepub const fn with_time_micros(self, t: u64) -> Self
pub const fn with_time_micros(self, t: u64) -> Self
Pin the timestamp for deterministic replay. See
Self::time_micros for the wider contract.
Sourcepub const fn with_change_id(self, id: ChangeId) -> Self
pub const fn with_change_id(self, id: ChangeId) -> Self
Pin the change-id for deterministic replay. See
Self::change_id for the wider contract.
Trait Implementations§
Source§impl<'a> Clone for CommitOptions<'a>
impl<'a> Clone for CommitOptions<'a>
Source§fn clone(&self) -> CommitOptions<'a>
fn clone(&self) -> CommitOptions<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more