pub struct SnapshotCreateResult {
pub id: String,
pub source: SnapshotSource,
pub description: String,
pub start_time: DateTime<Utc>,
pub end_time: DateTime<Utc>,
pub root_entry: Option<RootEntry>,
pub tags: BTreeMap<String, String>,
}Expand description
Result of kopia snapshot create <path> --json.
kopia emits a single JSON object on stdout. The aggregate counts live under
rootEntry.summ; the create result itself does not carry a top-level
stats block (that appears on snapshot-list entries). We surface
convenience accessors for the common stats the mover reports.
Parse a representative kopia create result and read the convenience
accessors that pull from rootEntry.summ:
use kopiur_kopia::SnapshotCreateResult;
let json = r#"{
"id": "k9c0ffee",
"source": {"host": "prod", "userName": "mydb", "path": "/data"},
"startTime": "2026-06-02T03:13:59Z",
"endTime": "2026-06-02T03:14:00Z",
"rootEntry": {
"name": "data", "type": "d", "obj": "k1",
"summ": {"size": 4096, "files": 12, "dirs": 3, "numFailed": 1}
}
}"#;
let r: SnapshotCreateResult = serde_json::from_str(json).unwrap();
assert_eq!(r.id, "k9c0ffee");
assert_eq!(r.source.identity(), "mydb@prod:/data");
assert_eq!(r.total_bytes(), 4096);
assert_eq!(r.file_count(), 12);
assert_eq!(r.error_count(), 1);The accessors return 0 when the root summary is absent rather than
panicking:
use kopiur_kopia::SnapshotCreateResult;
let json = r#"{
"id": "k1",
"source": {"host": "h", "userName": "u", "path": "/p"},
"startTime": "2026-06-02T03:13:59Z",
"endTime": "2026-06-02T03:14:00Z"
}"#;
let r: SnapshotCreateResult = serde_json::from_str(json).unwrap();
assert_eq!(r.total_bytes(), 0);
assert_eq!(r.file_count(), 0);Fields§
§id: StringThe new snapshot’s manifest id.
source: SnapshotSourceIdentity of the snapshot.
description: StringFree-form description (usually empty).
start_time: DateTime<Utc>When the snapshot started.
end_time: DateTime<Utc>When the snapshot finished.
root_entry: Option<RootEntry>Root directory entry with its summary.
Snapshot tags as stored on the manifest — keys carry kopia’s tag: prefix
(strip with user_tags). Empty for untagged snapshots and on kopia
versions that omit the field; an empty map is elided on re-serialization
(these types also ride the mover result wire).
Implementations§
Source§impl SnapshotCreateResult
impl SnapshotCreateResult
Sourcepub fn total_bytes(&self) -> u64
pub fn total_bytes(&self) -> u64
Total logical bytes in the snapshot, from the root summary (0 if absent).
Sourcepub fn file_count(&self) -> u64
pub fn file_count(&self) -> u64
Total file count in the snapshot, from the root summary (0 if absent).
Sourcepub fn error_count(&self) -> u64
pub fn error_count(&self) -> u64
Number of entries that failed during the walk (0 if absent).
Sourcepub fn entry_errors(&self) -> &[EntryError]
pub fn entry_errors(&self) -> &[EntryError]
The per-entry errors kopia recorded (empty if none / absent). Non-empty even when the errors were ignored by policy (exit 0) — the canonical signal that a snapshot is incomplete (some source entries were skipped).
Trait Implementations§
Source§impl Clone for SnapshotCreateResult
impl Clone for SnapshotCreateResult
Source§fn clone(&self) -> SnapshotCreateResult
fn clone(&self) -> SnapshotCreateResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SnapshotCreateResult
impl Debug for SnapshotCreateResult
Source§impl<'de> Deserialize<'de> for SnapshotCreateResult
impl<'de> Deserialize<'de> for SnapshotCreateResult
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 PartialEq for SnapshotCreateResult
impl PartialEq for SnapshotCreateResult
Source§fn eq(&self, other: &SnapshotCreateResult) -> bool
fn eq(&self, other: &SnapshotCreateResult) -> bool
self and other values to be equal, and is used by ==.