pub struct MergeQueue { /* private fields */ }Expand description
Single-shard speculative merge queue over one file.
Implementations§
Source§impl MergeQueue
impl MergeQueue
Sourcepub fn set_max_window(&mut self, n: usize)
pub fn set_max_window(&mut self, n: usize)
Sets the ceiling the speculation window may grow to, and brings the current window under it now rather than at the next resize.
The cost of a round is linear in this number and so is the number of CI jobs in flight at once, which is why it is a deliberate call and not a field a caller can drift upward.
§Panics
If n is zero, which would be a queue that speculates on
nothing and drains forever.
Sourcepub fn max_window(&self) -> usize
pub fn max_window(&self) -> usize
The ceiling MergeQueue::window may grow to.
Sourcepub fn set_journal(&mut self, journal: Box<dyn Journal>)
pub fn set_journal(&mut self, journal: Box<dyn Journal>)
Sends window changes to journal instead of discarding them.
Sourcepub fn set_check_reporter(&mut self, reporter: CheckReporter)
pub fn set_check_reporter(&mut self, reporter: CheckReporter)
Records every verdict CI returns as a choir_view::OpKind::RecordCheck op.
Every verdict, not only the faults. The map from
executor::Verdict to choir_view::CheckStatus is total, so recording
some and dropping the rest would put an arbitrary hole in the
log: a reader finding no check could not tell “it passed” from
“nobody was reporting”. The subject is the speculative tree the
job actually ran against, which means one change tested at two
train positions reports against two subjects – correct, because
they are two different questions, and the second is the one that
landed.
Sourcepub fn with_pipeline(base: &str, pipeline: Pipeline) -> Self
pub fn with_pipeline(base: &str, pipeline: Pipeline) -> Self
Creates a queue with a caller-supplied strategy pipeline — the D4/D19
widening seam (structured or LLM slots appended by the caller). Every
resolution is still safety-checked by
speculate::TextSpeculator, which is what makes the
non-deterministic slots admissible at all.
Sourcepub fn with_speculator(base: &str, speculator: Box<dyn Speculator>) -> Self
pub fn with_speculator(base: &str, speculator: Box<dyn Speculator>) -> Self
Creates a queue over base whose merges, change identities and
job subjects come from speculator (D5).
This is the constructor a caller holding a repository wants:
base is then a commit id rather than a file body, and every
state the queue moves around is one too. The queue’s policy is
unchanged, which is the point — it was never about text.
Sourcepub fn set_job_template(&mut self, template: JobTemplate)
pub fn set_job_template(&mut self, template: JobTemplate)
Installs the job template (D18): what to run for each candidate state. Without one, every job is refused by the executor for having no command.
Sourcepub fn set_landing(&mut self, landing: Box<dyn Landing>)
pub fn set_landing(&mut self, landing: Box<dyn Landing>)
Installs how a landing is recorded (D68).
The default records a workspace head over whatever log the sequencer holds, which is right for a caller mirroring a canonical upstream. A caller whose own log decides – a node – installs one that moves the ref the change was proposed to, and signs it, because the daemon’s policy refuses an unsigned op.
Sourcepub fn set_memory(&mut self, memory: ResolutionMemory)
pub fn set_memory(&mut self, memory: ResolutionMemory)
Installs a resolution memory (item B): a conflict whose triple it remembers is replayed as a candidate instead of re-conflicting. The default is an empty memory, which changes nothing.
Sourcepub fn mark_landed(&mut self, identity: String)
pub fn mark_landed(&mut self, identity: String)
Seeds a landed change identity (item 4), for a queue picking up
where an earlier instance left off. drain records identities of
everything it lands through the same set.
Sourcepub fn window(&self) -> usize
pub fn window(&self) -> usize
The current speculation window.
Exposed because QueueReport::window_trace cannot answer for
it in every case: a drain that stops on a provider fault breaks
out before writing the trace, so a test reading only the report
asserts over an empty vector and passes whatever the window did.
One did, until a mutation that halved the window on a fault was
not caught.
Sourcepub fn drain_in_memory(&mut self, ci: &mut dyn CiExecutor) -> QueueReport
pub fn drain_in_memory(&mut self, ci: &mut dyn CiExecutor) -> QueueReport
Drains through a sequencer over an in-memory log.
For a caller whose repository is not the platform’s: the sequencer is not optional – every landing is recorded through it, which is what keeps the single-writer order true of a train as well as of a push – but a forge bridge mirrors an upstream that is canonical (D21), so the ordering of one round is not a claim anybody reads back. Keeping it in memory says that, instead of writing a log which would look like a second source of truth.
Sourcepub fn drain(
&mut self,
ci: &mut dyn CiExecutor,
sequencer: &Sequencer,
) -> QueueReport
pub fn drain( &mut self, ci: &mut dyn CiExecutor, sequencer: &Sequencer, ) -> QueueReport
Drains the queue: speculatively merges up to window changes, runs CI
on each against its speculative state, merges the passing prefix, and
halves the window + retests behind on any failure.
Every merged change is recorded through the single-writer sequencer
(payload = the merged state), preserving the platform’s total order.