Struct with information about completed uploads (#121)
POD struct that holds some simple information about a kopia upload. Not wrapping or returning a handle to a kopia struct to keep upper layers of corso clear of type dependencies. Struct will help with tests as it can be returned from public functions in the KopiaWrapper package allowing more black-box testing. Especially useful since we don't yet have a restore flow, which means we can't test data == restore(backup(data)).
This commit is contained in:
parent
f68a4e3f46
commit
ecb894fc17
@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/kopia/kopia/repo"
|
||||
"github.com/kopia/kopia/repo/blob"
|
||||
"github.com/kopia/kopia/snapshot"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/alcionai/corso/pkg/storage"
|
||||
@ -19,6 +20,26 @@ var (
|
||||
errConnect = errors.New("connecting repo")
|
||||
)
|
||||
|
||||
type BackupStats struct {
|
||||
TotalFileCount int
|
||||
TotalDirectoryCount int
|
||||
IgnoredErrorCount int
|
||||
ErrorCount int
|
||||
Incomplete bool
|
||||
IncompleteReason string
|
||||
}
|
||||
|
||||
func manifestToStats(man *snapshot.Manifest) BackupStats {
|
||||
return BackupStats{
|
||||
TotalFileCount: int(man.Stats.TotalFileCount),
|
||||
TotalDirectoryCount: int(man.Stats.TotalDirectoryCount),
|
||||
IgnoredErrorCount: int(man.Stats.IgnoredErrorCount),
|
||||
ErrorCount: int(man.Stats.ErrorCount),
|
||||
Incomplete: man.IncompleteReason == "",
|
||||
IncompleteReason: man.IncompleteReason,
|
||||
}
|
||||
}
|
||||
|
||||
type KopiaWrapper struct {
|
||||
storage storage.Storage
|
||||
rep repo.Repository
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user