pub struct ForkPlan { /* private fields */ }Expand description
A planned fork of an origin run: the boundary, the prefix to copy, and the write hazard set in the segment the fork will re-walk.
Produced by plan_fork from a read-only view of the origin log. It borrows
nothing from the origin afterward: the prefix envelopes are cloned, so the
caller can build the child (build_child_prefix)
without holding the origin log open.
Implementations§
Source§impl ForkPlan
impl ForkPlan
Sourcepub fn origin_run(&self) -> RunId
pub fn origin_run(&self) -> RunId
The run this fork descends from.
Sourcepub fn graph_hash(&self) -> &str
pub fn graph_hash(&self) -> &str
The origin’s recorded graph hash, which the fork reuses unchanged.
Sourcepub fn through_seq(&self) -> SequenceNumber
pub fn through_seq(&self) -> SequenceNumber
The boundary the prefix was taken through: the highest seq the prefix
carries, one below the restart node’s Event::NodeEntered. Recorded in
ForkOrigin::through_seq. The restart node’s entry is always at least
seq 1 (seq 0 is the head), so this never underflows.
Sourcepub fn prefix_len(&self) -> usize
pub fn prefix_len(&self) -> usize
How many events the child’s prefix holds (the origin events with
seq < boundary).
Sourcepub fn hazards(&self) -> &[WriteHazard]
pub fn hazards(&self) -> &[WriteHazard]
The Effect::Write intents the fork’s re-walked segment would
re-execute, in origin log order. Empty when the fork boundary sat before
any write intent, which is the no-acknowledgement-needed case.
Sourcepub fn hazard_seqs(&self) -> Vec<u64>
pub fn hazard_seqs(&self) -> Vec<u64>
The origin log positions of every hazard write, sorted ascending: the set
an acknowledgement must cover, and the value recorded into
ForkOrigin::acknowledged_writes when the fork proceeds.
Sourcepub fn build_child_prefix(
&self,
child: RunId,
acknowledged_writes: Vec<u64>,
) -> Vec<EventEnvelope>
pub fn build_child_prefix( &self, child: RunId, acknowledged_writes: Vec<u64>, ) -> Vec<EventEnvelope>
Builds the child’s log prefix: the origin’s [0, boundary) events
rewritten under child, with the seq-0 Event::GraphRunStarted
carrying forked_from. Every other field of every envelope — seq,
schema_version, recorded_at, and the payload — is copied verbatim, so
the child’s prefix is byte-identical to the origin’s modulo the run id and
that one seq-0 field. acknowledged_writes is recorded verbatim into the
ForkOrigin.