pub struct CacheBook { /* private fields */ }Expand description
The shared, content-addressed record of the caches a set of models reads. Clone it into every model that should share caches: sub-agents on one prefix, a resumed run and its successor.
Implementations§
Source§impl CacheBook
impl CacheBook
Sourcepub async fn prove<T>(&self, caches: &Model<CachedContents, T>) -> usizewhere
T: Transport<CachedContents>,
pub async fn prove<T>(&self, caches: &Model<CachedContents, T>) -> usizewhere
T: Transport<CachedContents>,
Keep each lease only if Google still has a cache under its name whose display name ends with the lease’s digest. Returns how many survived.
Sourcepub async fn close<T>(&self, caches: &Model<CachedContents, T>)where
T: Transport<CachedContents>,
pub async fn close<T>(&self, caches: &Model<CachedContents, T>)where
T: Transport<CachedContents>,
Delete every cache the book still holds. A cache already gone (403) counts as deleted.
Source§impl CacheBook
impl CacheBook
Sourcepub fn with_clock(self, clock: impl Fn() -> u64 + Send + Sync + 'static) -> Self
pub fn with_clock(self, clock: impl Fn() -> u64 + Send + Sync + 'static) -> Self
The same book reading time from clock (Unix seconds).
Sourcepub fn with_display_prefix(self, prefix: &str) -> Self
pub fn with_display_prefix(self, prefix: &str) -> Self
The same book naming its caches <prefix><digest>, so they can be
listed and swept. Defaults to rig-cache-.
Sourcepub fn events(&self) -> Vec<CacheEvent>
pub fn events(&self) -> Vec<CacheEvent>
Everything that happened to the book’s caches, in order.
Sourcepub fn restore(&self, leases: Vec<Lease>)
pub fn restore(&self, leases: Vec<Lease>)
Put checkpointed leases back. Call Self::prove next.
Sourcepub fn report(&self) -> CacheReport
pub fn report(&self) -> CacheReport
What the caches did and cost so far.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CacheBook
impl !UnwindSafe for CacheBook
impl Freeze for CacheBook
impl Send for CacheBook
impl Sync for CacheBook
impl Unpin for CacheBook
impl UnsafeUnpin for CacheBook
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
Converts
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> ⓘ
Converts
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