pub struct Storage { /* private fields */ }Implementations§
Source§impl Storage
impl Storage
Sourcepub fn open(path: &Path, writable: bool) -> Result<Self>
pub fn open(path: &Path, writable: bool) -> Result<Self>
Opens path, plus its sibling volumes if it is part of a split set.
Sourcepub fn from_parts(recorded: &[(PathBuf, u64)], writable: bool) -> Result<Self>
pub fn from_parts(recorded: &[(PathBuf, u64)], writable: bool) -> Result<Self>
Reopens a set whose original layout was recorded in the journal.
Sourcepub fn sfv_checked(&self) -> bool
pub fn sfv_checked(&self) -> bool
Whether this storage has already been verified against an .sfv file.
pub fn mark_sfv_checked(&self)
pub fn protected(&self) -> bool
Sourcepub fn hard_linked(&self) -> Option<&Path>
pub fn hard_linked(&self) -> Option<&Path>
The first volume that has another name, if any. Shrinking a file shrinks it under every name it has, so extracting in place would empty a hard link that may be the only copy someone meant to keep.
pub fn primary(&self) -> &Path
pub fn parts(&self) -> &[Part]
pub fn record(&self) -> Vec<(PathBuf, u64)>
Sourcepub fn original_len(&self) -> u64
pub fn original_len(&self) -> u64
The archive’s original length.
Sourcepub fn current_len(&self) -> Result<u64>
pub fn current_len(&self) -> Result<u64>
How much of the archive is still on disk, checking that what is left is an untouched prefix of the original.
Sourcepub fn set_len(&self, len: u64) -> Result<()>
pub fn set_len(&self, len: u64) -> Result<()>
Shrinks the archive to its first len bytes: whole volumes past that
point are deleted, the one it falls in is truncated.
Sourcepub fn punch(&self, from: u64, to: u64) -> Result<bool>
pub fn punch(&self, from: u64, to: u64) -> Result<bool>
Gives back the disk space of the bytes in [from, to) while every
offset stays where it was; they read as zeros afterwards. Returns
false if the filesystem can’t. Filesystems free whole blocks only, so
up to a block at each end may stay allocated until truncation.
Sourcepub fn cut_to(&self, len: u64) -> Result<()>
pub fn cut_to(&self, len: u64) -> Result<()>
Like set_len, but also cuts volumes that grew past
their original length. Only for undoing an interrupted restore, which
is the one thing that appends to an archive: the volume it appended to
may have been whole, and set_len never touches whole volumes.
Sourcepub fn write_at(&self, offset: u64, bytes: &[u8]) -> Result<()>
pub fn write_at(&self, offset: u64, bytes: &[u8]) -> Result<()>
Writes bytes at offset of the joined archive and flushes them to
disk. Bytes inside the archive go to the volume that holds them; bytes
past its current end go to the last volume still there, which grows.
pub fn reader(&self, tail: Option<Arc<Tail>>) -> Reader ⓘ
Sourcepub fn count_reads(&mut self, reads: Arc<Reads>)
pub fn count_reads(&mut self, reads: Arc<Reads>)
Counts what every reader made from now on reads into reads, a pass
over the whole archive by default.
Sourcepub fn reads(&self) -> Arc<Reads> ⓘ
pub fn reads(&self) -> Arc<Reads> ⓘ
Shares the byte counter used by archive reads with another reader.
Sourcepub fn expect_reads(&self, total: u64)
pub fn expect_reads(&self, total: u64)
Starts the count over for a pass that reads total bytes.
Auto Trait Implementations§
impl !Freeze for Storage
impl Forget for Storage
impl RefUnwindSafe for Storage
impl Send for Storage
impl Sync for Storage
impl Unpin for Storage
impl UnsafeUnpin for Storage
impl UnwindSafe for Storage
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> 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