pub struct TranscriptArchive { /* private fields */ }Expand description
Redacted zstd copies of transcripts, keyed by source path; an entry is
never dropped because its source was deleted, only by remove_where.
Opened sealed, every blob and the removal journal is written under the
current key and manifest records go to SEALED_MANIFEST_FILE. Plaintext
blobs are read as-is until reseal, and plaintext manifest entries (from
before sealing, or appended by an older binary) are folded into the sealed
manifest at open, the later of two entries for one source winning.
Implementations§
Source§impl TranscriptArchive
impl TranscriptArchive
pub fn open(dir: impl Into<PathBuf>) -> Result<Self>
Sourcepub fn open_sealed(dir: impl Into<PathBuf>, keys: SealKeys) -> Result<Self>
pub fn open_sealed(dir: impl Into<PathBuf>, keys: SealKeys) -> Result<Self>
Opens the archive writing everything sealed under keys. An archive
written before sealing opens as it is; reseal seals what it holds.
Sourcepub fn holds_unsealed(&self) -> bool
pub fn holds_unsealed(&self) -> bool
True while files written in plaintext may remain: plaintext manifest
entries were loaded or written, by this process or by one that died
before its reseal finished, and no reseal has run since.
Sourcepub fn set_seal_keys(&self, keys: SealKeys)
pub fn set_seal_keys(&self, keys: SealKeys)
Seals what is written from now on under the current key of keys,
which must also hold every key the archive’s files are sealed under.
Sourcepub fn reseal(&self) -> Result<usize>
pub fn reseal(&self) -> Result<usize>
Rewrites every blob, the manifest and any removal journal that is plaintext or sealed under a retired key under the current key, and deletes temporary files a crashed write left. Returns how many files were rewritten. Each blob is resealed under the state lock, so a concurrent removal never sees its blob renamed back into place.
Sourcepub fn remove_where(
&self,
doomed: impl Fn(&ArchiveEntry) -> bool,
) -> Result<Vec<ArchiveEntry>>
pub fn remove_where( &self, doomed: impl Fn(&ArchiveEntry) -> bool, ) -> Result<Vec<ArchiveEntry>>
Drops every entry doomed picks: the blobs to delete are journaled,
then the manifest is rewritten, then the blobs go and the journal with
them. A crash in between is finished at the next open.
Sourcepub fn copy_into(&self, dest: &Path) -> Result<()>
pub fn copy_into(&self, dest: &Path) -> Result<()>
Copies the archive into dest, which must not exist, while archiving
goes on. The manifest is appended in place, so it is copied under the
state lock; blobs are content-addressed and removed only after the
manifest stops naming them, so most are copied without the lock and
any the copied manifest no longer names are dropped from the copy.
Sourcepub fn holder(&self, sha256: &str) -> Option<ArchiveEntry>
pub fn holder(&self, sha256: &str) -> Option<ArchiveEntry>
An entry whose blob has this sha256, if any does.
pub fn dir(&self) -> &Path
pub fn archive(&self, source: &Path) -> Result<Archived>
pub fn entry(&self, source: &Path) -> Option<ArchiveEntry>
pub fn read(&self, source: &Path) -> Result<Option<String>>
Sourcepub fn entries(&self) -> Vec<ArchiveEntry>
pub fn entries(&self) -> Vec<ArchiveEntry>
Every archived transcript, in no particular order.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Auto Trait Implementations§
impl !Freeze for TranscriptArchive
impl Forget for TranscriptArchive
impl Move for TranscriptArchive
impl RefUnwindSafe for TranscriptArchive
impl Send for TranscriptArchive
impl Sync for TranscriptArchive
impl Unpin for TranscriptArchive
impl UnsafeUnpin for TranscriptArchive
impl UnwindSafe for TranscriptArchive
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
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