chore: clippy, developer docs without git, the free-text clause count
The count of free-text source clauses falls from 56 to 54: the git form's spec blocks are gone. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
83a32aec14
commit
fd78612dd4
9 files changed
+62
-44
No files matched your search
@@ -887,7 +887,7 @@ impl Books {
|
|||||||
/// Every file under `dir`, by path relative to it, with the SHA-256 of its
|
/// Every file under `dir`, by path relative to it, with the SHA-256 of its
|
||||||
/// contents, leaving out what a call writes by design whatever the call:
|
/// contents, leaving out what a call writes by design whatever the call:
|
||||||
/// the access log (every call is recorded), the viewer's side channel
|
/// the access log (every call is recorded), the viewer's side channel
|
||||||
/// (`ops/`), the books' own backup (`archive.git/`), the files handed over
|
/// (`ops/`), the books' own local backup (`local-backup/`), the files handed over
|
||||||
/// and on their way in (`exports/`, `uploads/`), and SQLite's -wal and
|
/// and on their way in (`exports/`, `uploads/`), and SQLite's -wal and
|
||||||
/// -shm files (it moves pages between them on its own).
|
/// -shm files (it moves pages between them on its own).
|
||||||
pub fn book_files(dir: &Path) -> std::collections::BTreeMap<PathBuf, String> {
|
pub fn book_files(dir: &Path) -> std::collections::BTreeMap<PathBuf, String> {
|
||||||
@@ -904,7 +904,7 @@ pub fn book_files(dir: &Path) -> std::collections::BTreeMap<PathBuf, String> {
|
|||||||
.next()
|
.next()
|
||||||
.map(|c| c.as_os_str().to_string_lossy().into_owned())
|
.map(|c| c.as_os_str().to_string_lossy().into_owned())
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
if ["ops", "archive.git", "exports", "uploads"].contains(&first.as_str())
|
if ["ops", "local-backup", "local", "exports", "uploads"].contains(&first.as_str())
|
||||||
|| name == "access.jsonl"
|
|| name == "access.jsonl"
|
||||||
|| name.ends_with("-wal")
|
|| name.ends_with("-wal")
|
||||||
|| name.ends_with("-shm")
|
|| name.ends_with("-shm")
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ const CHECKED_FLOOR: usize = 300;
|
|||||||
/// Clauses passing only through the declared or external free-text
|
/// Clauses passing only through the declared or external free-text
|
||||||
/// branch. Edit this constant, on purpose, in the same commit that
|
/// branch. Edit this constant, on purpose, in the same commit that
|
||||||
/// changes the count.
|
/// changes the count.
|
||||||
const FREE_TEXT_COUNT: usize = 56;
|
const FREE_TEXT_COUNT: usize = 54;
|
||||||
|
|
||||||
fn strip_comment(line: &str) -> Option<String> {
|
fn strip_comment(line: &str) -> Option<String> {
|
||||||
let t = line.trim_start();
|
let t = line.trim_start();
|
||||||
|
|||||||
@@ -542,7 +542,7 @@ pub enum CloseOutcome {
|
|||||||
/// sessions ended, and another process could open it.
|
/// sessions ended, and another process could open it.
|
||||||
Closed,
|
Closed,
|
||||||
/// It was open and is closed as `Closed` says, but its last backup
|
/// It was open and is closed as `Closed` says, but its last backup
|
||||||
/// wasn't whole (a target that couldn't be reached, git that failed, or
|
/// wasn't whole (a folder that couldn't be reached, a copy that failed, or
|
||||||
/// a backup stopped after its time): why, in words. The books on disk
|
/// a backup stopped after its time): why, in words. The books on disk
|
||||||
/// are whole; what they hold since the last good backup is not backed
|
/// are whole; what they hold since the last good backup is not backed
|
||||||
/// up.
|
/// up.
|
||||||
|
|||||||
@@ -1075,8 +1075,7 @@ impl Backups {
|
|||||||
let _step = step;
|
let _step = step;
|
||||||
let key = BackupKey::load(&dir).map_err(|e| e.to_string())?;
|
let key = BackupKey::load(&dir).map_err(|e| e.to_string())?;
|
||||||
let cut = store
|
let cut = store
|
||||||
.with_store(|s| Cut::take(&book, &dir, s.head()))
|
.with_store(|s| Cut::take(&book, &dir, s.head()))?
|
||||||
.map_err(|e| e)?
|
|
||||||
.map_err(|e| e.to_string())?;
|
.map_err(|e| e.to_string())?;
|
||||||
backup::save_file(&sealed_to, &cut, key.as_ref(), &ctx)
|
backup::save_file(&sealed_to, &cut, key.as_ref(), &ctx)
|
||||||
.map(|w| (w, key.is_some()))
|
.map(|w| (w, key.is_some()))
|
||||||
|
|||||||
@@ -99,7 +99,7 @@
|
|||||||
//! and the book is let go (INVARIANT 13), its writer lock released, so
|
//! and the book is let go (INVARIANT 13), its writer lock released, so
|
||||||
//! another process could open it; and only then is a close answered.
|
//! another process could open it; and only then is a close answered.
|
||||||
//! It is answered `closed`, or `closed_backup_incomplete` with why when
|
//! It is answered `closed`, or `closed_backup_incomplete` with why when
|
||||||
//! its last backup wasn't whole (a target that failed, git that
|
//! its last backup wasn't whole (a folder that failed, a copy that
|
||||||
//! failed, a backup stopped after its time): never a plain `closed`
|
//! failed, a backup stopped after its time): never a plain `closed`
|
||||||
//! for a backup that wasn't made. After that answer no call on that
|
//! for a backup that wasn't made. After that answer no call on that
|
||||||
//! book runs until it is opened again. Every other book keeps serving,
|
//! book runs until it is opened again. Every other book keeps serving,
|
||||||
@@ -114,9 +114,8 @@
|
|||||||
//! long I/O or loop over a book's whole journal or files are exactly
|
//! long I/O or loop over a book's whole journal or files are exactly
|
||||||
//! these, and each is stoppable:
|
//! these, and each is stoppable:
|
||||||
//! - on the book: `books.back_up_now`, and a backup a timer asked for
|
//! - on the book: `books.back_up_now`, and a backup a timer asked for
|
||||||
//! (git is sent SIGTERM and killed only after TERM_GRACE: ledger_
|
//! (its copy stops at the next piece, ledger_store backup
|
||||||
//! store backup INVARIANT 5; between targets the flag is looked at
|
//! INVARIANT 8; between destinations the flag is looked at too); `books.verify` (once per journal line replayed and per
|
||||||
//! too); `books.verify` (once per journal line replayed and per
|
|
||||||
//! stored file hashed); `books.export_cpa_package` (before it
|
//! stored file hashed); `books.export_cpa_package` (before it
|
||||||
//! builds, and once per stored file it reads, unless it has
|
//! builds, and once per stored file it reads, unless it has
|
||||||
//! journaled a decision: below); a drill; and a
|
//! journaled a decision: below); a drill; and a
|
||||||
@@ -160,7 +159,7 @@
|
|||||||
//! their point of no return, and never waits behind one. A
|
//! their point of no return, and never waits behind one. A
|
||||||
//! PREVIEW (of a restore, of an adoption) changes nothing, and
|
//! PREVIEW (of a restore, of an adoption) changes nothing, and
|
||||||
//! holds no book's turn at all: a close never waits for one,
|
//! holds no book's turn at all: a close never waits for one,
|
||||||
//! however long its clone or its queue for `books.lock`; only the
|
//! however long its scratch build or its queue for `books.lock`; only the
|
||||||
//! server's close stops it. No close of any other book stops, fails,
|
//! server's close stops it. No close of any other book stops, fails,
|
||||||
//! refuses or delays an open, a close or a job of X, nor a job
|
//! refuses or delays an open, a close or a job of X, nor a job
|
||||||
//! queued for its turn at making books (`books.lock` in the root,
|
//! queued for its turn at making books (`books.lock` in the root,
|
||||||
@@ -171,7 +170,7 @@
|
|||||||
//! way waits for that book's turn, so for the close to end, and is
|
//! way waits for that book's turn, so for the close to end, and is
|
||||||
//! then asked as any other. Each is stopped, before its
|
//! then asked as any other. Each is stopped, before its
|
||||||
//! point of no return, at its next look (a phase, a stored file, a
|
//! point of no return, at its next look (a phase, a stored file, a
|
||||||
//! journal line, a git command): what it wrote is removed (a clone,
|
//! journal line, a piece of a copy): what it wrote is removed (a scratch,
|
||||||
//! a staging folder, and the lock file an adoption made in the
|
//! a staging folder, and the lock file an adoption made in the
|
||||||
//! source folder), and the root is byte for byte as it was. The
|
//! source folder), and the root is byte for byte as it was. The
|
||||||
//! point of no return of restore and adopt is the rename that puts
|
//! point of no return of restore and adopt is the rename that puts
|
||||||
@@ -227,16 +226,14 @@
|
|||||||
//! ANSWER_GRACE from the START of the close, inside (a): a
|
//! ANSWER_GRACE from the START of the close, inside (a): a
|
||||||
//! stalled client adds nothing);
|
//! stalled client adds nothing);
|
||||||
//! c. T_stop: the longest between two looks of what is stopped, one
|
//! c. T_stop: the longest between two looks of what is stopped, one
|
||||||
//! of: a git command's stop (SIGTERM and up to TERM_GRACE, 5 s;
|
//! of: one journal line, one stored file, one 64 KiB chunk, one
|
||||||
//! then a kill and GROUP_GONE_WAIT, 2 s, and its pipes, 10 s at
|
|
||||||
//! most), one journal line, one stored file, one 64 KiB chunk, one
|
|
||||||
//! phase of a job; and the removal of what a stopped job or drill
|
//! phase of a job; and the removal of what a stopped job or drill
|
||||||
//! wrote (its scratch clone or staging folder: a local deletion of
|
//! wrote (its scratch folder or staging folder: a local deletion of
|
||||||
//! the job's own output, as long as that is large, waiting on no
|
//! the job's own output, as long as that is large, waiting on no
|
||||||
//! one);
|
//! one);
|
||||||
//! d. BACKUP_AT_CLOSE for the last backup;
|
//! d. BACKUP_AT_CLOSE for the last backup;
|
||||||
//! e. T_stop again for what is left of that backup at its bound
|
//! e. T_stop again for what is left of that backup at its bound
|
||||||
//! (`Backups::shut`: git stopped, every step awaited);
|
//! (`Backups::shut`: copying stopped, every step awaited);
|
||||||
//! f. closing the logs and letting go of the store (instant).
|
//! f. closing the logs and letting go of the store (instant).
|
||||||
//! A drill (or a format upgrade) that took the backups' turn never
|
//! A drill (or a format upgrade) that took the backups' turn never
|
||||||
//! costs the last backup its time.
|
//! costs the last backup its time.
|
||||||
@@ -252,7 +249,7 @@
|
|||||||
//! book's sessions end with the book.
|
//! book's sessions end with the book.
|
||||||
//! 13. After a close of a book is answered, this process holds nothing
|
//! 13. After a close of a book is answered, this process holds nothing
|
||||||
//! that can write to that book's folder (journal, access log, ops
|
//! that can write to that book's folder (journal, access log, ops
|
||||||
//! logs, stored files, upload parts, the backup's git repository) or
|
//! logs, stored files, upload parts, the backup folder) or
|
||||||
//! read it on a caller's behalf, until the book is opened again; and
|
//! read it on a caller's behalf, until the book is opened again; and
|
||||||
//! a handle from before a close can never write after a reopen. Every
|
//! a handle from before a close can never write after a reopen. Every
|
||||||
//! path that touches a book is either counted by its gate (a request
|
//! path that touches a book is either counted by its gate (a request
|
||||||
@@ -261,11 +258,11 @@
|
|||||||
//! sweep takes the place too), or checks, under the same lock as its
|
//! sweep takes the place too), or checks, under the same lock as its
|
||||||
//! write, that the book is still open, and refuses if not: the
|
//! write, that the book is still open, and refuses if not: the
|
||||||
//! access log, the uploads, the exports and the backups (record,
|
//! access log, the uploads, the exports and the backups (record,
|
||||||
//! git, drill, upgrade) are each closed under the lock their own
|
//! copy, drill, upgrade) are each closed under the lock their own
|
||||||
//! writes go in under, by the close, once the gate is empty; the
|
//! writes go in under, by the close, once the gate is empty; the
|
||||||
//! store is let go under its lock. A close waits for the backup's
|
//! store is let go under its lock. A close waits for the backup's
|
||||||
//! work to END, not only for its future: a run past its bound is
|
//! work to END, not only for its future: a run past its bound is
|
||||||
//! stopped (git killed with all it started) and waited for, so the
|
//! stopped (its copy ended at the next piece) and waited for, so the
|
||||||
//! close is never answered while a backup runs. The timers (the
|
//! close is never answered while a backup runs. The timers (the
|
||||||
//! sweep, the look for a backup due, the look for a drill due) work
|
//! sweep, the look for a backup due, the look for a drill due) work
|
||||||
//! on handles that are closed with the book, and so can't act on a
|
//! on handles that are closed with the book, and so can't act on a
|
||||||
@@ -339,7 +336,7 @@
|
|||||||
//! answers closed; nothing is written to the book afterwards, and when
|
//! answers closed; nothing is written to the book afterwards, and when
|
||||||
//! it is opened again its access log continues one whole chain.
|
//! it is opened again its access log continues one whole chain.
|
||||||
//! 6. A book with a slow backup is closed: not answered while the backup
|
//! 6. A book with a slow backup is closed: not answered while the backup
|
||||||
//! runs; at its bound git is stopped and waited for, and the answer
|
//! runs; at its bound the copy is stopped and waited for, and the answer
|
||||||
//! says the last backup wasn't whole; nothing runs after.
|
//! says the last backup wasn't whole; nothing runs after.
|
||||||
//! 7. A restore replaces an open book while an upload is half received:
|
//! 7. A restore replaces an open book while an upload is half received:
|
||||||
//! the restore is not answered until the upload is, and no part file
|
//! the restore is not answered until the upload is, and no part file
|
||||||
@@ -353,23 +350,20 @@
|
|||||||
//! call running past it, are not cut; an upload that keeps coming,
|
//! call running past it, are not cut; an upload that keeps coming,
|
||||||
//! steadily, past the grace is cut.
|
//! steadily, past the grace is cut.
|
||||||
//! 10. A drill is slow (a large book): the book is closed, the drill is
|
//! 10. A drill is slow (a large book): the book is closed, the drill is
|
||||||
//! stopped at its next look and its clone removed, the last backup is
|
//! stopped at its next look and its scratch folder removed, the last backup is
|
||||||
//! made, and the close is answered within INVARIANT 10's bound. A
|
//! made, and the close is answered within INVARIANT 10's bound. A
|
||||||
//! format upgrade not yet journaled is stopped the same way, the books
|
//! format upgrade not yet journaled is stopped the same way, the books
|
||||||
//! unchanged.
|
//! unchanged.
|
||||||
//! 11. A backup's git is stopped inside a commit or a push: it is sent
|
//! 11. A backup's copy is stopped between pieces by a close: it writes no
|
||||||
//! SIGTERM and removes its own locks (nothing is left, nothing is
|
//! manifest, the folder proves whole at its previous one, nothing is
|
||||||
//! recorded), the book opened again backs up at once. A git that can't
|
//! left to clean up and nothing is recorded as done, and the book
|
||||||
//! end on SIGTERM and has to be killed after TERM_GRACE leaves locks
|
//! opened again backs up at once.
|
||||||
//! that this process removes from the book's own archive only, and
|
|
||||||
//! leaves in the owner's backup folder, recorded with their whole path
|
|
||||||
//! and said in the close's answer and in the backup's status, until the
|
|
||||||
//! owner removes them.
|
|
||||||
//! 12. The server is closed (standard input ends) with an upload stalled
|
//! 12. The server is closed (standard input ends) with an upload stalled
|
||||||
//! on one book and a call's body stalled on another: both are cut one
|
//! on one book and a call's body stalled on another: both are cut one
|
||||||
//! grace after the close began, the server exits 0 within its bound.
|
//! grace after the close began, the server exits 0 within its bound.
|
||||||
//! 13. A backup asked for (`books.back_up_now`) is running, git stalled,
|
//! 13. A backup asked for (`books.back_up_now`) is running, its copy
|
||||||
//! and the book is closed: the call is answered, git still stalled,
|
//! stalled, and the book is closed: the call is answered, the copy still
|
||||||
|
//! stalled,
|
||||||
//! that it was stopped because the books are closing; its record says
|
//! that it was stopped because the books are closing; its record says
|
||||||
//! `refused: stopped_by_close`; the close is answered `closed`.
|
//! `refused: stopped_by_close`; the close is answered `closed`.
|
||||||
//! 14. A restore of a large backup over `beta` is running (an admin job)
|
//! 14. A restore of a large backup over `beta` is running (an admin job)
|
||||||
@@ -1670,7 +1664,7 @@ impl Books {
|
|||||||
Err(why) => Response::Refused(self.hide(why)),
|
Err(why) => Response::Refused(self.hide(why)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(r) => r,
|
Err(r) => *r,
|
||||||
},
|
},
|
||||||
Request::BackupStatus { id } => match self.backups_of(&id) {
|
Request::BackupStatus { id } => match self.backups_of(&id) {
|
||||||
Ok(backups) => {
|
Ok(backups) => {
|
||||||
@@ -1691,7 +1685,7 @@ impl Books {
|
|||||||
note: s.status.note,
|
note: s.status.note,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Err(r) => r,
|
Err(r) => *r,
|
||||||
},
|
},
|
||||||
Request::BackupSave { id, path } => match self.backups_of(&id) {
|
Request::BackupSave { id, path } => match self.backups_of(&id) {
|
||||||
Ok(backups) => {
|
Ok(backups) => {
|
||||||
@@ -1701,7 +1695,7 @@ impl Books {
|
|||||||
Err(why) => Response::Refused(self.hide(why)),
|
Err(why) => Response::Refused(self.hide(why)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(r) => r,
|
Err(r) => *r,
|
||||||
},
|
},
|
||||||
Request::Adopt {
|
Request::Adopt {
|
||||||
id,
|
id,
|
||||||
@@ -2071,7 +2065,7 @@ impl Books {
|
|||||||
/// the access log; the client may retry it: INVARIANT 10);
|
/// the access log; the client may retry it: INVARIANT 10);
|
||||||
/// 3. its MCP sessions end;
|
/// 3. its MCP sessions end;
|
||||||
/// 4. the last backup, for `backup_at_close` at most; the backups are
|
/// 4. the last backup, for `backup_at_close` at most; the backups are
|
||||||
/// then shut, which stops a run still going (git killed) and waits
|
/// then shut, which stops a run still going (its copy stopped) and waits
|
||||||
/// for it to end, so the answer never comes while it runs;
|
/// for it to end, so the answer never comes while it runs;
|
||||||
/// 5. the access log, uploads and exports close, each under the lock
|
/// 5. the access log, uploads and exports close, each under the lock
|
||||||
/// its own writes go in under, so a late writer is refused;
|
/// its own writes go in under, so a late writer is refused;
|
||||||
@@ -2229,8 +2223,8 @@ impl Books {
|
|||||||
|
|
||||||
/// The backups of the open book `id`, or the refusal to give a request
|
/// The backups of the open book `id`, or the refusal to give a request
|
||||||
/// that needs them.
|
/// that needs them.
|
||||||
fn backups_of(&self, id: &str) -> Result<Arc<crate::backup::Backups>, Response> {
|
fn backups_of(&self, id: &str) -> Result<Arc<crate::backup::Backups>, Box<Response>> {
|
||||||
let refused = |text: String| Response::Refused(self.hide(text));
|
let refused = |text: String| Box::new(Response::Refused(self.hide(text)));
|
||||||
let id = BookId::parse(id).map_err(|e| refused(e.to_string()))?;
|
let id = BookId::parse(id).map_err(|e| refused(e.to_string()))?;
|
||||||
match self.held().get(id.as_str()) {
|
match self.held().get(id.as_str()) {
|
||||||
Some(Book::Open { backups, .. }) => Ok(backups.clone()),
|
Some(Book::Open { backups, .. }) => Ok(backups.clone()),
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ pub struct SharedStore {
|
|||||||
/// A close of these books has begun (`hurry`): a call that can run
|
/// A close of these books has begun (`hurry`): a call that can run
|
||||||
/// long (a verification, a backup asked for, a package of every stored
|
/// long (a verification, a backup asked for, a package of every stored
|
||||||
/// file) stops at its next look, answering that it was stopped. Shared
|
/// file) stops at its next look, answering that it was stopped. Shared
|
||||||
/// with the books' backups (backup.rs), whose git it stops.
|
/// with the books' backups (backup.rs), whose copy it stops.
|
||||||
hurry: Arc<std::sync::atomic::AtomicBool>,
|
hurry: Arc<std::sync::atomic::AtomicBool>,
|
||||||
/// Requests running (from before their blocking task to its end).
|
/// Requests running (from before their blocking task to its end).
|
||||||
running: std::sync::atomic::AtomicUsize,
|
running: std::sync::atomic::AtomicUsize,
|
||||||
@@ -392,7 +392,7 @@ impl SharedStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The stop flag itself, for what looks at it from another thread or
|
/// The stop flag itself, for what looks at it from another thread or
|
||||||
/// hands it to git (ledger_store `cancel`, `Git::with_cancel`).
|
/// hands it to the backup (ledger_store `cancel`, `Ctx::with_stop`).
|
||||||
pub fn hurry_flag(&self) -> Arc<std::sync::atomic::AtomicBool> {
|
pub fn hurry_flag(&self) -> Arc<std::sync::atomic::AtomicBool> {
|
||||||
self.hurry.clone()
|
self.hurry.clone()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,9 @@
|
|||||||
//! every process that could still hold it: a child forked by another
|
//! every process that could still hold it: a child forked by another
|
||||||
//! thread of this process holds a copy of every open descriptor (this
|
//! thread of this process holds a copy of every open descriptor (this
|
||||||
//! lock's too) from its fork until its exec, and a `flock` lasts as
|
//! lock's too) from its fork until its exec, and a `flock` lasts as
|
||||||
//! long as any copy does. Every child this crate starts is started by
|
//! long as any copy does. Every child a process that holds a store starts
|
||||||
//! [`spawn`], and dropping a [`WriterLock`] returns only once every
|
//! is started by [`spawn`] (the store itself starts none since backups
|
||||||
|
//! became plain files, D-91; the seam stays for any that does), and dropping a [`WriterLock`] returns only once every
|
||||||
//! [`spawn`] begun before it has ended (its child has exec'd and the
|
//! [`spawn`] begun before it has ended (its child has exec'd and the
|
||||||
//! copies are closed), and then the lock is taken afresh and let go
|
//! copies are closed), and then the lock is taken afresh and let go
|
||||||
//! (it is free, or another writer has it, or 500 ms passed: the system
|
//! (it is free, or another writer has it, or 500 ms passed: the system
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ impl JobStop {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The flag: what git and the store's loops are handed to look at.
|
/// The flag: what a backup's copy and the store's loops are handed to look at.
|
||||||
pub fn flag(&self) -> std::sync::Arc<std::sync::atomic::AtomicBool> {
|
pub fn flag(&self) -> std::sync::Arc<std::sync::atomic::AtomicBool> {
|
||||||
self.flag.clone()
|
self.flag.clone()
|
||||||
}
|
}
|
||||||
@@ -229,7 +229,7 @@ impl JobStop {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A stop that reached the store's own loops or git, said as a job's.
|
/// A stop that reached the store's own loops or a backup's copy, said as a job's.
|
||||||
fn said(&self, e: RootError, undone: &str) -> RootError {
|
fn said(&self, e: RootError, undone: &str) -> RootError {
|
||||||
match e {
|
match e {
|
||||||
RootError::Store(_, StoreError::Cancelled) => RootError::Stopped(format!(
|
RootError::Store(_, StoreError::Cancelled) => RootError::Stopped(format!(
|
||||||
|
|||||||
@@ -624,3 +624,27 @@ The form (the lead's design; the unit may refine it and must say where):
|
|||||||
touched. A person restoring from one clones it with git themselves and
|
touched. A person restoring from one clones it with git themselves and
|
||||||
uses the existing adopt of a plain folder; the docs say how. A books'
|
uses the existing adopt of a plain folder; the docs say how. A books'
|
||||||
old `backup.git_remote` setting is reported as no longer used.
|
old `backup.git_remote` setting is reported as no longer used.
|
||||||
|
|
||||||
|
**Built (2026-11-21): where the build refined this section.** The code is
|
||||||
|
`crates/ledger-store/src/backup/` and `crates/ledger-mcp/src/backup.rs`; the
|
||||||
|
rules are `docs/spec/claims/backup.md`; the words for a person are
|
||||||
|
`docs/backups.md`.
|
||||||
|
|
||||||
|
- The store's lock is held only to take a *cut* (the journal's length and head,
|
||||||
|
the vault, the keys): the files are read after it, which is safe because the
|
||||||
|
journal is append-only and a stored file never changes. Section 9 said "under
|
||||||
|
the store's lock exactly where the commit was taken"; the commit is gone and
|
||||||
|
so is the local copy it wrote, so no slow disk is ever under the lock. The
|
||||||
|
local copy exists only for the format upgrade (`local-backup/`).
|
||||||
|
- A destination is tested for being "a point on the live journal" by the
|
||||||
|
byte-identity of the journal prefix its newest manifest names (a SHA-256 of
|
||||||
|
those bytes), which says more than the head at a sequence number.
|
||||||
|
- Series of segments are consolidated into one segment when they reach 200, so
|
||||||
|
a manifest stays small however long the books have been backed up; the old
|
||||||
|
segments stay (nothing is deleted).
|
||||||
|
- A passphrase is not a journal setting: the key is the book's local file, and a
|
||||||
|
sealed destination is a set of its own beside any plain one, so no journal
|
||||||
|
feature and no format upgrade is needed.
|
||||||
|
- Sealed sets are folders named by a random id, so a sealed destination's names
|
||||||
|
say nothing of the books; restore finds the one a passphrase opens.
|
||||||
|
|
||||||
Reference in new issue
Block a user