pub struct Mainline {
pub primary: Git,
pub layout: Layout,
pub sdd_rel: PathBuf,
pub slug: String,
pub branch: String,
pub push: bool,
}Fields§
§primary: GitThe primary checkout.
layout: Layout§sdd_rel: PathBufThe SDD’s root relative to the repository root.
slug: StringThe SDD’s name in branch, worktree and checkout names.
branch: StringThe mainline branch.
push: boolPublish by git push (origin arbitrates) rather than a local CAS.
Implementations§
Source§impl Mainline
impl Mainline
Sourcepub fn head(&self) -> Result<String, CoreError>
pub fn head(&self) -> Result<String, CoreError>
The mainline head (fetched first when origin arbitrates).
Sourcepub fn sdd_in(&self, checkout: &Path) -> Result<Instance, CoreError>
pub fn sdd_in(&self, checkout: &Path) -> Result<Instance, CoreError>
The pinned SDD as checkout holds it.
Sourcepub fn claim(
&self,
op: Op,
unit: &str,
holder: &str,
lease_minutes: i64,
) -> Result<ClaimOutcome, CoreError>
pub fn claim( &self, op: Op, unit: &str, holder: &str, lease_minutes: i64, ) -> Result<ClaimOutcome, CoreError>
One claim transaction on this run’s SDD — published the way this run publishes, on the SDD this run pinned, wherever the process’s working directory happens to be.
Sourcepub fn lock_checkout(
&self,
waiting: &dyn Fn(),
) -> Result<Option<LaneLock>, CoreError>
pub fn lock_checkout( &self, waiting: &dyn Fn(), ) -> Result<Option<LaneLock>, CoreError>
Take this lane’s integration checkout, waiting while another process
has it; waiting is called once if it must wait. None = the run
was interrupted while waiting.
Sourcepub fn remove_checkouts(&self)
pub fn remove_checkouts(&self)
Remove this lane’s checkouts — integration, base and culprit probe
— giving their room back (run.lane_cap). Taken under the lane’s
lock, so a checkout another run is using is not pulled out from
under it. A checkout that is not there is fine.
Sourcepub fn recreate_checkout(&self, rev: &str) -> Result<PathBuf, CoreError>
pub fn recreate_checkout(&self, rev: &str) -> Result<PathBuf, CoreError>
Remove this lane’s integration checkout and create it again at
rev: whatever an earlier run left there — build outputs, a lock
file a crash left behind, a half-finished merge — is gone. Call it
holding Mainline::lock_checkout, so a checkout another live run
is using is never pulled out from under it.
Sourcepub fn sync_checkout(&self, path: &Path) -> Result<String, CoreError>
pub fn sync_checkout(&self, path: &Path) -> Result<String, CoreError>
Bring the detached worktree at path to the mainline head, pristine
(Mainline::pristine). Returns the head.
Sourcepub fn pristine(&self, path: &Path, rev: &str) -> Result<(), CoreError>
pub fn pristine(&self, path: &Path, rev: &str) -> Result<(), CoreError>
Bring the detached worktree at path to rev with nothing else in
it, creating it on first use: an unfinished merge is abandoned,
tracked files are reset, and every other file — ignored ones too:
environments, build outputs, caches — is removed. Every gate, head
check and preflight starts from here, so no result depends on what
an earlier one left behind.
Sourcepub fn publish(
&self,
new: &str,
base: &str,
) -> Result<Option<Landed>, CoreError>
pub fn publish( &self, new: &str, base: &str, ) -> Result<Option<Landed>, CoreError>
Move mainline from base to new: a push when origin arbitrates,
else the local compare-and-swap. None = lost the race.
Sourcepub fn follow(&self, landed: &Landed) -> Result<(), CoreError>
pub fn follow(&self, landed: &Landed) -> Result<(), CoreError>
The primary checkout follows a commit that landed — when the local branch moved with it. Call it while still holding the mainline turn.
Sourcepub fn publish_tx(
&self,
commit_message: &str,
build: &dyn Fn(&Path) -> Result<bool, CoreError>,
) -> Result<Option<String>, CoreError>
pub fn publish_tx( &self, commit_message: &str, build: &dyn Fn(&Path) -> Result<bool, CoreError>, ) -> Result<Option<String>, CoreError>
Publish one orchestrator-owned mainline commit by the claim
discipline (CAS/push, never forced). build edits a transaction
worktree at the head and reports whether there is anything to commit;
None = nothing was. A lost race rebuilds on the new head — more
patiently than a claim does: these commits have no competitor for
what they change, only for the ref.
Sourcepub fn heal(
&self,
fix_leases: bool,
apply_stale: bool,
) -> Result<Healed, CoreError>
pub fn heal( &self, fix_leases: bool, apply_stale: bool, ) -> Result<Healed, CoreError>
Put right what the audit can put right mechanically, as one mainline
commit: lapsed leases are released (fix_leases), and Built or
Verified units whose recorded trace no longer matches their inputs
are marked Stale with the cause (apply_stale) — which is what makes
a spec change that lands mid-run rebuild what it touched. Everything
else the audit found is returned in other.
Sourcepub fn land_q_entry(
&self,
q: &str,
unit: &str,
holder: &str,
notes: &str,
) -> Result<(), CoreError>
pub fn land_q_entry( &self, q: &str, unit: &str, holder: &str, notes: &str, ) -> Result<(), CoreError>
Land a Q-### Decision-Log entry as a mainline commit (a worker
reports the question; the Decision Log is outside its write-set).
The entry says open, as the schema’s own entries do: a question is
open unless marked resolved, and one a run has just landed is not to
be read as anything else by a tool that looks for the word.