-
Notifications
You must be signed in to change notification settings - Fork 15
/
restic_types.go
66 lines (59 loc) · 2.64 KB
/
restic_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package main
// Restic Types from JSON output: https://restic.readthedocs.io/en/stable/075_scripting.html#json-output
// BackupMessage represents a general message from Restic backup, with a MessageType for type assertion.
type BackupMessage struct {
MessageType string `json:"message_type"`
}
// BackupStatusMessage represents the "status" messages emitted during backup operations.
type BackupStatusMessage struct {
MessageType string `json:"message_type"`
SecondsElapsed float64 `json:"seconds_elapsed"`
SecondsRemaining float64 `json:"seconds_remaining,omitempty"`
PercentDone float64 `json:"percent_done"`
TotalFiles int `json:"total_files"`
FilesDone int `json:"files_done"`
TotalBytes int64 `json:"total_bytes"`
BytesDone int64 `json:"bytes_done"`
ErrorCount int `json:"error_count"`
CurrentFiles []string `json:"current_files,omitempty"`
}
// BackupErrorMessage represents the "error" messages that provide details on errors encountered.
type BackupErrorMessage struct {
MessageType string `json:"message_type"`
Error string `json:"error"`
During string `json:"during"`
Item string `json:"item"`
}
// BackupVerboseStatusMessage provides detailed progress updates, including specifics about files being backed up.
type BackupVerboseStatusMessage struct {
MessageType string `json:"message_type"`
Action string `json:"action"`
Item string `json:"item"`
Duration float64 `json:"duration"`
DataSize int64 `json:"data_size"`
MetadataSize int64 `json:"metadata_size"`
TotalFiles int `json:"total_files"`
}
// BackupSummaryMessage represents the summary of a completed backup operation.
type BackupSummaryMessage struct {
MessageType string `json:"message_type"`
FilesNew int `json:"files_new"`
FilesChanged int `json:"files_changed"`
FilesUnmodified int `json:"files_unmodified"`
DirsNew int `json:"dirs_new"`
DirsChanged int `json:"dirs_changed"`
DirsUnmodified int `json:"dirs_unmodified"`
DataBlobs int `json:"data_blobs"`
TreeBlobs int `json:"tree_blobs"`
DataAdded int64 `json:"data_added"`
TotalFilesProcessed int `json:"total_files_processed"`
TotalBytesProcessed int64 `json:"total_bytes_processed"`
TotalDuration float64 `json:"total_duration"`
SnapshotID string `json:"snapshot_id"`
}
// InitMessage represents the summary of `restic init`.
type InitMessage struct {
MessageType string `json:"message_type"`
ID string `json:"id"`
Repository string `json:"repository"`
}