pub trait GenerationBackend {
Show 34 methods
// Required methods
fn current(&self) -> Result<GenerationId, Outcome>;
fn boot_entries(&self) -> Result<Vec<GenerationId>, Outcome>;
fn boot_default(&self) -> Result<GenerationId, Outcome>;
fn last_booted(&self) -> Result<GenerationId, Outcome>;
fn stage(
&self,
owner: &PinnedSource,
overrides: &OverrideSet,
) -> Result<StagedSource, Outcome>;
fn source_hash(&self, owner: &PinnedSource) -> Result<Hash, Outcome>;
fn evaluate(
&self,
src: &StagedSource,
) -> Result<EvaluatedGeneration, Outcome>;
fn build(&self, eval: &EvaluatedGeneration) -> Result<Built, Outcome>;
fn verify_candidate(
&self,
path: &StorePath,
nar: Option<&Hash>,
) -> Result<bool, Outcome>;
fn pending_jobs(&self) -> Result<Vec<JobId>, Outcome>;
fn jobs_tagged(&self, op: &OpId) -> Result<Option<Vec<JobId>>, Outcome>;
fn override_hash(&self) -> Result<Hash, Outcome>;
fn activate_live(&self, g: GenerationId, op: &OpId) -> Outcome;
fn publish_boot(&self, g: GenerationId, op: &OpId) -> Outcome;
fn protect(&self, g: GenerationId, op: &OpId) -> Outcome;
fn cancel(&self, job: &JobId, op: &OpId) -> Outcome;
fn swap_override(&self, from: &Hash, to: &Hash, op: &OpId) -> Outcome;
fn path_of(&self, g: GenerationId) -> Result<StorePath, Outcome>;
fn evaluate_built(
&self,
path: &StorePath,
) -> Result<EvaluatedGeneration, Outcome>;
fn read_overrides(&self) -> Result<(OverrideSet, Hash), Outcome>;
fn remember_override(&self, set: &OverrideSet) -> Result<Hash, Outcome>;
fn override_for(&self, g: GenerationId) -> Result<Option<Hash>, Outcome>;
fn record_override(
&self,
g: GenerationId,
hash: &Hash,
) -> Result<(), Outcome>;
fn release_root(&self, root: &str) -> bool;
fn collect_garbage(
&self,
protect: &[GenerationId],
emergency: bool,
op: &OpId,
) -> Outcome;
fn gc_plan(
&self,
protect: &[GenerationId],
emergency: bool,
) -> Result<GcPlan, Outcome>;
fn space_report(&self) -> Option<SpaceReport>;
// Provided methods
fn untracked(&self, _owner: &PinnedSource) -> Vec<String> { ... }
fn dry_activation(
&self,
_path: &StorePath,
) -> Result<ActivationPlan, Outcome> { ... }
fn publish_boot_once(
&self,
_g: GenerationId,
_keep: GenerationId,
_op: &OpId,
) -> Outcome { ... }
fn created_by(&self, _g: GenerationId) -> Option<(u32, Timestamp)> { ... }
fn one_shot_pending(&self) -> Result<Option<GenerationId>, Outcome> { ... }
fn override_content(&self, _h: &Hash) -> Result<OverrideSet, Outcome> { ... }
fn age_out_build_roots(&self) -> Vec<String> { ... }
}Required Methods§
fn current(&self) -> Result<GenerationId, Outcome>
fn boot_entries(&self) -> Result<Vec<GenerationId>, Outcome>
fn boot_default(&self) -> Result<GenerationId, Outcome>
fn last_booted(&self) -> Result<GenerationId, Outcome>
fn stage( &self, owner: &PinnedSource, overrides: &OverrideSet, ) -> Result<StagedSource, Outcome>
Sourcefn source_hash(&self, owner: &PinnedSource) -> Result<Hash, Outcome>
fn source_hash(&self, owner: &PinnedSource) -> Result<Hash, Outcome>
Recompute the NAR hash of the owner’s Nix-visible source now (stale check, §9 step 6).
fn evaluate(&self, src: &StagedSource) -> Result<EvaluatedGeneration, Outcome>
Sourcefn build(&self, eval: &EvaluatedGeneration) -> Result<Built, Outcome>
fn build(&self, eval: &EvaluatedGeneration) -> Result<Built, Outcome>
Store-only; roots its own output.
Sourcefn verify_candidate(
&self,
path: &StorePath,
nar: Option<&Hash>,
) -> Result<bool, Outcome>
fn verify_candidate( &self, path: &StorePath, nar: Option<&Hash>, ) -> Result<bool, Outcome>
The path is a whole system, its contents still hash to what the store
recorded, and, when nar is given (the transaction built it), that is
the NAR hash recorded at build (§9 step 3, C6).
fn pending_jobs(&self) -> Result<Vec<JobId>, Outcome>
Sourcefn jobs_tagged(&self, op: &OpId) -> Result<Option<Vec<JobId>>, Outcome>
fn jobs_tagged(&self, op: &OpId) -> Result<Option<Vec<JobId>>, Outcome>
None: the backend cannot say whether work tagged with op exists.
Sourcefn override_hash(&self) -> Result<Hash, Outcome>
fn override_hash(&self) -> Result<Hash, Outcome>
The override file’s current content hash (promotion compares against it, §9 step 4).
Sourcefn activate_live(&self, g: GenerationId, op: &OpId) -> Outcome
fn activate_live(&self, g: GenerationId, op: &OpId) -> Outcome
switch-to-configuration test.
Sourcefn publish_boot(&self, g: GenerationId, op: &OpId) -> Outcome
fn publish_boot(&self, g: GenerationId, op: &OpId) -> Outcome
Boot entry only; no re-activation.
fn protect(&self, g: GenerationId, op: &OpId) -> Outcome
fn cancel(&self, job: &JobId, op: &OpId) -> Outcome
Sourcefn swap_override(&self, from: &Hash, to: &Hash, op: &OpId) -> Outcome
fn swap_override(&self, from: &Hash, to: &Hash, op: &OpId) -> Outcome
Atomically replace the live override file with the content whose hash is
to, but only if its current hash is from. Idempotent: if it already
hashes to to, succeed without writing.
Sourcefn path_of(&self, g: GenerationId) -> Result<StorePath, Outcome>
fn path_of(&self, g: GenerationId) -> Result<StorePath, Outcome>
The system store path of a known generation.
Sourcefn evaluate_built(
&self,
path: &StorePath,
) -> Result<EvaluatedGeneration, Outcome>
fn evaluate_built( &self, path: &StorePath, ) -> Result<EvaluatedGeneration, Outcome>
Evaluate an already-built generation from its store path (its exported manifest), for SwitchGeneration / Revert / Rollback.
Sourcefn read_overrides(&self) -> Result<(OverrideSet, Hash), Outcome>
fn read_overrides(&self) -> Result<(OverrideSet, Hash), Outcome>
The live override set and its content hash.
Sourcefn remember_override(&self, set: &OverrideSet) -> Result<Hash, Outcome>
fn remember_override(&self, set: &OverrideSet) -> Result<Hash, Outcome>
Keep override content addressable by hash, so swap_override can write it.
Sourcefn override_for(&self, g: GenerationId) -> Result<Option<Hash>, Outcome>
fn override_for(&self, g: GenerationId) -> Result<Option<Hash>, Outcome>
The override content recorded for a generation when it was committed.
fn record_override(&self, g: GenerationId, hash: &Hash) -> Result<(), Outcome>
Sourcefn release_root(&self, root: &str) -> bool
fn release_root(&self, root: &str) -> bool
Remove a GC root symlink this backend created.
Sourcefn collect_garbage(
&self,
protect: &[GenerationId],
emergency: bool,
op: &OpId,
) -> Outcome
fn collect_garbage( &self, protect: &[GenerationId], emergency: bool, op: &OpId, ) -> Outcome
Collect generations under the §12b bounds (gc::plan), never touching
protect (I3), then collect store garbage. Mutating.
Sourcefn gc_plan(
&self,
protect: &[GenerationId],
emergency: bool,
) -> Result<GcPlan, Outcome>
fn gc_plan( &self, protect: &[GenerationId], emergency: bool, ) -> Result<GcPlan, Outcome>
What collect_garbage would delete now. Read-only.
Sourcefn space_report(&self) -> Option<SpaceReport>
fn space_report(&self) -> Option<SpaceReport>
The last collection’s result.
Provided Methods§
Sourcefn untracked(&self, _owner: &PinnedSource) -> Vec<String>
fn untracked(&self, _owner: &PinnedSource) -> Vec<String>
The owner’s files Nix cannot see now (untracked in a git flake), to report with the stale check: one added during the build was not there at staging (§9 step 1).
Sourcefn dry_activation(&self, _path: &StorePath) -> Result<ActivationPlan, Outcome>
fn dry_activation(&self, _path: &StorePath) -> Result<ActivationPlan, Outcome>
What switching from the running generation to an existing one would start, stop, restart and reload (its dry activation), for SwitchGeneration / Revert / Rollback (§11, R04). An activation that failed, timed out or was cut short is an error, never a smaller plan.
Sourcefn publish_boot_once(
&self,
_g: GenerationId,
_keep: GenerationId,
_op: &OpId,
) -> Outcome
fn publish_boot_once( &self, _g: GenerationId, _keep: GenerationId, _op: &OpId, ) -> Outcome
The boot-only path (§12 step 7, §12f): g boots once, at the next
boot; keep stays the default. All or nothing.
Sourcefn created_by(&self, _g: GenerationId) -> Option<(u32, Timestamp)>
fn created_by(&self, _g: GenerationId) -> Option<(u32, Timestamp)>
Who created generation g and when (its profile link’s owner and
time): the provenance of a rebuild made outside Planarian (§15).
Sourcefn one_shot_pending(&self) -> Result<Option<GenerationId>, Outcome>
fn one_shot_pending(&self) -> Result<Option<GenerationId>, Outcome>
The generation a one-shot entry will boot next, if one is pending.
Sourcefn override_content(&self, _h: &Hash) -> Result<OverrideSet, Outcome>
fn override_content(&self, _h: &Hash) -> Result<OverrideSet, Outcome>
The override content remember_override kept under this hash.
Sourcefn age_out_build_roots(&self) -> Vec<String>
fn age_out_build_roots(&self) -> Vec<String>
Remove build roots no transaction can still use: older than the longest a candidate may wait (§12f), a crashed build’s included. At startup and before every collection (§9 step 5, C4). Returns them.