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>,
) -> Self
pub fn from_store( region: &str, run_id: String, store: Arc<dyn RunStore>, ) -> Self
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<Self>
pub fn open_all_for_vm_with_store( store: Arc<dyn RunStore>, microvm_id: &str, ) -> Vec<Self>
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.