qualia_core_db/bundle/stream/runtime/state/
mod.rs1mod access;
5mod close;
6mod data;
7mod loans;
8mod parents;
9mod preflight;
10mod restore;
11mod scope;
12use crate::net::peer::runtime::incarnation::CanonicalIncarnation;
13use crate::net::qdnf::errors::QdnfError as E;
14pub use access::RuntimeAccess;
15pub use close::RuntimeCloseError;
16pub(super) use data::RuntimeClosePhase;
17use data::RuntimeData;
18pub use parents::RuntimeParents;
19#[must_use = "drain real I/O and consume try_close; lost state retains canonical charges"]
20pub struct RetainedRuntime<'parent, 'host> {
21 parents: &'parent RuntimeParents<'host>,
22 registration: CanonicalIncarnation,
23 data: Option<RuntimeData>,
24}
25fn charged_bytes() -> Result<u64, E> {
28 let bytes = core::mem::size_of::<RetainedRuntime<'static, 'static>>()
29 .checked_add(core::mem::size_of::<RuntimeData>())
30 .and_then(|n| n.checked_add(core::mem::size_of::<restore::Restore<'static, 'static>>()))
31 .and_then(|n| n.checked_add(core::mem::size_of::<loans::ParentLoans<'static>>()))
32 .and_then(|n| n.checked_add(core::mem::size_of::<RuntimeParents<'static>>()))
33 .and_then(|n| n.checked_add(core::mem::size_of::<RuntimeAccess<'static, 'static>>()))
34 .ok_or(E::Range)?;
35 u64::try_from(bytes).map_err(|_| E::Range)
36}
37#[cfg(test)]
38mod tests;