pub struct ReversiblePromptCachePublication { /* private fields */ }Expand description
A prepared cache directory whose visibility can be rolled back exactly.
The backend writes a complete ordinary cache to Self::staging_destination.
Publication of a new destination is one directory rename. Replacement moves
only the immutable generation into the existing destination and atomically
switches CURRENT, retaining the previous generation identity until commit.
Implementations§
Source§impl ReversiblePromptCachePublication
impl ReversiblePromptCachePublication
Sourcepub fn begin(
destination: impl AsRef<Path>,
replace_existing: bool,
) -> Result<Self, PromptCachePersistenceError>
pub fn begin( destination: impl AsRef<Path>, replace_existing: bool, ) -> Result<Self, PromptCachePersistenceError>
Reserves a unique sibling destination without creating or publishing it.
Sourcepub fn staging_destination(&self) -> &Path
pub fn staging_destination(&self) -> &Path
Hidden destination into which an ordinary cache save must be completed.
Sourcepub fn publish(&mut self) -> Result<(), PromptCachePersistenceError>
pub fn publish(&mut self) -> Result<(), PromptCachePersistenceError>
Makes the prepared cache visible while retaining an exact rollback path.
Sourcepub fn commit(self) -> Result<(), PromptCachePersistenceError>
pub fn commit(self) -> Result<(), PromptCachePersistenceError>
Accepts the visible cache and releases rollback metadata.
Sourcepub fn rollback(self) -> Result<(), PromptCachePersistenceError>
pub fn rollback(self) -> Result<(), PromptCachePersistenceError>
Restores the prior visible cache, or removes a newly published cache.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ReversiblePromptCachePublication
impl RefUnwindSafe for ReversiblePromptCachePublication
impl Send for ReversiblePromptCachePublication
impl Sync for ReversiblePromptCachePublication
impl Unpin for ReversiblePromptCachePublication
impl UnsafeUnpin for ReversiblePromptCachePublication
impl UnwindSafe for ReversiblePromptCachePublication
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