Skip to main content

Storage

Struct Storage 

Source
pub struct Storage { /* private fields */ }

Implementations§

Source§

impl Storage

Source

pub fn open(path: &Path, writable: bool) -> Result<Self>

Opens path, plus its sibling volumes if it is part of a split set.

Source

pub fn from_parts(recorded: &[(PathBuf, u64)], writable: bool) -> Result<Self>

Reopens a set whose original layout was recorded in the journal.

Source

pub fn primary(&self) -> &Path

Source

pub fn parts(&self) -> &[Part]

Source

pub fn record(&self) -> Vec<(PathBuf, u64)>

Source

pub fn original_len(&self) -> u64

The archive’s original length.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn remove(self) -> Result<()>

Deletes whatever is left of every part.

Source

pub fn reader(&self, tail: Option<Arc<Tail>>) -> Reader ⓘ

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.