pub struct RootfsCache { /* private fields */ }Expand description
A content-addressed cache of materialized minimal rootfs trees (#112 / ADR
0013 D7). Building a rootfs (resolving the ldd closure + assembling the
tree) is the expensive step; keying it by the (granted-binaries + resolved
closure) identity lets repeated runs of the same toolchain reuse the build.
The cache stores materialize_copy trees keyed by RootfsCache::key;
production keys the read-only bind-mount jail by the same key.
Implementations§
Source§impl RootfsCache
impl RootfsCache
Sourcepub fn new(root: impl Into<PathBuf>) -> RootfsCache
pub fn new(root: impl Into<PathBuf>) -> RootfsCache
A cache rooted at root (created on first store).
Sourcepub fn key(plan: &RootfsPlan) -> String
pub fn key(plan: &RootfsPlan) -> String
The content key for plan: a BLAKE3 crate::ContentId (hex) over each
file entry’s (path, ro/rw, len, mtime) and each directory mount-point’s
(path, ro/rw). A changed granted binary or .so (different len/mtime) ⇒
a different key ⇒ a rebuild; a changed exec scope ⇒ different paths ⇒ a
different key. Directory mount-points key by path only — their contents are
bind-mounted at run time, not part of the built tree.
Sourcepub fn get_or_materialize(
&self,
plan: &RootfsPlan,
) -> Result<(PathBuf, bool), Error>
pub fn get_or_materialize( &self, plan: &RootfsPlan, ) -> Result<(PathBuf, bool), Error>
The cached rootfs directory for plan, materializing it (copy) exactly
once. Returns (dir, hit) — hit == true ⇒ a complete prior build was
reused. A partial (interrupted) build is detected by the absence of the
completion marker and rebuilt from scratch.
Auto Trait Implementations§
impl Freeze for RootfsCache
impl RefUnwindSafe for RootfsCache
impl Send for RootfsCache
impl Sync for RootfsCache
impl Unpin for RootfsCache
impl UnsafeUnpin for RootfsCache
impl UnwindSafe for RootfsCache
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<F, T> ConvertInto<T> for Fwhere
T: ConvertFrom<F>,
impl<F, T> ConvertInto<T> for Fwhere
T: ConvertFrom<F>,
Source§fn convert_into(self) -> T
fn convert_into(self) -> T
Self to a value of type T.Source§impl<F, T> ConvertTryFrom<F> for Twhere
F: ConvertInto<T>,
impl<F, T> ConvertTryFrom<F> for Twhere
F: ConvertInto<T>,
Source§impl<F, T> ConvertTryInto<T> for Fwhere
T: ConvertTryFrom<F>,
impl<F, T> ConvertTryInto<T> for Fwhere
T: ConvertTryFrom<F>,
Source§type Error = <T as ConvertTryFrom<F>>::Error
type Error = <T as ConvertTryFrom<F>>::Error
Source§fn convert_try_into(self) -> Result<T, <T as ConvertTryFrom<F>>::Error>
fn convert_try_into(self) -> Result<T, <T as ConvertTryFrom<F>>::Error>
Self to a value of type T.impl<T> ErasedDestructor for Twhere
T: 'static,
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