Skip to main content

SnapshotFile

Struct SnapshotFile 

Source
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: Zoned

Timestamp of this snapshot

§program_version: String

Program 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: TreeId

The tree blob id where the contents of this snapshot are stored

§label: String

Label for the snapshot

§paths: StringList

The list of paths contained in this snapshot

§hostname: String

The hostname of the device on which the snapshot has been created

§username: String

The username that started the backup run

§uid: u32

The uid of the username that started the backup run

§gid: u32

The gid of the username that started the backup run

§tags: StringList

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: DeleteOption

Options 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: SnapshotId

The snapshot Id (not stored within the JSON)

Implementations§

Source§

impl SnapshotFile

Source

pub fn from_options(opts: &SnapshotOptions) -> RusticResult<Self>

Create a SnapshotFile from SnapshotOptions.

§Arguments
§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.

Source

fn set_id(tuple: (SnapshotId, Self)) -> Self

Create a SnapshotFile from a given Id and RepoFile.

§Arguments
  • tuple - A tuple of the Id and the RepoFile to use
Source

fn from_backend<B: DecryptReadBackend>( be: &B, id: &SnapshotId, ) -> RusticResult<Self>

Get a SnapshotFile from the backend

§Arguments
  • be - The backend to use
  • id - The id of the snapshot
Source

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 use
  • string - The (part of the) id of the snapshot
  • predicate - A predicate to filter the snapshots
  • p - 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 latest syntax is “detected” but inexact
Source

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 use
  • string - The (part of the) id of the snapshot
  • predicate - A predicate to filter the snapshots
  • p - 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 latest syntax is “detected” but inexact
Source

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 use
  • predicate - A predicate to filter the snapshots
  • p - A progress bar to use
§Errors
  • If no snapshots are found
Source

fn latest_n_from_iter( n: usize, iter: impl IntoIterator<Item = Self>, ) -> RusticResult<Vec<Self>>

Source

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 use
  • predicate - A predicate to filter the snapshots
  • p - A progress bar to use
  • n - The n-latest index to go back for snapshot
§Errors
  • If no snapshots are found
Source

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 use
  • id - 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.
Source

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 use
  • ids - The list of (parts of the) ids of the snapshots
  • p - 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.
Source

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 use
  • ids - The list of (parts of the) ids of the snapshots
  • p - 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.
Source

fn fill_missing<B, F>( be: &B, current: Vec<Self>, ids: &[Id], filter: F, p: &Progress, ) -> RusticResult<Vec<Self>>
where B: DecryptReadBackend, F: FnMut(&Self) -> bool,

Source

pub(crate) fn iter_all_from_backend<B, F>( be: &B, filter: F, p: &Progress, ) -> RusticResult<impl Iterator<Item = Self>>
where B: DecryptReadBackend, F: FnMut(&Self) -> bool,

Source

pub(crate) fn update_from_backend<B, F>( be: &B, current: Vec<Self>, filter: F, p: &Progress, ) -> RusticResult<Vec<Self>>
where B: DecryptReadBackend, F: FnMut(&Self) -> bool,

Source

pub fn add_tags(&mut self, tag_lists: Vec<StringList>) -> bool

Add tag lists to snapshot.

§Arguments
  • tag_lists - The tag lists to add
§Returns

Returns whether snapshot was changed.

Source

pub fn set_tags(&mut self, tag_lists: Vec<StringList>) -> bool

Set tag lists to snapshot.

§Arguments
  • tag_lists - The tag lists to set
§Returns

Returns whether snapshot was changed.

Source

pub fn remove_tags(&mut self, tag_lists: &[StringList]) -> bool

Remove tag lists from snapshot.

§Arguments
  • tag_lists - The tag lists to remove
§Returns

Returns whether snapshot was changed.

Source

pub fn must_delete(&self, now: &Zoned) -> bool

Returns whether a snapshot must be deleted now

§Arguments
  • now - The current time
Source

pub fn must_keep(&self, now: &Zoned) -> bool

Returns whether a snapshot must be kept now

§Arguments
  • now - The current time
Source

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

Source

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
Source

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

Source§

fn clone(&self) -> SnapshotFile

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SnapshotFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SnapshotFile

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for SnapshotFile

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Grouping for SnapshotFile

Source§

impl Ord for SnapshotFile

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for SnapshotFile

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for SnapshotFile

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl RepoFile for SnapshotFile

Source§

const TYPE: FileType = FileType::Snapshot

The FileType associated with the repository file
Source§

type Id = SnapshotId

The Id type associated with the repository file
Source§

const ENCRYPTED: bool = true

Indicate whether the files are stored encrypted
Source§

impl Serialize for SnapshotFile

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for SnapshotFile

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,