Struct rzbackup::ZBackupRepository [] [src]

pub struct ZBackupRepository { /* fields omitted */ }

This is the main struct which implements the ZBackup restore functionality. It is multi-threaded, using a cpu pool internally, and it is fully thread safe.

Methods

impl Repository
[src]

Provides a default configuration for a Repository. This may be useful for some users of the library, although normally a custom configuration will be a better option.

Constructs a new Repository from a configuration and a path, and an optional password file path.

This will read the repositories info file, and decrypt the encryption key using the password, if provided.

Load the index files. This is not done automatically, but it will be done lazily when they are first needed. This function also implements a lazy loading pattern, and so no index files will be reloaded if it is called more than ones.

Apart from being used internally, this function is designed to be used by library users who want to eagerly load the indexes so that restore operations can begin more quickly. This would also allow errors when reading the index files to be caught more quickly and deterministically.

Reload the index files. This forces the indexes to be reloaded, even if they have already been loaded. This should be called if new backups have been added to an already-open repository.

This will load a backup entirely into memory. The use of this function should probably be discouraged for most use cases, since backups could be extremely large.

This function will restore a named backup, writing it to the provided implementation of the Write trait.

This will load a single chunk from the repository. It can be used to create advanced behaviours, and is used, for example, by the RandomAccess struct.

This will load a single chunk from the repository, returning immediately with a future which can later be waited for. The chunk will be loaded in the background using the cpu pool.

This will load a single chunk from the repository, returning immediately with a future which will complete immediately if the chunk is in cache, with a future which will complete immediately with the chunk data.

If the chunk is not in cache, the returned future will wait until there is an available thread to start loading the bundle containing the chunk's data. It will then complete with a future which will in turn complete when the bundle has been loaded.

This double-asynchronicity allows consumers to efficiently use all available threads while blocking when none are available. This should significantly reduce worst-case memory usage.

This will load a single index entry from the repository. It returns this as a MasterIndexEntry, which includes the index entry and the header from the index file, since both are generally needed to do anything useful.

It can be used to create advanced behaviours, and is used, for example, by the RandomAccess struct.

Returns true if a chunk is present in the loaded indexes

This is a convenience method to construct a RandomAccess struct. It simply calls the RandomAccess::new constructor.

This method closes the repository, removing all temporary files

This is an accessor method to access the RepositoryConfig struct which was used to construct this Repository.

This is an accessor method for the RepositoryCore which holds the most basic details about a repository

This is an accessor method to access the repository's path

This is an accessor method to access the StorageInfo protobug struct which was loaded from the repository's index file.

This is an accessor method to access the decrypted encryption key which was stored in the repository's info file and decrypted using the provided password.

Convenience function to return the filesystem path for an index id.

Convenience function to return the filesystem path for a bundle id.

Trait Implementations

impl Clone for Repository
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more