[][src]Struct rrsync::IndexTransaction

pub struct IndexTransaction<'a> { /* fields omitted */ }

A transaction on the index, for safety and performance

Methods

impl<'a> IndexTransaction<'a>[src]

pub fn add_file(
    &mut self,
    name: &Path,
    modified: DateTime<Utc>
) -> Result<(u32, bool), Error>
[src]

Add a file to the index

This returns a tuple (file_id, up_to_date) where file_id can be used to insert blocks, and up_to_date indicates whether the file's modification date has changed and it should be re-indexed.

pub fn add_file_overwrite(
    &mut self,
    name: &Path,
    modified: DateTime<Utc>
) -> Result<u32, Error>
[src]

Replace file in the index

This is like add_file but will always replace an existing file.

pub fn remove_file(&mut self, file_id: u32) -> Result<(), Error>[src]

Remove a file and all its blocks from the index

pub fn move_file(
    &mut self,
    file_id: u32,
    destination: &Path
) -> Result<(), Error>
[src]

Move a file, possibly over another

pub fn list_files(&self) -> Result<Vec<(u32, PathBuf, DateTime<Utc>)>, Error>[src]

Get a list of all the files in the index

pub fn add_block(
    &mut self,
    hash: &HashDigest,
    file_id: u32,
    offset: usize,
    size: usize
) -> Result<(), Error>
[src]

Add a block to the index

pub fn list_file_blocks(
    &self,
    file_id: u32
) -> Result<Vec<(HashDigest, usize, usize)>, Error>
[src]

Get a list of all the blocks in a specific file

pub fn get_block(
    &self,
    hash: &HashDigest
) -> Result<Option<(PathBuf, usize, usize)>, Error>
[src]

Try to find a block in the indexed files

pub fn index_file(&mut self, path: &Path, name: &Path) -> Result<(), Error>[src]

Cut up a file into blocks and add them to the index

pub fn index_path(&mut self, path: &Path) -> Result<(), Error>[src]

Index files and directories recursively

pub fn remove_missing_files(&mut self, path: &Path) -> Result<(), Error>[src]

List all files and remove those that don't exist on disk

pub fn commit(self) -> Result<(), Error>[src]

Commit the transaction

Auto Trait Implementations

impl<'a> !Send for IndexTransaction<'a>

impl<'a> !Sync for IndexTransaction<'a>

impl<'a> Unpin for IndexTransaction<'a>

impl<'a> !UnwindSafe for IndexTransaction<'a>

impl<'a> !RefUnwindSafe for IndexTransaction<'a>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]