pub struct Ledger {
pub record: Record,
/* private fields */
}Expand description
A record plus where it is written.
Fields§
§record: RecordImplementations§
Source§impl Ledger
impl Ledger
Sourcepub fn from_store(
region: &str,
run_id: String,
store: Arc<dyn RunStore>,
) -> Ledger
pub fn from_store( region: &str, run_id: String, store: Arc<dyn RunStore>, ) -> Ledger
A ledger keyed by a caller-supplied per-invocation id in store.
The id is <epoch>-<pid>, matching the Python. Not from a CSPRNG: this names a local
file rather than an idempotency token, and core is emphatic that token minting is its
own job (TRAP-1).
Sourcepub fn open_all_for_vm_with_store(
store: Arc<dyn RunStore>,
microvm_id: &str,
) -> Vec<Ledger>
pub fn open_all_for_vm_with_store( store: Arc<dyn RunStore>, microvm_id: &str, ) -> Vec<Ledger>
Every record in store that names microvm_id, newest first — reopened so a later
process can narrow and clear them.
terminate --delete-image reads the image off the newest (issue #160): run --keep
left the record with the VM, the image, and the image’s name, so the flag that asked
for the identifier back was asking for what the CLI already had. A retried launch can
leave two records naming one VM; a teardown that narrowed only the newest would leave
the older one reporting the VM forever, which is the stale ls shape issue #159
measured, so callers narrow all of them.
Name records live under root/names/ and are not run ledgers, so read_dir on the
root alone never sees them.
Sourcepub fn flush(&self)
pub fn flush(&self)
Writes the record without displacing a teardown failure with a storage failure.
Sourcepub fn record_image(&mut self, identifier: &str, name: &str)
pub fn record_image(&mut self, identifier: &str, name: &str)
Records the image, and flushes.
Sourcepub fn record_vm_log_group(&mut self, group: &str)
pub fn record_vm_log_group(&mut self, group: &str)
Records the caller-chosen per-VM log group, and flushes.
Sourcepub fn record_microvm(&mut self, id: &str)
pub fn record_microvm(&mut self, id: &str)
Records the VM, and flushes.
Sourcepub fn mark_outstanding(&mut self)
pub fn mark_outstanding(&mut self)
Marks everything this invocation created as outstanding, before any delete.
See the module docs: this order is what survives a process that dies inside the terminate call.
Sourcepub fn mark_deleted(&mut self, still_undeleted: &[String])
pub fn mark_deleted(&mut self, still_undeleted: &[String])
Narrows the outstanding list to what a teardown did not report deleted.
Takes the survivors rather than the deletions, because that is the shape
crate::sandbox::TeardownReport::undeleted hands over — and translating
between the two is where an inversion lives.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Ledger
impl !UnwindSafe for Ledger
impl Freeze for Ledger
impl Send for Ledger
impl Sync for Ledger
impl Unpin for Ledger
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more