pub struct SnapshotFile {Show 17 fields
pub time: Zoned,
pub program_version: String,
pub parent: Option<SnapshotId>,
pub parents: Vec<SnapshotId>,
pub tree: TreeId,
pub label: String,
pub paths: StringList,
pub hostname: String,
pub username: String,
pub uid: u32,
pub gid: u32,
pub tags: StringList,
pub original: Option<SnapshotId>,
pub delete: DeleteOption,
pub summary: Option<SnapshotSummary>,
pub description: Option<String>,
pub id: SnapshotId,
}Expand description
A SnapshotFile is the repository representation of the snapshot metadata saved in a repository.
It is usually saved in the repository under snapshot/<ID>
§Note
SnapshotFile implements Eq, PartialEq, Ord, PartialOrd by comparing only the time field.
If you need another ordering, you have to implement that yourself.
Fields§
§time: ZonedTimestamp of this snapshot
program_version: StringProgram identifier and its version that have been used to create this snapshot.
parent: Option<SnapshotId>The Id of the first parent snapshot that this snapshot has been based on
parents: Vec<SnapshotId>The Ids of all parent snapshots that this snapshot has been based on
tree: TreeIdThe tree blob id where the contents of this snapshot are stored
label: StringLabel for the snapshot
paths: StringListThe list of paths contained in this snapshot
hostname: StringThe hostname of the device on which the snapshot has been created
username: StringThe username that started the backup run
uid: u32The uid of the username that started the backup run
gid: u32The gid of the username that started the backup run
A list of tags for this snapshot
original: Option<SnapshotId>The original Id of this snapshot. This is stored when the snapshot is modified.
delete: DeleteOptionOptions for deletion of the snapshot
summary: Option<SnapshotSummary>Summary information about the backup run
description: Option<String>A description of what is contained in this snapshot
id: SnapshotIdThe snapshot Id (not stored within the JSON)
Implementations§
Source§impl SnapshotFile
impl SnapshotFile
Sourcepub fn from_options(opts: &SnapshotOptions) -> RusticResult<Self>
pub fn from_options(opts: &SnapshotOptions) -> RusticResult<Self>
Create a SnapshotFile from SnapshotOptions.
§Arguments
opts- TheSnapshotOptionsto use
§Errors
- If the hostname is not valid unicode
- If the delete time is not in the range of
Local::now() - If the description file could not be read
§Note
This is the preferred way to create a new SnapshotFile to be used within crate::Repository::backup.
Sourcefn set_id(tuple: (SnapshotId, Self)) -> Self
fn set_id(tuple: (SnapshotId, Self)) -> Self
Sourcefn from_backend<B: DecryptReadBackend>(
be: &B,
id: &SnapshotId,
) -> RusticResult<Self>
fn from_backend<B: DecryptReadBackend>( be: &B, id: &SnapshotId, ) -> RusticResult<Self>
Sourcepub(crate) fn from_str<B: DecryptReadBackend>(
be: &B,
string: &str,
predicate: impl FnMut(&Self) -> bool + Send + Sync,
p: &Progress,
) -> RusticResult<Self>
pub(crate) fn from_str<B: DecryptReadBackend>( be: &B, string: &str, predicate: impl FnMut(&Self) -> bool + Send + Sync, p: &Progress, ) -> RusticResult<Self>
Get a SnapshotFile from the backend by (part of the) Id
Works with a snapshot Id or a latest indexed syntax: latest or latest~N with N >= 0
§Arguments
be- The backend to usestring- The (part of the) id of the snapshotpredicate- A predicate to filter the snapshotsp- A progress bar to use
§Errors
- If the string is not a valid hexadecimal string
- If no id could be found.
- If the id is not unique.
- If the
latestsyntax is “detected” but inexact
Sourcepub(crate) fn from_strs<B: DecryptReadBackend, S: AsRef<str>>(
be: &B,
strings: &[S],
predicate: impl FnMut(&Self) -> bool + Send + Sync,
p: &Progress,
) -> RusticResult<Vec<Self>>
pub(crate) fn from_strs<B: DecryptReadBackend, S: AsRef<str>>( be: &B, strings: &[S], predicate: impl FnMut(&Self) -> bool + Send + Sync, p: &Progress, ) -> RusticResult<Vec<Self>>
Get a Vec<SnapshotFile> from the backend by (part of the) Ids
Works with a snapshot Id or a latest indexed syntax: latest or latest~N with N >= 0
§Arguments
be- The backend to usestring- The (part of the) id of the snapshotpredicate- A predicate to filter the snapshotsp- A progress bar to use
§Errors
- If the string is not a valid hexadecimal string
- If no id could be found.
- If the id is not unique.
- If the
latestsyntax is “detected” but inexact
Sourcepub(crate) fn latest<B: DecryptReadBackend>(
be: &B,
predicate: impl FnMut(&Self) -> bool + Send + Sync,
p: &Progress,
) -> RusticResult<Self>
pub(crate) fn latest<B: DecryptReadBackend>( be: &B, predicate: impl FnMut(&Self) -> bool + Send + Sync, p: &Progress, ) -> RusticResult<Self>
Get the latest SnapshotFile from the backend
§Arguments
be- The backend to usepredicate- A predicate to filter the snapshotsp- A progress bar to use
§Errors
- If no snapshots are found
fn latest_n_from_iter( n: usize, iter: impl IntoIterator<Item = Self>, ) -> RusticResult<Vec<Self>>
Sourcepub(crate) fn latest_n<B: DecryptReadBackend>(
be: &B,
predicate: impl FnMut(&Self) -> bool + Send + Sync,
p: &Progress,
n: usize,
) -> RusticResult<Self>
pub(crate) fn latest_n<B: DecryptReadBackend>( be: &B, predicate: impl FnMut(&Self) -> bool + Send + Sync, p: &Progress, n: usize, ) -> RusticResult<Self>
Get the latest SnapshotFile from the backend
§Arguments
be- The backend to usepredicate- A predicate to filter the snapshotsp- A progress bar to usen- The n-latest index to go back for snapshot
§Errors
- If no snapshots are found
Sourcepub(crate) fn from_id<B: DecryptReadBackend>(
be: &B,
id: &str,
) -> RusticResult<Self>
pub(crate) fn from_id<B: DecryptReadBackend>( be: &B, id: &str, ) -> RusticResult<Self>
Get a SnapshotFile from the backend by (part of the) id
§Arguments
be- The backend to useid- The (part of the) id of the snapshot
§Errors
- If the string is not a valid hexadecimal string
- If no id could be found.
- If the id is not unique.
Sourcepub(crate) fn from_ids<B: DecryptReadBackend, T: AsRef<str>>(
be: &B,
ids: &[T],
p: &Progress,
) -> RusticResult<Vec<Self>>
pub(crate) fn from_ids<B: DecryptReadBackend, T: AsRef<str>>( be: &B, ids: &[T], p: &Progress, ) -> RusticResult<Vec<Self>>
Get a list of SnapshotFiles from the backend by supplying a list of/parts of their Ids
§Arguments
be- The backend to useids- The list of (parts of the) ids of the snapshotsp- A progress bar to use
§Errors
- If the string is not a valid hexadecimal string
- If no id could be found.
- If the id is not unique.
Sourcepub(crate) fn update_from_ids<B: DecryptReadBackend, T: AsRef<str>>(
be: &B,
current: Vec<Self>,
ids: &[T],
p: &Progress,
) -> RusticResult<Vec<Self>>
pub(crate) fn update_from_ids<B: DecryptReadBackend, T: AsRef<str>>( be: &B, current: Vec<Self>, ids: &[T], p: &Progress, ) -> RusticResult<Vec<Self>>
Update a list of SnapshotFiles from the backend by supplying a list of/parts of their Ids
§Arguments
be- The backend to useids- The list of (parts of the) ids of the snapshotsp- A progress bar to use
§Errors
- If the string is not a valid hexadecimal string
- If no id could be found.
- If the id is not unique.
fn fill_missing<B, F>( be: &B, current: Vec<Self>, ids: &[Id], filter: F, p: &Progress, ) -> RusticResult<Vec<Self>>
pub(crate) fn iter_all_from_backend<B, F>( be: &B, filter: F, p: &Progress, ) -> RusticResult<impl Iterator<Item = Self>>
pub(crate) fn update_from_backend<B, F>( be: &B, current: Vec<Self>, filter: F, p: &Progress, ) -> RusticResult<Vec<Self>>
Sourcepub fn must_delete(&self, now: &Zoned) -> bool
pub fn must_delete(&self, now: &Zoned) -> bool
Sourcepub fn modify(
&mut self,
modification: &SnapshotModification,
) -> RusticResult<bool>
pub fn modify( &mut self, modification: &SnapshotModification, ) -> RusticResult<bool>
Modifies the snapshot according to a SnapshotModification.
§Arguments
modification- The modification(s) to make
§Returns
true if the snapshot was changed.
§Errors
if reading a description from a file failed
Sourcepub(crate) fn clear_ids(sn: Self) -> Self
pub(crate) fn clear_ids(sn: Self) -> Self
Clear ids which are not saved by the copy command (and not compared when checking if snapshots already exist in the copy target)
§Arguments
sn- The snapshot to clear the ids from
Sourcepub fn get_parents(&self) -> &[SnapshotId]
pub fn get_parents(&self) -> &[SnapshotId]
Convenience method to get parent snapshots which are stored in the parent or parents field.
Trait Implementations§
Source§impl Clone for SnapshotFile
impl Clone for SnapshotFile
Source§fn clone(&self) -> SnapshotFile
fn clone(&self) -> SnapshotFile
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SnapshotFile
impl Debug for SnapshotFile
Source§impl Default for SnapshotFile
impl Default for SnapshotFile
Source§impl<'de> Deserialize<'de> for SnapshotFile
impl<'de> Deserialize<'de> for SnapshotFile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Grouping for SnapshotFile
impl Grouping for SnapshotFile
Source§impl Ord for SnapshotFile
impl Ord for SnapshotFile
Source§impl PartialEq for SnapshotFile
impl PartialEq for SnapshotFile
Source§impl PartialOrd for SnapshotFile
impl PartialOrd for SnapshotFile
Source§impl RepoFile for SnapshotFile
impl RepoFile for SnapshotFile
Source§impl Serialize for SnapshotFile
impl Serialize for SnapshotFile
impl Eq for SnapshotFile
Auto Trait Implementations§
impl Freeze for SnapshotFile
impl RefUnwindSafe for SnapshotFile
impl Send for SnapshotFile
impl Sync for SnapshotFile
impl Unpin for SnapshotFile
impl UnwindSafe for SnapshotFile
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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