pub struct Stager { /* private fields */ }Expand description
A staging directory that only ever holds verified content under its hash.
Implementations§
Source§impl Stager
impl Stager
Sourcepub fn new(dir: PathBuf, max: u64) -> Self
pub fn new(dir: PathBuf, max: u64) -> Self
A stager over dir that refuses content longer than max bytes.
Sourcepub fn writer(&self, hash: ContentHash, len: u64) -> Result<StagingWriter>
pub fn writer(&self, hash: ContentHash, len: u64) -> Result<StagingWriter>
Start receiving the content hash of len bytes into a partial file of the
writer’s own, so writers for the same hash (two sessions, or a session and a
scan’s conflict copy) never share one. Fails with Error::TooLarge before
touching the disk when len is over the limit.
Sourcepub fn staged(&self, hash: &ContentHash) -> Option<PathBuf>
pub fn staged(&self, hash: &ContentHash) -> Option<PathBuf>
The finished content for hash, if it is staged. Only existence is checked:
anything at <hex> was verified before it was renamed there.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Stager
impl Freeze for Stager
impl Move for Stager
impl RefUnwindSafe for Stager
impl Send for Stager
impl Sync for Stager
impl Unpin for Stager
impl UnsafeUnpin for Stager
impl UnwindSafe for Stager
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