pub fn seed_resume(armed: bool, status: Option<&SeedStatus>) -> boolExpand description
Whether an armed seed must RESUME an attempt a previous bootstrap started but did not finish, rather than run as a first seed.
armed is seed_armed; status is the repository’s status.seed. The
answer is true exactly when the seed is armed, the durable seed-attempt
marker (SeedStatus::started_at) is present, and
SeedStatus::seeded_at is not — i.e. this operator recorded that it began
seeding THIS repository and never recorded finishing.
The marker is the sole guard, deliberately. A resuming migrate re-runs
kopia snapshot migrate into whatever repository is at the backend and then
re-stamps its maintenance owner, with no kopia-side backstop (blob mode gets
one for free — sync-to refuses a destination whose format blob differs
from the source’s). So a repository this operator never began seeding — an
ordinary ADOPTION of a backend somebody else initialized, spec.seed left
standing in a GitOps manifest — must never resume: it has no marker, and it
keeps the no-clobber AlreadyInitialized no-op. Never derive resume from
anything weaker (a Job’s existence, an unset status.uniqueId, a
condition).
use kopiur_api::seed::{SeedStatus, seed_resume};
let none = SeedStatus::default();
// Fresh seed: armed, but no attempt was ever recorded.
assert!(!seed_resume(true, Some(&none)));
assert!(!seed_resume(true, None));
// A previous attempt started and never finished ⇒ resume.
let attempted = SeedStatus { started_at: Some("2026-01-01T00:00:00Z".into()), ..none.clone() };
assert!(seed_resume(true, Some(&attempted)));
// Finished ⇒ nothing to resume (and the seed is no longer armed anyway).
let done = SeedStatus { seeded_at: Some("2026-01-01T01:00:00Z".into()), ..attempted.clone() };
assert!(!seed_resume(true, Some(&done)));
assert!(!seed_resume(false, Some(&attempted)));