pub struct NewGeneration {
pub stop_after: StopAfter,
}Expand description
GC into a new generation, keeping the old one until the new one is proven.
repo.znippy becomes repo.g1.znippy, then repo.g2.znippy, and so on. The
old file is unlinked only after the new one has been read back in full.
The sequence, and why each step is where it is:
link(archive, work)— a hard link, so the work name and the archive name are the same inode and not one byte is copied. This is what lets step 2 becompact_archiveverbatim (LAW 5) while the archive’s own name stays untouched:compact_archiverenames over the name it was given, and the name it is given here is the work link, not the archive.compact_archive(work)— stages besideworkand renames over it. The archive’s inode is still fully referenced by the archive’s own name throughout, so every reader ofrepo.znippyis unaffected.- verify — [
verify_archive_integrity] over the new file, plus a manifest set comparison against the original. Both are read back off disk. rename(work, repo.gN.znippy)— atomic; the new generation now has its permanent name.unlink(repo.znippy)— the old index and old data go, and only now.
A death at any point leaves at least one complete, readable archive:
before 4 the original under its own name (plus debris), after 4 and before 5
both of them, after 5 the new generation. Asserted, per step, in
[tests::an_interruption_at_every_step_leaves_a_readable_archive].
Fields§
§stop_after: StopAfterTest-only interruption point. StopAfter::Never in every real run.
Implementations§
Source§impl NewGeneration
impl NewGeneration
pub fn new() -> Self
Sourcepub fn stopping_after(stop: StopAfter) -> Self
pub fn stopping_after(stop: StopAfter) -> Self
Stop the run at stop, leaving the filesystem as a crash there would.
Trait Implementations§
Source§impl Clone for NewGeneration
impl Clone for NewGeneration
Source§fn clone(&self) -> NewGeneration
fn clone(&self) -> NewGeneration
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for NewGeneration
Source§impl Debug for NewGeneration
impl Debug for NewGeneration
Source§impl Default for NewGeneration
impl Default for NewGeneration
Source§fn default() -> NewGeneration
fn default() -> NewGeneration
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for NewGeneration
impl RefUnwindSafe for NewGeneration
impl Send for NewGeneration
impl Sync for NewGeneration
impl Unpin for NewGeneration
impl UnsafeUnpin for NewGeneration
impl UnwindSafe for NewGeneration
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more