pub struct Ledger { /* private fields */ }Expand description
Where live-run records are kept.
One file per run rather than one file with many lines: a run ending is a deletion, and deleting a file is atomic in a way that rewriting a shared file after a crash is not.
Implementations§
Source§impl Ledger
impl Ledger
Sourcepub fn open(root: impl Into<PathBuf>) -> Result<Self>
pub fn open(root: impl Into<PathBuf>) -> Result<Self>
Opens — and creates — the directory live records are kept in.
§Errors
Returns an error when the directory cannot be created.
Sourcepub fn starting(&self, live: &Live) -> Result<()>
pub fn starting(&self, live: &Live) -> Result<()>
Records that a run is about to start.
Call this before spawning. The record is the only evidence the run existed if the supervisor does not survive to write another.
§Errors
Returns an error when the record cannot be written.
Sourcepub fn finished(&self, run: &RunId) -> Result<()>
pub fn finished(&self, run: &RunId) -> Result<()>
Forgets a run that has been seen to finish.
§Errors
Returns an error when the record exists and cannot be removed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ledger
impl RefUnwindSafe for Ledger
impl Send for Ledger
impl Sync for Ledger
impl Unpin for Ledger
impl UnsafeUnpin for Ledger
impl UnwindSafe for Ledger
Blanket Implementations§
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