pub struct Repository {
pub directory: PathBuf,
pub save_on_drop: bool,
pub chunk_index: ChunkIndex,
}Fields§
§directory: PathBuf§save_on_drop: bool§chunk_index: ChunkIndexImplementations§
Source§impl Repository
impl Repository
Sourcepub fn open(
directory: &Path,
chunks_directory: Option<&Path>,
storage: Option<Arc<dyn ChunkStorage>>,
) -> Result<Self>
pub fn open( directory: &Path, chunks_directory: Option<&Path>, storage: Option<Arc<dyn ChunkStorage>>, ) -> Result<Self>
Opens an existing repository.
The repository must be initialized with new before use.
The repository directory must contain a .ddup-bak directory.
pub fn new( directory: &Path, chunk_size: usize, max_chunk_count: usize, storage: Option<Arc<dyn ChunkStorage>>, ) -> Self
pub fn save(&self) -> Result<()>
pub fn archive_path(&self, name: &str) -> PathBuf
Sourcepub const fn set_save_on_drop(&mut self, save_on_drop: bool) -> &mut Self
pub const fn set_save_on_drop(&mut self, save_on_drop: bool) -> &mut Self
Sets the save_on_drop flag. If set to true, the repository will save all changes to disk when dropped. If set to false, the repository will not save changes when dropped. This is useful for testing purposes, where you may want to discard changes. By default, this flag is set to true and should NOT be changed.
Sourcepub fn list_archives(&self) -> Result<Vec<String>>
pub fn list_archives(&self) -> Result<Vec<String>>
Lists all archives in the repository. Returns a vector of archive names without the “.ddup” extension. Example: “my_archive” instead of “my_archive.ddup”. The archives are stored in the “.ddup-bak/archives” directory.
Sourcepub fn get_archive(&self, name: &str) -> Result<Archive>
pub fn get_archive(&self, name: &str) -> Result<Archive>
Gets an archive by name.
Do not use this method to extract data, the data is chunked and compressed.
Use restore_archive instead.
pub fn clean(&self, progress: DeletionProgressCallback) -> Result<()>
pub fn entry_reader(&self, entry: Entry) -> Result<EntryReader>
pub fn archive_path_parent<'a>( archive: &'a mut Archive, entry: &Path, ) -> Option<&'a mut Box<DirectoryEntry>>
pub fn create_archive( &self, name: &str, directory: Option<Walk>, directory_root: Option<&Path>, progress_chunking: ProgressCallback, compression_callback: CompressionFormatCallback, threads: usize, ) -> Result<Archive>
pub fn read_entry_content<S: Write>( &self, entry: Entry, stream: &mut S, ) -> Result<()>
pub fn restore_archive( &self, name: &str, progress: ProgressCallback, threads: usize, ) -> Result<PathBuf>
pub fn restore_entries( &self, name: &str, entries: Vec<Entry>, progress: ProgressCallback, threads: usize, ) -> Result<PathBuf>
pub fn delete_archive( &self, name: &str, progress: DeletionProgressCallback, ) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Repository
impl !RefUnwindSafe for Repository
impl Send for Repository
impl Sync for Repository
impl Unpin for Repository
impl !UnwindSafe for Repository
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