Fix function, variable, and type references
Fix the package specifier for function, variable, and type references since the package path changed for them.
This commit is contained in:
parent
216f29888f
commit
65af82f0f5
@ -8,6 +8,7 @@ import (
|
|||||||
"golang.org/x/exp/slices"
|
"golang.org/x/exp/slices"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/version"
|
"github.com/alcionai/corso/src/internal/version"
|
||||||
|
"github.com/alcionai/corso/src/pkg/backup"
|
||||||
"github.com/alcionai/corso/src/pkg/backup/identity"
|
"github.com/alcionai/corso/src/pkg/backup/identity"
|
||||||
"github.com/alcionai/corso/src/pkg/logger"
|
"github.com/alcionai/corso/src/pkg/logger"
|
||||||
)
|
)
|
||||||
@ -17,17 +18,17 @@ var _ backup.BackupBases = &backupBases{}
|
|||||||
type backupBases struct {
|
type backupBases struct {
|
||||||
// backups and mergeBases should be modified together as they relate similar
|
// backups and mergeBases should be modified together as they relate similar
|
||||||
// data.
|
// data.
|
||||||
backups []BackupEntry
|
backups []backup.BackupEntry
|
||||||
mergeBases []ManifestEntry
|
mergeBases []backup.ManifestEntry
|
||||||
assistBackups []BackupEntry
|
assistBackups []backup.BackupEntry
|
||||||
assistBases []ManifestEntry
|
assistBases []backup.ManifestEntry
|
||||||
|
|
||||||
// disableAssistBases denote whether any assist bases should be returned to
|
// disableAssistBases denote whether any assist bases should be returned to
|
||||||
// kopia during snapshot operation.
|
// kopia during snapshot operation.
|
||||||
disableAssistBases bool
|
disableAssistBases bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bb *backupBases) SnapshotAssistBases() []ManifestEntry {
|
func (bb *backupBases) SnapshotAssistBases() []backup.ManifestEntry {
|
||||||
if bb.disableAssistBases {
|
if bb.disableAssistBases {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -39,14 +40,14 @@ func (bb *backupBases) SnapshotAssistBases() []ManifestEntry {
|
|||||||
|
|
||||||
func (bb *backupBases) ConvertToAssistBase(manifestID manifest.ID) {
|
func (bb *backupBases) ConvertToAssistBase(manifestID manifest.ID) {
|
||||||
var (
|
var (
|
||||||
snapshotMan ManifestEntry
|
snapshotMan backup.ManifestEntry
|
||||||
base BackupEntry
|
base backup.BackupEntry
|
||||||
snapFound bool
|
snapFound bool
|
||||||
)
|
)
|
||||||
|
|
||||||
idx := slices.IndexFunc(
|
idx := slices.IndexFunc(
|
||||||
bb.mergeBases,
|
bb.mergeBases,
|
||||||
func(man ManifestEntry) bool {
|
func(man backup.ManifestEntry) bool {
|
||||||
return man.ID == manifestID
|
return man.ID == manifestID
|
||||||
})
|
})
|
||||||
if idx >= 0 {
|
if idx >= 0 {
|
||||||
@ -57,7 +58,7 @@ func (bb *backupBases) ConvertToAssistBase(manifestID manifest.ID) {
|
|||||||
|
|
||||||
idx = slices.IndexFunc(
|
idx = slices.IndexFunc(
|
||||||
bb.backups,
|
bb.backups,
|
||||||
func(bup BackupEntry) bool {
|
func(bup backup.BackupEntry) bool {
|
||||||
return bup.SnapshotID == string(manifestID)
|
return bup.SnapshotID == string(manifestID)
|
||||||
})
|
})
|
||||||
if idx >= 0 {
|
if idx >= 0 {
|
||||||
@ -72,11 +73,11 @@ func (bb *backupBases) ConvertToAssistBase(manifestID manifest.ID) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bb backupBases) Backups() []BackupEntry {
|
func (bb backupBases) Backups() []backup.BackupEntry {
|
||||||
return slices.Clone(bb.backups)
|
return slices.Clone(bb.backups)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bb backupBases) UniqueAssistBackups() []BackupEntry {
|
func (bb backupBases) UniqueAssistBackups() []backup.BackupEntry {
|
||||||
if bb.disableAssistBases {
|
if bb.disableAssistBases {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -100,7 +101,7 @@ func (bb *backupBases) MinBackupVersion() int {
|
|||||||
return min
|
return min
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bb backupBases) MergeBases() []ManifestEntry {
|
func (bb backupBases) MergeBases() []backup.ManifestEntry {
|
||||||
return slices.Clone(bb.mergeBases)
|
return slices.Clone(bb.mergeBases)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +118,7 @@ func (bb *backupBases) DisableMergeBases() {
|
|||||||
bb.backups = nil
|
bb.backups = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bb backupBases) UniqueAssistBases() []ManifestEntry {
|
func (bb backupBases) UniqueAssistBases() []backup.ManifestEntry {
|
||||||
if bb.disableAssistBases {
|
if bb.disableAssistBases {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -152,9 +153,9 @@ func (bb *backupBases) DisableAssistBases() {
|
|||||||
// MergeBase in the other BackupBases.
|
// MergeBase in the other BackupBases.
|
||||||
func (bb *backupBases) MergeBackupBases(
|
func (bb *backupBases) MergeBackupBases(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
other BackupBases,
|
other backup.BackupBases,
|
||||||
reasonToKey func(reason identity.Reasoner) string,
|
reasonToKey func(reason identity.Reasoner) string,
|
||||||
) BackupBases {
|
) backup.BackupBases {
|
||||||
if other == nil || (len(other.MergeBases()) == 0 && len(other.UniqueAssistBases()) == 0) {
|
if other == nil || (len(other.MergeBases()) == 0 && len(other.UniqueAssistBases()) == 0) {
|
||||||
return bb
|
return bb
|
||||||
}
|
}
|
||||||
@ -183,7 +184,7 @@ func (bb *backupBases) MergeBackupBases(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var toAdd []ManifestEntry
|
var toAdd []backup.ManifestEntry
|
||||||
|
|
||||||
// Calculate the set of mergeBases to pull from other into this one.
|
// Calculate the set of mergeBases to pull from other into this one.
|
||||||
for _, m := range other.MergeBases() {
|
for _, m := range other.MergeBases() {
|
||||||
@ -244,10 +245,10 @@ func (bb *backupBases) MergeBackupBases(
|
|||||||
|
|
||||||
func findNonUniqueManifests(
|
func findNonUniqueManifests(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
manifests []ManifestEntry,
|
manifests []backup.ManifestEntry,
|
||||||
) map[manifest.ID]struct{} {
|
) map[manifest.ID]struct{} {
|
||||||
// ReasonKey -> manifests with that reason.
|
// ReasonKey -> manifests with that reason.
|
||||||
reasons := map[string][]ManifestEntry{}
|
reasons := map[string][]backup.ManifestEntry{}
|
||||||
toDrop := map[manifest.ID]struct{}{}
|
toDrop := map[manifest.ID]struct{}{}
|
||||||
|
|
||||||
for _, man := range manifests {
|
for _, man := range manifests {
|
||||||
@ -300,17 +301,20 @@ func findNonUniqueManifests(
|
|||||||
return toDrop
|
return toDrop
|
||||||
}
|
}
|
||||||
|
|
||||||
func getBackupByID(backups []BackupEntry, bID string) (BackupEntry, bool) {
|
func getBackupByID(
|
||||||
|
backups []backup.BackupEntry,
|
||||||
|
bID string,
|
||||||
|
) (backup.BackupEntry, bool) {
|
||||||
if len(bID) == 0 {
|
if len(bID) == 0 {
|
||||||
return BackupEntry{}, false
|
return backup.BackupEntry{}, false
|
||||||
}
|
}
|
||||||
|
|
||||||
idx := slices.IndexFunc(backups, func(b BackupEntry) bool {
|
idx := slices.IndexFunc(backups, func(b backup.BackupEntry) bool {
|
||||||
return string(b.ID) == bID
|
return string(b.ID) == bID
|
||||||
})
|
})
|
||||||
|
|
||||||
if idx < 0 || idx >= len(backups) {
|
if idx < 0 || idx >= len(backups) {
|
||||||
return BackupEntry{}, false
|
return backup.BackupEntry{}, false
|
||||||
}
|
}
|
||||||
|
|
||||||
return backups[idx], true
|
return backups[idx], true
|
||||||
@ -333,10 +337,10 @@ func (bb *backupBases) fixupAndVerify(ctx context.Context) {
|
|||||||
toDrop := findNonUniqueManifests(ctx, bb.mergeBases)
|
toDrop := findNonUniqueManifests(ctx, bb.mergeBases)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
backupsToKeep []BackupEntry
|
backupsToKeep []backup.BackupEntry
|
||||||
assistBackupsToKeep []BackupEntry
|
assistBackupsToKeep []backup.BackupEntry
|
||||||
mergeToKeep []ManifestEntry
|
mergeToKeep []backup.ManifestEntry
|
||||||
assistToKeep []ManifestEntry
|
assistToKeep []backup.ManifestEntry
|
||||||
)
|
)
|
||||||
|
|
||||||
for _, man := range bb.mergeBases {
|
for _, man := range bb.mergeBases {
|
||||||
|
|||||||
@ -18,10 +18,15 @@ import (
|
|||||||
"github.com/alcionai/corso/src/pkg/path"
|
"github.com/alcionai/corso/src/pkg/path"
|
||||||
)
|
)
|
||||||
|
|
||||||
func makeManifest(id, incmpl, bID string, reasons ...identity.Reasoner) ManifestEntry {
|
func makeManifest(
|
||||||
bIDKey, _ := makeTagKV(TagBackupID)
|
id,
|
||||||
|
incmpl,
|
||||||
|
bID string,
|
||||||
|
reasons ...identity.Reasoner,
|
||||||
|
) backup.ManifestEntry {
|
||||||
|
bIDKey, _ := backup.MakeTagKV(TagBackupID)
|
||||||
|
|
||||||
return ManifestEntry{
|
return backup.ManifestEntry{
|
||||||
Manifest: &snapshot.Manifest{
|
Manifest: &snapshot.Manifest{
|
||||||
ID: manifest.ID(id),
|
ID: manifest.ID(id),
|
||||||
IncompleteReason: incmpl,
|
IncompleteReason: incmpl,
|
||||||
@ -57,7 +62,7 @@ func (suite *BackupBasesUnitSuite) TestMinBackupVersion() {
|
|||||||
{
|
{
|
||||||
name: "Unsorted Backups",
|
name: "Unsorted Backups",
|
||||||
bb: &backupBases{
|
bb: &backupBases{
|
||||||
backups: []BackupEntry{
|
backups: []backup.BackupEntry{
|
||||||
{
|
{
|
||||||
Backup: &backup.Backup{
|
Backup: &backup.Backup{
|
||||||
Version: 4,
|
Version: 4,
|
||||||
@ -86,13 +91,13 @@ func (suite *BackupBasesUnitSuite) TestMinBackupVersion() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (suite *BackupBasesUnitSuite) TestConvertToAssistBase() {
|
func (suite *BackupBasesUnitSuite) TestConvertToAssistBase() {
|
||||||
backups := []BackupEntry{
|
backups := []backup.BackupEntry{
|
||||||
{Backup: &backup.Backup{SnapshotID: "1"}},
|
{Backup: &backup.Backup{SnapshotID: "1"}},
|
||||||
{Backup: &backup.Backup{SnapshotID: "2"}},
|
{Backup: &backup.Backup{SnapshotID: "2"}},
|
||||||
{Backup: &backup.Backup{SnapshotID: "3"}},
|
{Backup: &backup.Backup{SnapshotID: "3"}},
|
||||||
}
|
}
|
||||||
|
|
||||||
merges := []ManifestEntry{
|
merges := []backup.ManifestEntry{
|
||||||
makeManifest("1", "", ""),
|
makeManifest("1", "", ""),
|
||||||
makeManifest("2", "", ""),
|
makeManifest("2", "", ""),
|
||||||
makeManifest("3", "", ""),
|
makeManifest("3", "", ""),
|
||||||
@ -185,8 +190,8 @@ func (suite *BackupBasesUnitSuite) TestConvertToAssistBase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expected := &backupBases{
|
expected := &backupBases{
|
||||||
backups: []BackupEntry{backups[0], backups[1]},
|
backups: []backup.BackupEntry{backups[0], backups[1]},
|
||||||
mergeBases: []ManifestEntry{merges[0], merges[1]},
|
mergeBases: []backup.ManifestEntry{merges[0], merges[1]},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, i := range test.expectAssist {
|
for _, i := range test.expectAssist {
|
||||||
@ -203,20 +208,20 @@ func (suite *BackupBasesUnitSuite) TestConvertToAssistBase() {
|
|||||||
func (suite *BackupBasesUnitSuite) TestDisableMergeBases() {
|
func (suite *BackupBasesUnitSuite) TestDisableMergeBases() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
|
|
||||||
merge := []BackupEntry{
|
merge := []backup.BackupEntry{
|
||||||
{Backup: &backup.Backup{BaseModel: model.BaseModel{ID: "m1"}}},
|
{Backup: &backup.Backup{BaseModel: model.BaseModel{ID: "m1"}}},
|
||||||
{Backup: &backup.Backup{BaseModel: model.BaseModel{ID: "m2"}}},
|
{Backup: &backup.Backup{BaseModel: model.BaseModel{ID: "m2"}}},
|
||||||
}
|
}
|
||||||
assist := []BackupEntry{
|
assist := []backup.BackupEntry{
|
||||||
{Backup: &backup.Backup{BaseModel: model.BaseModel{ID: "a1"}}},
|
{Backup: &backup.Backup{BaseModel: model.BaseModel{ID: "a1"}}},
|
||||||
{Backup: &backup.Backup{BaseModel: model.BaseModel{ID: "a2"}}},
|
{Backup: &backup.Backup{BaseModel: model.BaseModel{ID: "a2"}}},
|
||||||
}
|
}
|
||||||
|
|
||||||
bb := &backupBases{
|
bb := &backupBases{
|
||||||
backups: slices.Clone(merge),
|
backups: slices.Clone(merge),
|
||||||
mergeBases: make([]ManifestEntry, 2),
|
mergeBases: make([]backup.ManifestEntry, 2),
|
||||||
assistBackups: slices.Clone(assist),
|
assistBackups: slices.Clone(assist),
|
||||||
assistBases: make([]ManifestEntry, 2),
|
assistBases: make([]backup.ManifestEntry, 2),
|
||||||
}
|
}
|
||||||
|
|
||||||
bb.DisableMergeBases()
|
bb.DisableMergeBases()
|
||||||
@ -237,10 +242,10 @@ func (suite *BackupBasesUnitSuite) TestDisableMergeBases() {
|
|||||||
func (suite *BackupBasesUnitSuite) TestDisableAssistBases() {
|
func (suite *BackupBasesUnitSuite) TestDisableAssistBases() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
bb := &backupBases{
|
bb := &backupBases{
|
||||||
backups: make([]BackupEntry, 2),
|
backups: make([]backup.BackupEntry, 2),
|
||||||
mergeBases: make([]ManifestEntry, 2),
|
mergeBases: make([]backup.ManifestEntry, 2),
|
||||||
assistBases: make([]ManifestEntry, 2),
|
assistBases: make([]backup.ManifestEntry, 2),
|
||||||
assistBackups: make([]BackupEntry, 2),
|
assistBackups: make([]backup.BackupEntry, 2),
|
||||||
}
|
}
|
||||||
|
|
||||||
bb.DisableAssistBases()
|
bb.DisableAssistBases()
|
||||||
@ -275,7 +280,7 @@ func (suite *BackupBasesUnitSuite) TestMergeBackupBases() {
|
|||||||
|
|
||||||
m := makeManifest(baseID, "", "b"+baseID, reasons...)
|
m := makeManifest(baseID, "", "b"+baseID, reasons...)
|
||||||
|
|
||||||
b := BackupEntry{
|
b := backup.BackupEntry{
|
||||||
Backup: &backup.Backup{
|
Backup: &backup.Backup{
|
||||||
BaseModel: model.BaseModel{ID: model.StableID("b" + baseID)},
|
BaseModel: model.BaseModel{ID: model.StableID("b" + baseID)},
|
||||||
SnapshotID: baseID,
|
SnapshotID: baseID,
|
||||||
@ -299,7 +304,7 @@ func (suite *BackupBasesUnitSuite) TestMergeBackupBases() {
|
|||||||
|
|
||||||
m := makeManifest(baseID, "", "a"+baseID, reasons...)
|
m := makeManifest(baseID, "", "a"+baseID, reasons...)
|
||||||
|
|
||||||
b := BackupEntry{
|
b := backup.BackupEntry{
|
||||||
Backup: &backup.Backup{
|
Backup: &backup.Backup{
|
||||||
BaseModel: model.BaseModel{
|
BaseModel: model.BaseModel{
|
||||||
ID: model.StableID("a" + baseID),
|
ID: model.StableID("a" + baseID),
|
||||||
@ -528,7 +533,11 @@ func (suite *BackupBasesUnitSuite) TestMergeBackupBases() {
|
|||||||
func (suite *BackupBasesUnitSuite) TestFixupAndVerify() {
|
func (suite *BackupBasesUnitSuite) TestFixupAndVerify() {
|
||||||
ro := "resource_owner"
|
ro := "resource_owner"
|
||||||
|
|
||||||
makeMan := func(pct path.CategoryType, id, incmpl, bID string) ManifestEntry {
|
makeMan := func(
|
||||||
|
pct path.CategoryType,
|
||||||
|
id, incmpl,
|
||||||
|
bID string,
|
||||||
|
) backup.ManifestEntry {
|
||||||
r := NewReason("", ro, path.ExchangeService, pct)
|
r := NewReason("", ro, path.ExchangeService, pct)
|
||||||
return makeManifest(id, incmpl, bID, r)
|
return makeManifest(id, incmpl, bID, r)
|
||||||
}
|
}
|
||||||
@ -536,7 +545,7 @@ func (suite *BackupBasesUnitSuite) TestFixupAndVerify() {
|
|||||||
// Make a function so tests can modify things without messing with each other.
|
// Make a function so tests can modify things without messing with each other.
|
||||||
validMail1 := func() *backupBases {
|
validMail1 := func() *backupBases {
|
||||||
return &backupBases{
|
return &backupBases{
|
||||||
backups: []BackupEntry{
|
backups: []backup.BackupEntry{
|
||||||
{
|
{
|
||||||
Backup: &backup.Backup{
|
Backup: &backup.Backup{
|
||||||
BaseModel: model.BaseModel{
|
BaseModel: model.BaseModel{
|
||||||
@ -547,10 +556,10 @@ func (suite *BackupBasesUnitSuite) TestFixupAndVerify() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mergeBases: []ManifestEntry{
|
mergeBases: []backup.ManifestEntry{
|
||||||
makeMan(path.EmailCategory, "id1", "", "bid1"),
|
makeMan(path.EmailCategory, "id1", "", "bid1"),
|
||||||
},
|
},
|
||||||
assistBackups: []BackupEntry{
|
assistBackups: []backup.BackupEntry{
|
||||||
{
|
{
|
||||||
Backup: &backup.Backup{
|
Backup: &backup.Backup{
|
||||||
BaseModel: model.BaseModel{
|
BaseModel: model.BaseModel{
|
||||||
@ -562,7 +571,7 @@ func (suite *BackupBasesUnitSuite) TestFixupAndVerify() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
assistBases: []ManifestEntry{
|
assistBases: []backup.ManifestEntry{
|
||||||
makeMan(path.EmailCategory, "id2", "", "bid2"),
|
makeMan(path.EmailCategory, "id2", "", "bid2"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -571,7 +580,7 @@ func (suite *BackupBasesUnitSuite) TestFixupAndVerify() {
|
|||||||
table := []struct {
|
table := []struct {
|
||||||
name string
|
name string
|
||||||
bb *backupBases
|
bb *backupBases
|
||||||
expect BackupBases
|
expect backup.BackupBases
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "empty BaseBackups",
|
name: "empty BaseBackups",
|
||||||
@ -769,14 +778,14 @@ func (suite *BackupBasesUnitSuite) TestFixupAndVerify() {
|
|||||||
res := validMail1()
|
res := validMail1()
|
||||||
res.backups = append(
|
res.backups = append(
|
||||||
res.backups,
|
res.backups,
|
||||||
BackupEntry{
|
backup.BackupEntry{
|
||||||
Backup: &backup.Backup{
|
Backup: &backup.Backup{
|
||||||
BaseModel: model.BaseModel{
|
BaseModel: model.BaseModel{
|
||||||
ID: "bid3",
|
ID: "bid3",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
BackupEntry{
|
backup.BackupEntry{
|
||||||
Backup: &backup.Backup{
|
Backup: &backup.Backup{
|
||||||
BaseModel: model.BaseModel{
|
BaseModel: model.BaseModel{
|
||||||
ID: "bid4",
|
ID: "bid4",
|
||||||
@ -796,7 +805,7 @@ func (suite *BackupBasesUnitSuite) TestFixupAndVerify() {
|
|||||||
res := validMail1()
|
res := validMail1()
|
||||||
res.backups = append(
|
res.backups = append(
|
||||||
res.backups,
|
res.backups,
|
||||||
BackupEntry{
|
backup.BackupEntry{
|
||||||
Backup: &backup.Backup{
|
Backup: &backup.Backup{
|
||||||
BaseModel: model.BaseModel{
|
BaseModel: model.BaseModel{
|
||||||
ID: "bid4",
|
ID: "bid4",
|
||||||
@ -818,7 +827,7 @@ func (suite *BackupBasesUnitSuite) TestFixupAndVerify() {
|
|||||||
res := validMail1()
|
res := validMail1()
|
||||||
res.assistBackups = append(
|
res.assistBackups = append(
|
||||||
res.assistBackups,
|
res.assistBackups,
|
||||||
BackupEntry{
|
backup.BackupEntry{
|
||||||
Backup: &backup.Backup{
|
Backup: &backup.Backup{
|
||||||
BaseModel: model.BaseModel{
|
BaseModel: model.BaseModel{
|
||||||
ID: "bid3",
|
ID: "bid3",
|
||||||
@ -826,7 +835,7 @@ func (suite *BackupBasesUnitSuite) TestFixupAndVerify() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
BackupEntry{
|
backup.BackupEntry{
|
||||||
Backup: &backup.Backup{
|
Backup: &backup.Backup{
|
||||||
BaseModel: model.BaseModel{
|
BaseModel: model.BaseModel{
|
||||||
ID: "bid4",
|
ID: "bid4",
|
||||||
@ -847,7 +856,7 @@ func (suite *BackupBasesUnitSuite) TestFixupAndVerify() {
|
|||||||
res := validMail1()
|
res := validMail1()
|
||||||
res.assistBackups = append(
|
res.assistBackups = append(
|
||||||
res.assistBackups,
|
res.assistBackups,
|
||||||
BackupEntry{
|
backup.BackupEntry{
|
||||||
Backup: &backup.Backup{
|
Backup: &backup.Backup{
|
||||||
BaseModel: model.BaseModel{
|
BaseModel: model.BaseModel{
|
||||||
ID: "bid4",
|
ID: "bid4",
|
||||||
|
|||||||
@ -86,7 +86,7 @@ func normalizeTagKVs(tags map[string]string) map[string]string {
|
|||||||
t2 := make(map[string]string, len(tags))
|
t2 := make(map[string]string, len(tags))
|
||||||
|
|
||||||
for k, v := range tags {
|
for k, v := range tags {
|
||||||
mk, mv := makeTagKV(k)
|
mk, mv := backup.MakeTagKV(k)
|
||||||
|
|
||||||
if len(v) == 0 {
|
if len(v) == 0 {
|
||||||
v = mv
|
v = mv
|
||||||
@ -125,7 +125,7 @@ func (b *baseFinder) getBackupModel(
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
man *snapshot.Manifest,
|
man *snapshot.Manifest,
|
||||||
) (*backup.Backup, error) {
|
) (*backup.Backup, error) {
|
||||||
k, _ := makeTagKV(TagBackupID)
|
k, _ := backup.MakeTagKV(TagBackupID)
|
||||||
bID := man.Tags[k]
|
bID := man.Tags[k]
|
||||||
|
|
||||||
ctx = clues.Add(ctx, "search_backup_id", bID)
|
ctx = clues.Add(ctx, "search_backup_id", bID)
|
||||||
@ -333,7 +333,7 @@ func (b *baseFinder) FindBases(
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
reasons []identity.Reasoner,
|
reasons []identity.Reasoner,
|
||||||
tags map[string]string,
|
tags map[string]string,
|
||||||
) BackupBases {
|
) backup.BackupBases {
|
||||||
var (
|
var (
|
||||||
// Backup models and item data snapshot manifests are 1:1 for bases so just
|
// Backup models and item data snapshot manifests are 1:1 for bases so just
|
||||||
// track things by the backup ID. We need to track by ID so we can coalesce
|
// track things by the backup ID. We need to track by ID so we can coalesce
|
||||||
@ -384,16 +384,16 @@ func (b *baseFinder) FindBases(
|
|||||||
// Convert what we got to the format that backupBases takes right now.
|
// Convert what we got to the format that backupBases takes right now.
|
||||||
// TODO(ashmrtn): Remove when backupBases has consolidated fields.
|
// TODO(ashmrtn): Remove when backupBases has consolidated fields.
|
||||||
res := &backupBases{}
|
res := &backupBases{}
|
||||||
bups := make([]BackupEntry, 0, len(mergeBases))
|
bups := make([]backup.BackupEntry, 0, len(mergeBases))
|
||||||
snaps := make([]ManifestEntry, 0, len(mergeBases))
|
snaps := make([]backup.ManifestEntry, 0, len(mergeBases))
|
||||||
|
|
||||||
for _, base := range mergeBases {
|
for _, base := range mergeBases {
|
||||||
bups = append(bups, BackupEntry{
|
bups = append(bups, backup.BackupEntry{
|
||||||
Backup: base.Backup,
|
Backup: base.Backup,
|
||||||
Reasons: base.Reasons,
|
Reasons: base.Reasons,
|
||||||
})
|
})
|
||||||
|
|
||||||
snaps = append(snaps, ManifestEntry{
|
snaps = append(snaps, backup.ManifestEntry{
|
||||||
Manifest: base.ItemDataSnapshot,
|
Manifest: base.ItemDataSnapshot,
|
||||||
Reasons: base.Reasons,
|
Reasons: base.Reasons,
|
||||||
})
|
})
|
||||||
@ -402,16 +402,16 @@ func (b *baseFinder) FindBases(
|
|||||||
res.backups = bups
|
res.backups = bups
|
||||||
res.mergeBases = snaps
|
res.mergeBases = snaps
|
||||||
|
|
||||||
bups = make([]BackupEntry, 0, len(assistBases))
|
bups = make([]backup.BackupEntry, 0, len(assistBases))
|
||||||
snaps = make([]ManifestEntry, 0, len(assistBases))
|
snaps = make([]backup.ManifestEntry, 0, len(assistBases))
|
||||||
|
|
||||||
for _, base := range assistBases {
|
for _, base := range assistBases {
|
||||||
bups = append(bups, BackupEntry{
|
bups = append(bups, backup.BackupEntry{
|
||||||
Backup: base.Backup,
|
Backup: base.Backup,
|
||||||
Reasons: base.Reasons,
|
Reasons: base.Reasons,
|
||||||
})
|
})
|
||||||
|
|
||||||
snaps = append(snaps, ManifestEntry{
|
snaps = append(snaps, backup.ManifestEntry{
|
||||||
Manifest: base.ItemDataSnapshot,
|
Manifest: base.ItemDataSnapshot,
|
||||||
Reasons: base.Reasons,
|
Reasons: base.Reasons,
|
||||||
})
|
})
|
||||||
|
|||||||
@ -121,7 +121,7 @@ func newManifestInfo(
|
|||||||
structTags := make(map[string]string, len(tags))
|
structTags := make(map[string]string, len(tags))
|
||||||
|
|
||||||
for _, t := range tags {
|
for _, t := range tags {
|
||||||
tk, _ := makeTagKV(t)
|
tk, _ := backup.MakeTagKV(t)
|
||||||
structTags[tk] = ""
|
structTags[tk] = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ func newManifestInfo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(backupID) > 0 {
|
if len(backupID) > 0 {
|
||||||
k, _ := makeTagKV(TagBackupID)
|
k, _ := backup.MakeTagKV(TagBackupID)
|
||||||
res.metadata.Labels[k] = backupID
|
res.metadata.Labels[k] = backupID
|
||||||
res.man.Tags[k] = backupID
|
res.man.Tags[k] = backupID
|
||||||
}
|
}
|
||||||
@ -1078,7 +1078,7 @@ func (suite *BaseFinderUnitSuite) TestFindBases_CustomTags() {
|
|||||||
|
|
||||||
func checkManifestEntriesMatch(
|
func checkManifestEntriesMatch(
|
||||||
t *testing.T,
|
t *testing.T,
|
||||||
retSnaps []ManifestEntry,
|
retSnaps []backup.ManifestEntry,
|
||||||
allExpected []manifestInfo,
|
allExpected []manifestInfo,
|
||||||
expectedIdxsAndReasons map[int][]identity.Reasoner,
|
expectedIdxsAndReasons map[int][]identity.Reasoner,
|
||||||
) {
|
) {
|
||||||
@ -1119,7 +1119,7 @@ func checkManifestEntriesMatch(
|
|||||||
|
|
||||||
func checkBackupEntriesMatch(
|
func checkBackupEntriesMatch(
|
||||||
t *testing.T,
|
t *testing.T,
|
||||||
retBups []BackupEntry,
|
retBups []backup.BackupEntry,
|
||||||
allExpected []backupInfo,
|
allExpected []backupInfo,
|
||||||
expectedIdxsAndReasons map[int][]identity.Reasoner,
|
expectedIdxsAndReasons map[int][]identity.Reasoner,
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -99,7 +99,7 @@ func cleanupOrphanedData(
|
|||||||
|
|
||||||
toDelete[snap.ID] = struct{}{}
|
toDelete[snap.ID] = struct{}{}
|
||||||
|
|
||||||
k, _ := makeTagKV(TagBackupCategory)
|
k, _ := backup.MakeTagKV(TagBackupCategory)
|
||||||
if _, ok := snap.Labels[k]; ok {
|
if _, ok := snap.Labels[k]; ok {
|
||||||
dataSnaps[snap.ID] = snap
|
dataSnaps[snap.ID] = snap
|
||||||
continue
|
continue
|
||||||
@ -315,7 +315,7 @@ func transferTags(snap *manifest.EntryMetadata, bup *backup.Backup) error {
|
|||||||
skipTags := map[string]struct{}{}
|
skipTags := map[string]struct{}{}
|
||||||
|
|
||||||
for _, k := range skipKeys {
|
for _, k := range skipKeys {
|
||||||
key, _ := makeTagKV(k)
|
key, _ := backup.MakeTagKV(k)
|
||||||
skipTags[key] = struct{}{}
|
skipTags[key] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,7 +324,7 @@ func transferTags(snap *manifest.EntryMetadata, bup *backup.Backup) error {
|
|||||||
// backups.
|
// backups.
|
||||||
roid := bup.ProtectedResourceID
|
roid := bup.ProtectedResourceID
|
||||||
|
|
||||||
roidK, _ := makeTagKV(roid)
|
roidK, _ := backup.MakeTagKV(roid)
|
||||||
skipTags[roidK] = struct{}{}
|
skipTags[roidK] = struct{}{}
|
||||||
|
|
||||||
// This is hacky, but right now we don't have a good way to get only the
|
// This is hacky, but right now we don't have a good way to get only the
|
||||||
@ -336,11 +336,11 @@ func transferTags(snap *manifest.EntryMetadata, bup *backup.Backup) error {
|
|||||||
// Convert them to the newer format that we'd like to have where the
|
// Convert them to the newer format that we'd like to have where the
|
||||||
// service/category tags have the form "sc-<service><category>".
|
// service/category tags have the form "sc-<service><category>".
|
||||||
for tag := range snap.Labels {
|
for tag := range snap.Labels {
|
||||||
if _, ok := skipTags[tag]; ok || !strings.HasPrefix(tag, userTagPrefix) {
|
if _, ok := skipTags[tag]; ok || !strings.HasPrefix(tag, backup.LegacyUserTagPrefix) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
bup.Tags[strings.Replace(tag, userTagPrefix, serviceCatTagPrefix, 1)] = "0"
|
bup.Tags[strings.Replace(tag, backup.LegacyUserTagPrefix, serviceCatTagPrefix, 1)] = "0"
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -136,7 +136,7 @@ type backupRes struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (suite *BackupCleanupUnitSuite) TestCleanupOrphanedData() {
|
func (suite *BackupCleanupUnitSuite) TestCleanupOrphanedData() {
|
||||||
backupTag, _ := makeTagKV(TagBackupCategory)
|
backupTag, _ := backup.MakeTagKV(TagBackupCategory)
|
||||||
|
|
||||||
// Current backup and snapshots.
|
// Current backup and snapshots.
|
||||||
bupCurrent := func() *backup.Backup {
|
bupCurrent := func() *backup.Backup {
|
||||||
@ -331,13 +331,13 @@ func (suite *BackupCleanupUnitSuite) TestCleanupOrphanedData() {
|
|||||||
// Add the given reasons.
|
// Add the given reasons.
|
||||||
for _, r := range reasons {
|
for _, r := range reasons {
|
||||||
for _, k := range tagKeys(r) {
|
for _, k := range tagKeys(r) {
|
||||||
key, _ := makeTagKV(k)
|
key, _ := backup.MakeTagKV(k)
|
||||||
res.Labels[key] = "0"
|
res.Labels[key] = "0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also add other common reasons on item data snapshots.
|
// Also add other common reasons on item data snapshots.
|
||||||
k, _ := makeTagKV(TagBackupCategory)
|
k, _ := backup.MakeTagKV(TagBackupCategory)
|
||||||
res.Labels[k] = "0"
|
res.Labels[k] = "0"
|
||||||
|
|
||||||
return &res
|
return &res
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/common/prefixmatcher"
|
"github.com/alcionai/corso/src/internal/common/prefixmatcher"
|
||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
"github.com/alcionai/corso/src/internal/kopia"
|
"github.com/alcionai/corso/src/internal/kopia"
|
||||||
|
"github.com/alcionai/corso/src/pkg/backup"
|
||||||
"github.com/alcionai/corso/src/pkg/backup/details"
|
"github.com/alcionai/corso/src/pkg/backup/details"
|
||||||
"github.com/alcionai/corso/src/pkg/backup/identity"
|
"github.com/alcionai/corso/src/pkg/backup/identity"
|
||||||
"github.com/alcionai/corso/src/pkg/fault"
|
"github.com/alcionai/corso/src/pkg/fault"
|
||||||
@ -17,7 +18,7 @@ type (
|
|||||||
ConsumeBackupCollections(
|
ConsumeBackupCollections(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
backupReasons []identity.Reasoner,
|
backupReasons []identity.Reasoner,
|
||||||
bases kopia.BackupBases,
|
bases backup.BackupBases,
|
||||||
cs []data.BackupCollection,
|
cs []data.BackupCollection,
|
||||||
pmr prefixmatcher.StringSetReader,
|
pmr prefixmatcher.StringSetReader,
|
||||||
tags map[string]string,
|
tags map[string]string,
|
||||||
@ -41,6 +42,6 @@ type (
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
reasons []identity.Reasoner,
|
reasons []identity.Reasoner,
|
||||||
tags map[string]string,
|
tags map[string]string,
|
||||||
) kopia.BackupBases
|
) backup.BackupBases
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@ -4,9 +4,13 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
|
"github.com/alcionai/corso/src/pkg/backup"
|
||||||
)
|
)
|
||||||
|
|
||||||
func AssertBackupBasesEqual(t *testing.T, expect, got BackupBases) {
|
var _ backup.BackupBases = &MockBackupBases{}
|
||||||
|
|
||||||
|
func AssertBackupBasesEqual(t *testing.T, expect, got backup.BackupBases) {
|
||||||
if expect == nil && got == nil {
|
if expect == nil && got == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -48,22 +52,22 @@ type MockBackupBases struct {
|
|||||||
*backupBases
|
*backupBases
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bb *MockBackupBases) WithBackups(b ...BackupEntry) *MockBackupBases {
|
func (bb *MockBackupBases) WithBackups(b ...backup.BackupEntry) *MockBackupBases {
|
||||||
bb.backupBases.backups = append(bb.Backups(), b...)
|
bb.backupBases.backups = append(bb.Backups(), b...)
|
||||||
return bb
|
return bb
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bb *MockBackupBases) WithMergeBases(m ...ManifestEntry) *MockBackupBases {
|
func (bb *MockBackupBases) WithMergeBases(m ...backup.ManifestEntry) *MockBackupBases {
|
||||||
bb.backupBases.mergeBases = append(bb.MergeBases(), m...)
|
bb.backupBases.mergeBases = append(bb.MergeBases(), m...)
|
||||||
return bb
|
return bb
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bb *MockBackupBases) WithAssistBackups(b ...BackupEntry) *MockBackupBases {
|
func (bb *MockBackupBases) WithAssistBackups(b ...backup.BackupEntry) *MockBackupBases {
|
||||||
bb.backupBases.assistBackups = append(bb.UniqueAssistBackups(), b...)
|
bb.backupBases.assistBackups = append(bb.UniqueAssistBackups(), b...)
|
||||||
return bb
|
return bb
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bb *MockBackupBases) WithAssistBases(m ...ManifestEntry) *MockBackupBases {
|
func (bb *MockBackupBases) WithAssistBases(m ...backup.ManifestEntry) *MockBackupBases {
|
||||||
bb.backupBases.assistBases = append(bb.UniqueAssistBases(), m...)
|
bb.backupBases.assistBases = append(bb.UniqueAssistBases(), m...)
|
||||||
return bb
|
return bb
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/diagnostics"
|
"github.com/alcionai/corso/src/internal/diagnostics"
|
||||||
"github.com/alcionai/corso/src/internal/m365/graph"
|
"github.com/alcionai/corso/src/internal/m365/graph"
|
||||||
"github.com/alcionai/corso/src/internal/m365/graph/metadata"
|
"github.com/alcionai/corso/src/internal/m365/graph/metadata"
|
||||||
|
"github.com/alcionai/corso/src/pkg/backup"
|
||||||
"github.com/alcionai/corso/src/pkg/backup/details"
|
"github.com/alcionai/corso/src/pkg/backup/details"
|
||||||
"github.com/alcionai/corso/src/pkg/count"
|
"github.com/alcionai/corso/src/pkg/count"
|
||||||
"github.com/alcionai/corso/src/pkg/fault"
|
"github.com/alcionai/corso/src/pkg/fault"
|
||||||
@ -1039,7 +1040,7 @@ func traverseBaseDir(
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func logBaseInfo(ctx context.Context, m ManifestEntry) {
|
func logBaseInfo(ctx context.Context, m backup.ManifestEntry) {
|
||||||
svcs := map[string]struct{}{}
|
svcs := map[string]struct{}{}
|
||||||
cats := map[string]struct{}{}
|
cats := map[string]struct{}{}
|
||||||
|
|
||||||
@ -1085,7 +1086,7 @@ const (
|
|||||||
func inflateBaseTree(
|
func inflateBaseTree(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
loader snapshotLoader,
|
loader snapshotLoader,
|
||||||
snap ManifestEntry,
|
snap backup.ManifestEntry,
|
||||||
updatedPaths map[string]path.Path,
|
updatedPaths map[string]path.Path,
|
||||||
roots map[string]*treeMap,
|
roots map[string]*treeMap,
|
||||||
) error {
|
) error {
|
||||||
@ -1196,7 +1197,7 @@ func inflateBaseTree(
|
|||||||
func inflateDirTree(
|
func inflateDirTree(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
loader snapshotLoader,
|
loader snapshotLoader,
|
||||||
baseSnaps []ManifestEntry,
|
baseSnaps []backup.ManifestEntry,
|
||||||
collections []data.BackupCollection,
|
collections []data.BackupCollection,
|
||||||
globalExcludeSet prefixmatcher.StringSetReader,
|
globalExcludeSet prefixmatcher.StringSetReader,
|
||||||
progress *corsoProgress,
|
progress *corsoProgress,
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
exchMock "github.com/alcionai/corso/src/internal/m365/service/exchange/mock"
|
exchMock "github.com/alcionai/corso/src/internal/m365/service/exchange/mock"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
|
"github.com/alcionai/corso/src/pkg/backup"
|
||||||
"github.com/alcionai/corso/src/pkg/backup/details"
|
"github.com/alcionai/corso/src/pkg/backup/details"
|
||||||
"github.com/alcionai/corso/src/pkg/backup/identity"
|
"github.com/alcionai/corso/src/pkg/backup/identity"
|
||||||
"github.com/alcionai/corso/src/pkg/fault"
|
"github.com/alcionai/corso/src/pkg/fault"
|
||||||
@ -879,14 +880,14 @@ func makeManifestEntry(
|
|||||||
id, tenant, resourceOwner string,
|
id, tenant, resourceOwner string,
|
||||||
service path.ServiceType,
|
service path.ServiceType,
|
||||||
categories ...path.CategoryType,
|
categories ...path.CategoryType,
|
||||||
) ManifestEntry {
|
) backup.ManifestEntry {
|
||||||
var reasons []identity.Reasoner
|
var reasons []identity.Reasoner
|
||||||
|
|
||||||
for _, c := range categories {
|
for _, c := range categories {
|
||||||
reasons = append(reasons, NewReason(tenant, resourceOwner, service, c))
|
reasons = append(reasons, NewReason(tenant, resourceOwner, service, c))
|
||||||
}
|
}
|
||||||
|
|
||||||
return ManifestEntry{
|
return backup.ManifestEntry{
|
||||||
Manifest: &snapshot.Manifest{
|
Manifest: &snapshot.Manifest{
|
||||||
ID: manifest.ID(id),
|
ID: manifest.ID(id),
|
||||||
},
|
},
|
||||||
@ -1198,7 +1199,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSingleSubtree() {
|
|||||||
dirTree, err := inflateDirTree(
|
dirTree, err := inflateDirTree(
|
||||||
ctx,
|
ctx,
|
||||||
msw,
|
msw,
|
||||||
[]ManifestEntry{
|
[]backup.ManifestEntry{
|
||||||
makeManifestEntry("", testTenant, testUser, path.ExchangeService, path.EmailCategory),
|
makeManifestEntry("", testTenant, testUser, path.ExchangeService, path.EmailCategory),
|
||||||
},
|
},
|
||||||
test.inputCollections(),
|
test.inputCollections(),
|
||||||
@ -1913,7 +1914,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto
|
|||||||
dirTree, err := inflateDirTree(
|
dirTree, err := inflateDirTree(
|
||||||
ctx,
|
ctx,
|
||||||
msw,
|
msw,
|
||||||
[]ManifestEntry{
|
[]backup.ManifestEntry{
|
||||||
makeManifestEntry("", testTenant, testUser, path.ExchangeService, path.EmailCategory),
|
makeManifestEntry("", testTenant, testUser, path.ExchangeService, path.EmailCategory),
|
||||||
},
|
},
|
||||||
test.inputCollections(t),
|
test.inputCollections(t),
|
||||||
@ -2057,7 +2058,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSkipsDeletedSubtre
|
|||||||
dirTree, err := inflateDirTree(
|
dirTree, err := inflateDirTree(
|
||||||
ctx,
|
ctx,
|
||||||
msw,
|
msw,
|
||||||
[]ManifestEntry{
|
[]backup.ManifestEntry{
|
||||||
makeManifestEntry("", testTenant, testUser, path.ExchangeService, path.EmailCategory),
|
makeManifestEntry("", testTenant, testUser, path.ExchangeService, path.EmailCategory),
|
||||||
},
|
},
|
||||||
collections,
|
collections,
|
||||||
@ -2157,7 +2158,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTree_HandleEmptyBase()
|
|||||||
dirTree, err := inflateDirTree(
|
dirTree, err := inflateDirTree(
|
||||||
ctx,
|
ctx,
|
||||||
msw,
|
msw,
|
||||||
[]ManifestEntry{
|
[]backup.ManifestEntry{
|
||||||
makeManifestEntry("", testTenant, testUser, path.ExchangeService, path.EmailCategory),
|
makeManifestEntry("", testTenant, testUser, path.ExchangeService, path.EmailCategory),
|
||||||
},
|
},
|
||||||
collections,
|
collections,
|
||||||
@ -2373,7 +2374,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSelectsCorrectSubt
|
|||||||
dirTree, err := inflateDirTree(
|
dirTree, err := inflateDirTree(
|
||||||
ctx,
|
ctx,
|
||||||
msw,
|
msw,
|
||||||
[]ManifestEntry{
|
[]backup.ManifestEntry{
|
||||||
makeManifestEntry("id1", testTenant, testUser, path.ExchangeService, path.ContactsCategory),
|
makeManifestEntry("id1", testTenant, testUser, path.ExchangeService, path.ContactsCategory),
|
||||||
makeManifestEntry("id2", testTenant, testUser, path.ExchangeService, path.EmailCategory),
|
makeManifestEntry("id2", testTenant, testUser, path.ExchangeService, path.EmailCategory),
|
||||||
},
|
},
|
||||||
@ -2526,7 +2527,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSelectsMigrateSubt
|
|||||||
dirTree, err := inflateDirTree(
|
dirTree, err := inflateDirTree(
|
||||||
ctx,
|
ctx,
|
||||||
msw,
|
msw,
|
||||||
[]ManifestEntry{
|
[]backup.ManifestEntry{
|
||||||
makeManifestEntry("id1", testTenant, testUser, path.ExchangeService, path.EmailCategory, path.ContactsCategory),
|
makeManifestEntry("id1", testTenant, testUser, path.ExchangeService, path.EmailCategory, path.ContactsCategory),
|
||||||
},
|
},
|
||||||
[]data.BackupCollection{mce, mcc},
|
[]data.BackupCollection{mce, mcc},
|
||||||
@ -3451,7 +3452,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTree_SelectiveSubtreeP
|
|||||||
dirTree, err := inflateDirTree(
|
dirTree, err := inflateDirTree(
|
||||||
ctx,
|
ctx,
|
||||||
msw,
|
msw,
|
||||||
[]ManifestEntry{
|
[]backup.ManifestEntry{
|
||||||
makeManifestEntry("", tenant, user, path.OneDriveService, path.FilesCategory),
|
makeManifestEntry("", tenant, user, path.OneDriveService, path.FilesCategory),
|
||||||
},
|
},
|
||||||
test.inputCollections(t),
|
test.inputCollections(t),
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/diagnostics"
|
"github.com/alcionai/corso/src/internal/diagnostics"
|
||||||
"github.com/alcionai/corso/src/internal/observe"
|
"github.com/alcionai/corso/src/internal/observe"
|
||||||
"github.com/alcionai/corso/src/internal/stats"
|
"github.com/alcionai/corso/src/internal/stats"
|
||||||
|
"github.com/alcionai/corso/src/pkg/backup"
|
||||||
"github.com/alcionai/corso/src/pkg/backup/details"
|
"github.com/alcionai/corso/src/pkg/backup/details"
|
||||||
"github.com/alcionai/corso/src/pkg/backup/identity"
|
"github.com/alcionai/corso/src/pkg/backup/identity"
|
||||||
"github.com/alcionai/corso/src/pkg/control/repository"
|
"github.com/alcionai/corso/src/pkg/control/repository"
|
||||||
@ -139,7 +140,7 @@ func (w *Wrapper) Close(ctx context.Context) error {
|
|||||||
func (w Wrapper) ConsumeBackupCollections(
|
func (w Wrapper) ConsumeBackupCollections(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
backupReasons []identity.Reasoner,
|
backupReasons []identity.Reasoner,
|
||||||
bases BackupBases,
|
bases backup.BackupBases,
|
||||||
collections []data.BackupCollection,
|
collections []data.BackupCollection,
|
||||||
globalExcludeSet prefixmatcher.StringSetReader,
|
globalExcludeSet prefixmatcher.StringSetReader,
|
||||||
additionalTags map[string]string,
|
additionalTags map[string]string,
|
||||||
@ -169,8 +170,8 @@ func (w Wrapper) ConsumeBackupCollections(
|
|||||||
// snapshot bases into inflateDirTree so that the new snapshot
|
// snapshot bases into inflateDirTree so that the new snapshot
|
||||||
// includes historical data.
|
// includes historical data.
|
||||||
var (
|
var (
|
||||||
mergeBase []ManifestEntry
|
mergeBase []backup.ManifestEntry
|
||||||
assistBase []ManifestEntry
|
assistBase []backup.ManifestEntry
|
||||||
)
|
)
|
||||||
|
|
||||||
if bases != nil {
|
if bases != nil {
|
||||||
@ -220,7 +221,7 @@ func (w Wrapper) ConsumeBackupCollections(
|
|||||||
|
|
||||||
func (w Wrapper) makeSnapshotWithRoot(
|
func (w Wrapper) makeSnapshotWithRoot(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
prevSnapEntries []ManifestEntry,
|
prevSnapEntries []backup.ManifestEntry,
|
||||||
root fs.Directory,
|
root fs.Directory,
|
||||||
addlTags map[string]string,
|
addlTags map[string]string,
|
||||||
progress *corsoProgress,
|
progress *corsoProgress,
|
||||||
@ -253,7 +254,7 @@ func (w Wrapper) makeSnapshotWithRoot(
|
|||||||
tags := map[string]string{}
|
tags := map[string]string{}
|
||||||
|
|
||||||
for k, v := range addlTags {
|
for k, v := range addlTags {
|
||||||
mk, mv := makeTagKV(k)
|
mk, mv := backup.MakeTagKV(k)
|
||||||
|
|
||||||
if len(v) == 0 {
|
if len(v) == 0 {
|
||||||
v = mv
|
v = mv
|
||||||
|
|||||||
@ -28,6 +28,7 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/m365/collection/drive/metadata"
|
"github.com/alcionai/corso/src/internal/m365/collection/drive/metadata"
|
||||||
exchMock "github.com/alcionai/corso/src/internal/m365/service/exchange/mock"
|
exchMock "github.com/alcionai/corso/src/internal/m365/service/exchange/mock"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
|
"github.com/alcionai/corso/src/pkg/backup"
|
||||||
"github.com/alcionai/corso/src/pkg/backup/details"
|
"github.com/alcionai/corso/src/pkg/backup/details"
|
||||||
"github.com/alcionai/corso/src/pkg/backup/identity"
|
"github.com/alcionai/corso/src/pkg/backup/identity"
|
||||||
"github.com/alcionai/corso/src/pkg/control/repository"
|
"github.com/alcionai/corso/src/pkg/control/repository"
|
||||||
@ -837,7 +838,7 @@ func (suite *KopiaIntegrationSuite) TestBackupCollections() {
|
|||||||
|
|
||||||
type testCase struct {
|
type testCase struct {
|
||||||
name string
|
name string
|
||||||
baseBackups func(base ManifestEntry) BackupBases
|
baseBackups func(base backup.ManifestEntry) backup.BackupBases
|
||||||
collections []data.BackupCollection
|
collections []data.BackupCollection
|
||||||
expectedUploadedFiles int
|
expectedUploadedFiles int
|
||||||
expectedCachedFiles int
|
expectedCachedFiles int
|
||||||
@ -862,7 +863,7 @@ func (suite *KopiaIntegrationSuite) TestBackupCollections() {
|
|||||||
// Initial backup. All files should be considered new by kopia.
|
// Initial backup. All files should be considered new by kopia.
|
||||||
baseBackupCase := testCase{
|
baseBackupCase := testCase{
|
||||||
name: "Uncached",
|
name: "Uncached",
|
||||||
baseBackups: func(ManifestEntry) BackupBases {
|
baseBackups: func(backup.ManifestEntry) backup.BackupBases {
|
||||||
return NewMockBackupBases()
|
return NewMockBackupBases()
|
||||||
},
|
},
|
||||||
collections: collections,
|
collections: collections,
|
||||||
@ -873,8 +874,8 @@ func (suite *KopiaIntegrationSuite) TestBackupCollections() {
|
|||||||
uploadedBytes: []int64{8000, 10000},
|
uploadedBytes: []int64{8000, 10000},
|
||||||
}
|
}
|
||||||
|
|
||||||
runAndTestBackup := func(test testCase, base ManifestEntry) ManifestEntry {
|
runAndTestBackup := func(test testCase, base backup.ManifestEntry) backup.ManifestEntry {
|
||||||
var res ManifestEntry
|
var res backup.ManifestEntry
|
||||||
|
|
||||||
suite.Run(test.name, func() {
|
suite.Run(test.name, func() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
@ -945,7 +946,7 @@ func (suite *KopiaIntegrationSuite) TestBackupCollections() {
|
|||||||
manifest.ID(stats.SnapshotID))
|
manifest.ID(stats.SnapshotID))
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
res = ManifestEntry{
|
res = backup.ManifestEntry{
|
||||||
Manifest: snap,
|
Manifest: snap,
|
||||||
Reasons: reasons,
|
Reasons: reasons,
|
||||||
}
|
}
|
||||||
@ -954,12 +955,12 @@ func (suite *KopiaIntegrationSuite) TestBackupCollections() {
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
base := runAndTestBackup(baseBackupCase, ManifestEntry{})
|
base := runAndTestBackup(baseBackupCase, backup.ManifestEntry{})
|
||||||
|
|
||||||
table := []testCase{
|
table := []testCase{
|
||||||
{
|
{
|
||||||
name: "Kopia Assist And Merge All Files Changed",
|
name: "Kopia Assist And Merge All Files Changed",
|
||||||
baseBackups: func(base ManifestEntry) BackupBases {
|
baseBackups: func(base backup.ManifestEntry) backup.BackupBases {
|
||||||
return NewMockBackupBases().WithMergeBases(base)
|
return NewMockBackupBases().WithMergeBases(base)
|
||||||
},
|
},
|
||||||
collections: collections,
|
collections: collections,
|
||||||
@ -973,7 +974,7 @@ func (suite *KopiaIntegrationSuite) TestBackupCollections() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Kopia Assist And Merge No Files Changed",
|
name: "Kopia Assist And Merge No Files Changed",
|
||||||
baseBackups: func(base ManifestEntry) BackupBases {
|
baseBackups: func(base backup.ManifestEntry) backup.BackupBases {
|
||||||
return NewMockBackupBases().WithMergeBases(base)
|
return NewMockBackupBases().WithMergeBases(base)
|
||||||
},
|
},
|
||||||
// Pass in empty collections to force a backup. Otherwise we'll skip
|
// Pass in empty collections to force a backup. Otherwise we'll skip
|
||||||
@ -995,7 +996,7 @@ func (suite *KopiaIntegrationSuite) TestBackupCollections() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Kopia Assist Only",
|
name: "Kopia Assist Only",
|
||||||
baseBackups: func(base ManifestEntry) BackupBases {
|
baseBackups: func(base backup.ManifestEntry) backup.BackupBases {
|
||||||
return NewMockBackupBases().WithAssistBases(base)
|
return NewMockBackupBases().WithAssistBases(base)
|
||||||
},
|
},
|
||||||
collections: collections,
|
collections: collections,
|
||||||
@ -1008,7 +1009,7 @@ func (suite *KopiaIntegrationSuite) TestBackupCollections() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Merge Only",
|
name: "Merge Only",
|
||||||
baseBackups: func(base ManifestEntry) BackupBases {
|
baseBackups: func(base backup.ManifestEntry) backup.BackupBases {
|
||||||
return NewMockBackupBases().WithMergeBases(base).MockDisableAssistBases()
|
return NewMockBackupBases().WithMergeBases(base).MockDisableAssistBases()
|
||||||
},
|
},
|
||||||
// Pass in empty collections to force a backup. Otherwise we'll skip
|
// Pass in empty collections to force a backup. Otherwise we'll skip
|
||||||
@ -1028,7 +1029,7 @@ func (suite *KopiaIntegrationSuite) TestBackupCollections() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Content Hash Only",
|
name: "Content Hash Only",
|
||||||
baseBackups: func(base ManifestEntry) BackupBases {
|
baseBackups: func(base backup.ManifestEntry) backup.BackupBases {
|
||||||
return NewMockBackupBases()
|
return NewMockBackupBases()
|
||||||
},
|
},
|
||||||
collections: collections,
|
collections: collections,
|
||||||
@ -1231,7 +1232,7 @@ func (suite *KopiaIntegrationSuite) TestBackupCollections_NoDetailsForMeta() {
|
|||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
prevSnaps.WithMergeBases(
|
prevSnaps.WithMergeBases(
|
||||||
ManifestEntry{
|
backup.ManifestEntry{
|
||||||
Manifest: snap,
|
Manifest: snap,
|
||||||
Reasons: reasons,
|
Reasons: reasons,
|
||||||
})
|
})
|
||||||
@ -1719,7 +1720,7 @@ func (suite *KopiaSimpleRepoIntegrationSuite) TestBackupExcludeItem() {
|
|||||||
suite.ctx,
|
suite.ctx,
|
||||||
[]identity.Reasoner{r},
|
[]identity.Reasoner{r},
|
||||||
NewMockBackupBases().WithMergeBases(
|
NewMockBackupBases().WithMergeBases(
|
||||||
ManifestEntry{
|
backup.ManifestEntry{
|
||||||
Manifest: man,
|
Manifest: man,
|
||||||
Reasons: []identity.Reasoner{r},
|
Reasons: []identity.Reasoner{r},
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/common/prefixmatcher"
|
"github.com/alcionai/corso/src/internal/common/prefixmatcher"
|
||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
"github.com/alcionai/corso/src/internal/diagnostics"
|
"github.com/alcionai/corso/src/internal/diagnostics"
|
||||||
"github.com/alcionai/corso/src/internal/kopia"
|
|
||||||
kinject "github.com/alcionai/corso/src/internal/kopia/inject"
|
kinject "github.com/alcionai/corso/src/internal/kopia/inject"
|
||||||
"github.com/alcionai/corso/src/internal/m365/graph"
|
"github.com/alcionai/corso/src/internal/m365/graph"
|
||||||
"github.com/alcionai/corso/src/internal/m365/service/exchange"
|
"github.com/alcionai/corso/src/internal/m365/service/exchange"
|
||||||
@ -16,6 +15,7 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/m365/service/onedrive"
|
"github.com/alcionai/corso/src/internal/m365/service/onedrive"
|
||||||
"github.com/alcionai/corso/src/internal/m365/service/sharepoint"
|
"github.com/alcionai/corso/src/internal/m365/service/sharepoint"
|
||||||
"github.com/alcionai/corso/src/internal/operations/inject"
|
"github.com/alcionai/corso/src/internal/operations/inject"
|
||||||
|
"github.com/alcionai/corso/src/pkg/backup"
|
||||||
bupMD "github.com/alcionai/corso/src/pkg/backup/metadata"
|
bupMD "github.com/alcionai/corso/src/pkg/backup/metadata"
|
||||||
"github.com/alcionai/corso/src/pkg/fault"
|
"github.com/alcionai/corso/src/pkg/fault"
|
||||||
"github.com/alcionai/corso/src/pkg/filters"
|
"github.com/alcionai/corso/src/pkg/filters"
|
||||||
@ -176,7 +176,7 @@ func verifyBackupInputs(sels selectors.Selector, cachedIDs []string) error {
|
|||||||
func (ctrl *Controller) GetMetadataPaths(
|
func (ctrl *Controller) GetMetadataPaths(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
r kinject.RestoreProducer,
|
r kinject.RestoreProducer,
|
||||||
man kopia.ManifestEntry,
|
man backup.ManifestEntry,
|
||||||
errs *fault.Bus,
|
errs *fault.Bus,
|
||||||
) ([]path.RestorePaths, error) {
|
) ([]path.RestorePaths, error) {
|
||||||
var (
|
var (
|
||||||
|
|||||||
@ -8,9 +8,9 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/common/idname"
|
"github.com/alcionai/corso/src/internal/common/idname"
|
||||||
"github.com/alcionai/corso/src/internal/common/prefixmatcher"
|
"github.com/alcionai/corso/src/internal/common/prefixmatcher"
|
||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
"github.com/alcionai/corso/src/internal/kopia"
|
|
||||||
kinject "github.com/alcionai/corso/src/internal/kopia/inject"
|
kinject "github.com/alcionai/corso/src/internal/kopia/inject"
|
||||||
"github.com/alcionai/corso/src/internal/operations/inject"
|
"github.com/alcionai/corso/src/internal/operations/inject"
|
||||||
|
"github.com/alcionai/corso/src/pkg/backup"
|
||||||
"github.com/alcionai/corso/src/pkg/backup/details"
|
"github.com/alcionai/corso/src/pkg/backup/details"
|
||||||
"github.com/alcionai/corso/src/pkg/control"
|
"github.com/alcionai/corso/src/pkg/control"
|
||||||
"github.com/alcionai/corso/src/pkg/count"
|
"github.com/alcionai/corso/src/pkg/count"
|
||||||
@ -53,7 +53,7 @@ func (ctrl Controller) ProduceBackupCollections(
|
|||||||
func (ctrl *Controller) GetMetadataPaths(
|
func (ctrl *Controller) GetMetadataPaths(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
r kinject.RestoreProducer,
|
r kinject.RestoreProducer,
|
||||||
man kopia.ManifestEntry,
|
man backup.ManifestEntry,
|
||||||
errs *fault.Bus,
|
errs *fault.Bus,
|
||||||
) ([]path.RestorePaths, error) {
|
) ([]path.RestorePaths, error) {
|
||||||
return nil, clues.New("not implemented")
|
return nil, clues.New("not implemented")
|
||||||
|
|||||||
@ -494,7 +494,7 @@ func consumeBackupCollections(
|
|||||||
bc kinject.BackupConsumer,
|
bc kinject.BackupConsumer,
|
||||||
tenantID string,
|
tenantID string,
|
||||||
reasons []identity.Reasoner,
|
reasons []identity.Reasoner,
|
||||||
bbs kopia.BackupBases,
|
bbs backup.BackupBases,
|
||||||
cs []data.BackupCollection,
|
cs []data.BackupCollection,
|
||||||
pmr prefixmatcher.StringSetReader,
|
pmr prefixmatcher.StringSetReader,
|
||||||
backupID model.StableID,
|
backupID model.StableID,
|
||||||
@ -598,7 +598,7 @@ func getNewPathRefs(
|
|||||||
func mergeItemsFromBase(
|
func mergeItemsFromBase(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
checkReason bool,
|
checkReason bool,
|
||||||
baseBackup kopia.BackupEntry,
|
baseBackup backup.BackupEntry,
|
||||||
detailsStore streamstore.Streamer,
|
detailsStore streamstore.Streamer,
|
||||||
dataFromBackup kopia.DetailsMergeInfoer,
|
dataFromBackup kopia.DetailsMergeInfoer,
|
||||||
deets *details.Builder,
|
deets *details.Builder,
|
||||||
@ -702,7 +702,7 @@ func mergeItemsFromBase(
|
|||||||
func mergeDetails(
|
func mergeDetails(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
detailsStore streamstore.Streamer,
|
detailsStore streamstore.Streamer,
|
||||||
bases kopia.BackupBases,
|
bases backup.BackupBases,
|
||||||
dataFromBackup kopia.DetailsMergeInfoer,
|
dataFromBackup kopia.DetailsMergeInfoer,
|
||||||
deets *details.Builder,
|
deets *details.Builder,
|
||||||
writeStats *kopia.BackupStats,
|
writeStats *kopia.BackupStats,
|
||||||
@ -843,6 +843,7 @@ func (op *BackupOperation) persistResults(
|
|||||||
func (op *BackupOperation) createBackupModels(
|
func (op *BackupOperation) createBackupModels(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
sscw streamstore.CollectorWriter,
|
sscw streamstore.CollectorWriter,
|
||||||
|
bases backup.BackupBases,
|
||||||
opStats backupStats,
|
opStats backupStats,
|
||||||
backupID model.StableID,
|
backupID model.StableID,
|
||||||
backupVersion int,
|
backupVersion int,
|
||||||
|
|||||||
@ -121,7 +121,7 @@ func checkPaths(t *testing.T, expected, got []path.Path) {
|
|||||||
type mockBackupConsumer struct {
|
type mockBackupConsumer struct {
|
||||||
checkFunc func(
|
checkFunc func(
|
||||||
backupReasons []identity.Reasoner,
|
backupReasons []identity.Reasoner,
|
||||||
bases kopia.BackupBases,
|
bases backup.BackupBases,
|
||||||
cs []data.BackupCollection,
|
cs []data.BackupCollection,
|
||||||
tags map[string]string,
|
tags map[string]string,
|
||||||
buildTreeWithBase bool)
|
buildTreeWithBase bool)
|
||||||
@ -130,7 +130,7 @@ type mockBackupConsumer struct {
|
|||||||
func (mbu mockBackupConsumer) ConsumeBackupCollections(
|
func (mbu mockBackupConsumer) ConsumeBackupCollections(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
backupReasons []identity.Reasoner,
|
backupReasons []identity.Reasoner,
|
||||||
bases kopia.BackupBases,
|
bases backup.BackupBases,
|
||||||
cs []data.BackupCollection,
|
cs []data.BackupCollection,
|
||||||
excluded prefixmatcher.StringSetReader,
|
excluded prefixmatcher.StringSetReader,
|
||||||
tags map[string]string,
|
tags map[string]string,
|
||||||
@ -477,13 +477,13 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_ConsumeBackupDataCollections
|
|||||||
}
|
}
|
||||||
|
|
||||||
bases = kopia.NewMockBackupBases().WithMergeBases(
|
bases = kopia.NewMockBackupBases().WithMergeBases(
|
||||||
kopia.ManifestEntry{
|
backup.ManifestEntry{
|
||||||
Manifest: manifest1,
|
Manifest: manifest1,
|
||||||
Reasons: []identity.Reasoner{
|
Reasons: []identity.Reasoner{
|
||||||
emailReason,
|
emailReason,
|
||||||
},
|
},
|
||||||
}).WithAssistBases(
|
}).WithAssistBases(
|
||||||
kopia.ManifestEntry{
|
backup.ManifestEntry{
|
||||||
Manifest: manifest2,
|
Manifest: manifest2,
|
||||||
Reasons: []identity.Reasoner{
|
Reasons: []identity.Reasoner{
|
||||||
contactsReason,
|
contactsReason,
|
||||||
@ -500,7 +500,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_ConsumeBackupDataCollections
|
|||||||
mbu := &mockBackupConsumer{
|
mbu := &mockBackupConsumer{
|
||||||
checkFunc: func(
|
checkFunc: func(
|
||||||
backupReasons []identity.Reasoner,
|
backupReasons []identity.Reasoner,
|
||||||
gotBases kopia.BackupBases,
|
gotBases backup.BackupBases,
|
||||||
cs []data.BackupCollection,
|
cs []data.BackupCollection,
|
||||||
gotTags map[string]string,
|
gotTags map[string]string,
|
||||||
buildTreeWithBase bool,
|
buildTreeWithBase bool,
|
||||||
@ -631,8 +631,8 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
table := []struct {
|
table := []struct {
|
||||||
name string
|
name string
|
||||||
populatedDetails map[string]*details.Details
|
populatedDetails map[string]*details.Details
|
||||||
inputBackups []kopia.BackupEntry
|
inputBackups []backup.BackupEntry
|
||||||
inputAssistBackups []kopia.BackupEntry
|
inputAssistBackups []backup.BackupEntry
|
||||||
mdm *mockDetailsMergeInfoer
|
mdm *mockDetailsMergeInfoer
|
||||||
|
|
||||||
errCheck assert.ErrorAssertionFunc
|
errCheck assert.ErrorAssertionFunc
|
||||||
@ -659,7 +659,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
}(),
|
}(),
|
||||||
inputBackups: []kopia.BackupEntry{
|
inputBackups: []backup.BackupEntry{
|
||||||
{
|
{
|
||||||
Backup: &backup.Backup{
|
Backup: &backup.Backup{
|
||||||
BaseModel: model.BaseModel{
|
BaseModel: model.BaseModel{
|
||||||
@ -683,7 +683,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
}(),
|
}(),
|
||||||
inputBackups: []kopia.BackupEntry{
|
inputBackups: []backup.BackupEntry{
|
||||||
{
|
{
|
||||||
Backup: &backup1,
|
Backup: &backup1,
|
||||||
Reasons: []identity.Reasoner{
|
Reasons: []identity.Reasoner{
|
||||||
@ -710,7 +710,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
}(),
|
}(),
|
||||||
inputBackups: []kopia.BackupEntry{
|
inputBackups: []backup.BackupEntry{
|
||||||
{
|
{
|
||||||
Backup: &backup1,
|
Backup: &backup1,
|
||||||
Reasons: []identity.Reasoner{
|
Reasons: []identity.Reasoner{
|
||||||
@ -766,7 +766,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
}(),
|
}(),
|
||||||
inputBackups: []kopia.BackupEntry{
|
inputBackups: []backup.BackupEntry{
|
||||||
{
|
{
|
||||||
Backup: &backup1,
|
Backup: &backup1,
|
||||||
Reasons: []identity.Reasoner{
|
Reasons: []identity.Reasoner{
|
||||||
@ -793,7 +793,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
}(),
|
}(),
|
||||||
inputBackups: []kopia.BackupEntry{
|
inputBackups: []backup.BackupEntry{
|
||||||
{
|
{
|
||||||
Backup: &backup1,
|
Backup: &backup1,
|
||||||
Reasons: []identity.Reasoner{
|
Reasons: []identity.Reasoner{
|
||||||
@ -823,7 +823,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
}(),
|
}(),
|
||||||
inputBackups: []kopia.BackupEntry{
|
inputBackups: []backup.BackupEntry{
|
||||||
{
|
{
|
||||||
Backup: &backup1,
|
Backup: &backup1,
|
||||||
Reasons: []identity.Reasoner{
|
Reasons: []identity.Reasoner{
|
||||||
@ -853,7 +853,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
}(),
|
}(),
|
||||||
inputBackups: []kopia.BackupEntry{
|
inputBackups: []backup.BackupEntry{
|
||||||
{
|
{
|
||||||
Backup: &backup1,
|
Backup: &backup1,
|
||||||
Reasons: []identity.Reasoner{
|
Reasons: []identity.Reasoner{
|
||||||
@ -883,7 +883,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
}(),
|
}(),
|
||||||
inputBackups: []kopia.BackupEntry{
|
inputBackups: []backup.BackupEntry{
|
||||||
{
|
{
|
||||||
Backup: &backup1,
|
Backup: &backup1,
|
||||||
Reasons: []identity.Reasoner{
|
Reasons: []identity.Reasoner{
|
||||||
@ -914,7 +914,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
}(),
|
}(),
|
||||||
inputBackups: []kopia.BackupEntry{
|
inputBackups: []backup.BackupEntry{
|
||||||
{
|
{
|
||||||
Backup: &backup1,
|
Backup: &backup1,
|
||||||
Reasons: []identity.Reasoner{
|
Reasons: []identity.Reasoner{
|
||||||
@ -945,7 +945,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
}(),
|
}(),
|
||||||
inputBackups: []kopia.BackupEntry{
|
inputBackups: []backup.BackupEntry{
|
||||||
{
|
{
|
||||||
Backup: &backup1,
|
Backup: &backup1,
|
||||||
Reasons: []identity.Reasoner{
|
Reasons: []identity.Reasoner{
|
||||||
@ -993,7 +993,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
}(),
|
}(),
|
||||||
inputBackups: []kopia.BackupEntry{
|
inputBackups: []backup.BackupEntry{
|
||||||
{
|
{
|
||||||
Backup: &backup1,
|
Backup: &backup1,
|
||||||
Reasons: []identity.Reasoner{
|
Reasons: []identity.Reasoner{
|
||||||
@ -1002,7 +1002,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
inputAssistBackups: []kopia.BackupEntry{
|
inputAssistBackups: []backup.BackupEntry{
|
||||||
{Backup: &backup2},
|
{Backup: &backup2},
|
||||||
},
|
},
|
||||||
populatedDetails: map[string]*details.Details{
|
populatedDetails: map[string]*details.Details{
|
||||||
@ -1037,7 +1037,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
}(),
|
}(),
|
||||||
inputBackups: []kopia.BackupEntry{
|
inputBackups: []backup.BackupEntry{
|
||||||
{
|
{
|
||||||
Backup: &backup1,
|
Backup: &backup1,
|
||||||
Reasons: []identity.Reasoner{
|
Reasons: []identity.Reasoner{
|
||||||
@ -1045,7 +1045,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
inputAssistBackups: []kopia.BackupEntry{
|
inputAssistBackups: []backup.BackupEntry{
|
||||||
{Backup: &backup2},
|
{Backup: &backup2},
|
||||||
},
|
},
|
||||||
populatedDetails: map[string]*details.Details{
|
populatedDetails: map[string]*details.Details{
|
||||||
@ -1077,7 +1077,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
}(),
|
}(),
|
||||||
inputAssistBackups: []kopia.BackupEntry{
|
inputAssistBackups: []backup.BackupEntry{
|
||||||
{Backup: &backup1},
|
{Backup: &backup1},
|
||||||
{Backup: &backup2},
|
{Backup: &backup2},
|
||||||
},
|
},
|
||||||
@ -1110,7 +1110,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
}(),
|
}(),
|
||||||
inputAssistBackups: []kopia.BackupEntry{
|
inputAssistBackups: []backup.BackupEntry{
|
||||||
{Backup: &backup1},
|
{Backup: &backup1},
|
||||||
{Backup: &backup2},
|
{Backup: &backup2},
|
||||||
},
|
},
|
||||||
@ -1143,7 +1143,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
}(),
|
}(),
|
||||||
inputAssistBackups: []kopia.BackupEntry{
|
inputAssistBackups: []backup.BackupEntry{
|
||||||
{Backup: &backup1},
|
{Backup: &backup1},
|
||||||
{Backup: &backup2},
|
{Backup: &backup2},
|
||||||
},
|
},
|
||||||
@ -1173,7 +1173,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
mdm: func() *mockDetailsMergeInfoer {
|
mdm: func() *mockDetailsMergeInfoer {
|
||||||
return newMockDetailsMergeInfoer()
|
return newMockDetailsMergeInfoer()
|
||||||
}(),
|
}(),
|
||||||
inputAssistBackups: []kopia.BackupEntry{
|
inputAssistBackups: []backup.BackupEntry{
|
||||||
{Backup: &backup1},
|
{Backup: &backup1},
|
||||||
},
|
},
|
||||||
populatedDetails: map[string]*details.Details{
|
populatedDetails: map[string]*details.Details{
|
||||||
@ -1273,7 +1273,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsFolde
|
|||||||
itemPath1.Service(),
|
itemPath1.Service(),
|
||||||
itemPath1.Category())
|
itemPath1.Category())
|
||||||
|
|
||||||
backup1 = kopia.BackupEntry{
|
backup1 = backup.BackupEntry{
|
||||||
Backup: &backup.Backup{
|
Backup: &backup.Backup{
|
||||||
BaseModel: model.BaseModel{
|
BaseModel: model.BaseModel{
|
||||||
ID: "bid1",
|
ID: "bid1",
|
||||||
|
|||||||
@ -6,8 +6,8 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/common/idname"
|
"github.com/alcionai/corso/src/internal/common/idname"
|
||||||
"github.com/alcionai/corso/src/internal/common/prefixmatcher"
|
"github.com/alcionai/corso/src/internal/common/prefixmatcher"
|
||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
"github.com/alcionai/corso/src/internal/kopia"
|
|
||||||
"github.com/alcionai/corso/src/internal/kopia/inject"
|
"github.com/alcionai/corso/src/internal/kopia/inject"
|
||||||
|
"github.com/alcionai/corso/src/pkg/backup"
|
||||||
"github.com/alcionai/corso/src/pkg/backup/details"
|
"github.com/alcionai/corso/src/pkg/backup/details"
|
||||||
"github.com/alcionai/corso/src/pkg/control"
|
"github.com/alcionai/corso/src/pkg/control"
|
||||||
"github.com/alcionai/corso/src/pkg/control/repository"
|
"github.com/alcionai/corso/src/pkg/control/repository"
|
||||||
@ -37,7 +37,7 @@ type (
|
|||||||
GetMetadataPaths(
|
GetMetadataPaths(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
r inject.RestoreProducer,
|
r inject.RestoreProducer,
|
||||||
man kopia.ManifestEntry,
|
man backup.ManifestEntry,
|
||||||
errs *fault.Bus,
|
errs *fault.Bus,
|
||||||
) ([]path.RestorePaths, error)
|
) ([]path.RestorePaths, error)
|
||||||
|
|
||||||
|
|||||||
@ -7,10 +7,10 @@ import (
|
|||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common/prefixmatcher"
|
"github.com/alcionai/corso/src/internal/common/prefixmatcher"
|
||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
"github.com/alcionai/corso/src/internal/kopia"
|
|
||||||
kinject "github.com/alcionai/corso/src/internal/kopia/inject"
|
kinject "github.com/alcionai/corso/src/internal/kopia/inject"
|
||||||
"github.com/alcionai/corso/src/internal/m365"
|
"github.com/alcionai/corso/src/internal/m365"
|
||||||
"github.com/alcionai/corso/src/internal/operations/inject"
|
"github.com/alcionai/corso/src/internal/operations/inject"
|
||||||
|
"github.com/alcionai/corso/src/pkg/backup"
|
||||||
"github.com/alcionai/corso/src/pkg/fault"
|
"github.com/alcionai/corso/src/pkg/fault"
|
||||||
"github.com/alcionai/corso/src/pkg/path"
|
"github.com/alcionai/corso/src/pkg/path"
|
||||||
)
|
)
|
||||||
@ -62,7 +62,7 @@ func (mbp *mockBackupProducer) Wait() *data.CollectionStats {
|
|||||||
func (mbp mockBackupProducer) GetMetadataPaths(
|
func (mbp mockBackupProducer) GetMetadataPaths(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
r kinject.RestoreProducer,
|
r kinject.RestoreProducer,
|
||||||
man kopia.ManifestEntry,
|
man backup.ManifestEntry,
|
||||||
errs *fault.Bus,
|
errs *fault.Bus,
|
||||||
) ([]path.RestorePaths, error) {
|
) ([]path.RestorePaths, error) {
|
||||||
ctrl := m365.Controller{}
|
ctrl := m365.Controller{}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/kopia"
|
"github.com/alcionai/corso/src/internal/kopia"
|
||||||
"github.com/alcionai/corso/src/internal/kopia/inject"
|
"github.com/alcionai/corso/src/internal/kopia/inject"
|
||||||
oinject "github.com/alcionai/corso/src/internal/operations/inject"
|
oinject "github.com/alcionai/corso/src/internal/operations/inject"
|
||||||
|
"github.com/alcionai/corso/src/pkg/backup"
|
||||||
"github.com/alcionai/corso/src/pkg/backup/identity"
|
"github.com/alcionai/corso/src/pkg/backup/identity"
|
||||||
"github.com/alcionai/corso/src/pkg/fault"
|
"github.com/alcionai/corso/src/pkg/fault"
|
||||||
"github.com/alcionai/corso/src/pkg/logger"
|
"github.com/alcionai/corso/src/pkg/logger"
|
||||||
@ -23,7 +24,7 @@ func produceManifestsAndMetadata(
|
|||||||
reasons, fallbackReasons []identity.Reasoner,
|
reasons, fallbackReasons []identity.Reasoner,
|
||||||
tenantID string,
|
tenantID string,
|
||||||
getMetadata, dropAssistBases bool,
|
getMetadata, dropAssistBases bool,
|
||||||
) (kopia.BackupBases, []data.RestoreCollection, bool, error) {
|
) (backup.BackupBases, []data.RestoreCollection, bool, error) {
|
||||||
bb, meta, useMergeBases, err := getManifestsAndMetadata(
|
bb, meta, useMergeBases, err := getManifestsAndMetadata(
|
||||||
ctx,
|
ctx,
|
||||||
bf,
|
bf,
|
||||||
@ -62,7 +63,7 @@ func getManifestsAndMetadata(
|
|||||||
reasons, fallbackReasons []identity.Reasoner,
|
reasons, fallbackReasons []identity.Reasoner,
|
||||||
tenantID string,
|
tenantID string,
|
||||||
getMetadata bool,
|
getMetadata bool,
|
||||||
) (kopia.BackupBases, []data.RestoreCollection, bool, error) {
|
) (backup.BackupBases, []data.RestoreCollection, bool, error) {
|
||||||
var (
|
var (
|
||||||
tags = map[string]string{kopia.TagBackupCategory: ""}
|
tags = map[string]string{kopia.TagBackupCategory: ""}
|
||||||
collections []data.RestoreCollection
|
collections []data.RestoreCollection
|
||||||
|
|||||||
@ -50,14 +50,14 @@ type mockBackupFinder struct {
|
|||||||
// beyond that and results are returned for the union of the reasons anyway.
|
// beyond that and results are returned for the union of the reasons anyway.
|
||||||
// This does assume that the return data is properly constructed to return a
|
// This does assume that the return data is properly constructed to return a
|
||||||
// union of the reasons etc.
|
// union of the reasons etc.
|
||||||
data map[string]kopia.BackupBases
|
data map[string]backup.BackupBases
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bf *mockBackupFinder) FindBases(
|
func (bf *mockBackupFinder) FindBases(
|
||||||
_ context.Context,
|
_ context.Context,
|
||||||
reasons []identity.Reasoner,
|
reasons []identity.Reasoner,
|
||||||
_ map[string]string,
|
_ map[string]string,
|
||||||
) kopia.BackupBases {
|
) backup.BackupBases {
|
||||||
if len(reasons) == 0 {
|
if len(reasons) == 0 {
|
||||||
return kopia.NewMockBackupBases()
|
return kopia.NewMockBackupBases()
|
||||||
}
|
}
|
||||||
@ -290,7 +290,7 @@ func (suite *OperationsManifestsUnitSuite) TestGetMetadataPaths() {
|
|||||||
mr := mockRestoreProducer{err: test.expectErr, colls: test.preFetchCollection}
|
mr := mockRestoreProducer{err: test.expectErr, colls: test.preFetchCollection}
|
||||||
mr.buildRestoreFunc(t, test.manID, paths)
|
mr.buildRestoreFunc(t, test.manID, paths)
|
||||||
|
|
||||||
man := kopia.ManifestEntry{
|
man := backup.ManifestEntry{
|
||||||
Manifest: &snapshot.Manifest{ID: manifest.ID(test.manID)},
|
Manifest: &snapshot.Manifest{ID: manifest.ID(test.manID)},
|
||||||
Reasons: test.reasons,
|
Reasons: test.reasons,
|
||||||
}
|
}
|
||||||
@ -327,8 +327,8 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata() {
|
|||||||
did = "detailsid"
|
did = "detailsid"
|
||||||
)
|
)
|
||||||
|
|
||||||
makeMan := func(id, incmpl string, cats ...path.CategoryType) kopia.ManifestEntry {
|
makeMan := func(id, incmpl string, cats ...path.CategoryType) backup.ManifestEntry {
|
||||||
return kopia.ManifestEntry{
|
return backup.ManifestEntry{
|
||||||
Manifest: &snapshot.Manifest{
|
Manifest: &snapshot.Manifest{
|
||||||
ID: manifest.ID(id),
|
ID: manifest.ID(id),
|
||||||
IncompleteReason: incmpl,
|
IncompleteReason: incmpl,
|
||||||
@ -337,8 +337,8 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
makeBackup := func(snapID string, cats ...path.CategoryType) kopia.BackupEntry {
|
makeBackup := func(snapID string, cats ...path.CategoryType) backup.BackupEntry {
|
||||||
return kopia.BackupEntry{
|
return backup.BackupEntry{
|
||||||
Backup: &backup.Backup{
|
Backup: &backup.Backup{
|
||||||
BaseModel: model.BaseModel{
|
BaseModel: model.BaseModel{
|
||||||
ID: model.StableID(snapID + "bup"),
|
ID: model.StableID(snapID + "bup"),
|
||||||
@ -361,7 +361,7 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata() {
|
|||||||
assertB assert.BoolAssertionFunc
|
assertB assert.BoolAssertionFunc
|
||||||
expectDCS []mockColl
|
expectDCS []mockColl
|
||||||
expectPaths func(t *testing.T, gotPaths []path.Path)
|
expectPaths func(t *testing.T, gotPaths []path.Path)
|
||||||
expectMans kopia.BackupBases
|
expectMans backup.BackupBases
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "don't get metadata, no mans",
|
name: "don't get metadata, no mans",
|
||||||
@ -376,7 +376,7 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata() {
|
|||||||
{
|
{
|
||||||
name: "don't get metadata",
|
name: "don't get metadata",
|
||||||
bf: &mockBackupFinder{
|
bf: &mockBackupFinder{
|
||||||
data: map[string]kopia.BackupBases{
|
data: map[string]backup.BackupBases{
|
||||||
ro: kopia.NewMockBackupBases().
|
ro: kopia.NewMockBackupBases().
|
||||||
WithMergeBases(makeMan("id1", "", path.EmailCategory)).
|
WithMergeBases(makeMan("id1", "", path.EmailCategory)).
|
||||||
WithBackups(makeBackup("id1", path.EmailCategory)),
|
WithBackups(makeBackup("id1", path.EmailCategory)),
|
||||||
@ -398,7 +398,7 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata() {
|
|||||||
{
|
{
|
||||||
name: "don't get metadata, incomplete manifest",
|
name: "don't get metadata, incomplete manifest",
|
||||||
bf: &mockBackupFinder{
|
bf: &mockBackupFinder{
|
||||||
data: map[string]kopia.BackupBases{
|
data: map[string]backup.BackupBases{
|
||||||
ro: kopia.NewMockBackupBases().WithAssistBases(
|
ro: kopia.NewMockBackupBases().WithAssistBases(
|
||||||
makeMan("id1", "checkpoint", path.EmailCategory)),
|
makeMan("id1", "checkpoint", path.EmailCategory)),
|
||||||
},
|
},
|
||||||
@ -420,7 +420,7 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata() {
|
|||||||
{
|
{
|
||||||
name: "one valid man, multiple reasons",
|
name: "one valid man, multiple reasons",
|
||||||
bf: &mockBackupFinder{
|
bf: &mockBackupFinder{
|
||||||
data: map[string]kopia.BackupBases{
|
data: map[string]backup.BackupBases{
|
||||||
ro: kopia.NewMockBackupBases().WithMergeBases(
|
ro: kopia.NewMockBackupBases().WithMergeBases(
|
||||||
makeMan("id1", "", path.EmailCategory, path.ContactsCategory)),
|
makeMan("id1", "", path.EmailCategory, path.ContactsCategory)),
|
||||||
},
|
},
|
||||||
@ -462,7 +462,7 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata() {
|
|||||||
{
|
{
|
||||||
name: "one valid man, extra incomplete man",
|
name: "one valid man, extra incomplete man",
|
||||||
bf: &mockBackupFinder{
|
bf: &mockBackupFinder{
|
||||||
data: map[string]kopia.BackupBases{
|
data: map[string]backup.BackupBases{
|
||||||
ro: kopia.NewMockBackupBases().
|
ro: kopia.NewMockBackupBases().
|
||||||
WithMergeBases(makeMan("id1", "", path.EmailCategory)).
|
WithMergeBases(makeMan("id1", "", path.EmailCategory)).
|
||||||
WithAssistBases(makeMan("id2", "checkpoint", path.EmailCategory)),
|
WithAssistBases(makeMan("id2", "checkpoint", path.EmailCategory)),
|
||||||
@ -488,7 +488,7 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata() {
|
|||||||
{
|
{
|
||||||
name: "one valid man, extra incomplete man, drop assist bases",
|
name: "one valid man, extra incomplete man, drop assist bases",
|
||||||
bf: &mockBackupFinder{
|
bf: &mockBackupFinder{
|
||||||
data: map[string]kopia.BackupBases{
|
data: map[string]backup.BackupBases{
|
||||||
ro: kopia.NewMockBackupBases().
|
ro: kopia.NewMockBackupBases().
|
||||||
WithMergeBases(makeMan("id1", "", path.EmailCategory)).
|
WithMergeBases(makeMan("id1", "", path.EmailCategory)).
|
||||||
WithAssistBases(makeMan("id2", "checkpoint", path.EmailCategory)),
|
WithAssistBases(makeMan("id2", "checkpoint", path.EmailCategory)),
|
||||||
@ -515,7 +515,7 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata() {
|
|||||||
{
|
{
|
||||||
name: "multiple valid mans",
|
name: "multiple valid mans",
|
||||||
bf: &mockBackupFinder{
|
bf: &mockBackupFinder{
|
||||||
data: map[string]kopia.BackupBases{
|
data: map[string]backup.BackupBases{
|
||||||
ro: kopia.NewMockBackupBases().WithMergeBases(
|
ro: kopia.NewMockBackupBases().WithMergeBases(
|
||||||
makeMan("id1", "", path.EmailCategory),
|
makeMan("id1", "", path.EmailCategory),
|
||||||
makeMan("id2", "", path.EmailCategory)),
|
makeMan("id2", "", path.EmailCategory)),
|
||||||
@ -541,7 +541,7 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata() {
|
|||||||
{
|
{
|
||||||
name: "error collecting metadata",
|
name: "error collecting metadata",
|
||||||
bf: &mockBackupFinder{
|
bf: &mockBackupFinder{
|
||||||
data: map[string]kopia.BackupBases{
|
data: map[string]backup.BackupBases{
|
||||||
ro: kopia.NewMockBackupBases().
|
ro: kopia.NewMockBackupBases().
|
||||||
WithMergeBases(makeMan("id1", "", path.EmailCategory)),
|
WithMergeBases(makeMan("id1", "", path.EmailCategory)),
|
||||||
},
|
},
|
||||||
@ -628,8 +628,8 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata_Fallb
|
|||||||
did = "detailsid"
|
did = "detailsid"
|
||||||
)
|
)
|
||||||
|
|
||||||
makeMan := func(ro, id, incmpl string, cats ...path.CategoryType) kopia.ManifestEntry {
|
makeMan := func(ro, id, incmpl string, cats ...path.CategoryType) backup.ManifestEntry {
|
||||||
return kopia.ManifestEntry{
|
return backup.ManifestEntry{
|
||||||
Manifest: &snapshot.Manifest{
|
Manifest: &snapshot.Manifest{
|
||||||
ID: manifest.ID(id),
|
ID: manifest.ID(id),
|
||||||
IncompleteReason: incmpl,
|
IncompleteReason: incmpl,
|
||||||
@ -639,8 +639,8 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata_Fallb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
makeBackup := func(ro, snapID string, cats ...path.CategoryType) kopia.BackupEntry {
|
makeBackup := func(ro, snapID string, cats ...path.CategoryType) backup.BackupEntry {
|
||||||
return kopia.BackupEntry{
|
return backup.BackupEntry{
|
||||||
Backup: &backup.Backup{
|
Backup: &backup.Backup{
|
||||||
BaseModel: model.BaseModel{
|
BaseModel: model.BaseModel{
|
||||||
ID: model.StableID(snapID + "bup"),
|
ID: model.StableID(snapID + "bup"),
|
||||||
@ -675,12 +675,12 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata_Fallb
|
|||||||
assertErr assert.ErrorAssertionFunc
|
assertErr assert.ErrorAssertionFunc
|
||||||
assertB assert.BoolAssertionFunc
|
assertB assert.BoolAssertionFunc
|
||||||
expectDCS []mockColl
|
expectDCS []mockColl
|
||||||
expectMans kopia.BackupBases
|
expectMans backup.BackupBases
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "don't get metadata, only fallbacks",
|
name: "don't get metadata, only fallbacks",
|
||||||
bf: &mockBackupFinder{
|
bf: &mockBackupFinder{
|
||||||
data: map[string]kopia.BackupBases{
|
data: map[string]backup.BackupBases{
|
||||||
fbro: kopia.NewMockBackupBases().
|
fbro: kopia.NewMockBackupBases().
|
||||||
WithMergeBases(makeMan(fbro, "fb_id1", "", path.EmailCategory)).
|
WithMergeBases(makeMan(fbro, "fb_id1", "", path.EmailCategory)).
|
||||||
WithBackups(makeBackup(fbro, "fb_id1", path.EmailCategory)),
|
WithBackups(makeBackup(fbro, "fb_id1", path.EmailCategory)),
|
||||||
@ -700,7 +700,7 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata_Fallb
|
|||||||
{
|
{
|
||||||
name: "only fallbacks",
|
name: "only fallbacks",
|
||||||
bf: &mockBackupFinder{
|
bf: &mockBackupFinder{
|
||||||
data: map[string]kopia.BackupBases{
|
data: map[string]backup.BackupBases{
|
||||||
fbro: kopia.NewMockBackupBases().WithMergeBases(
|
fbro: kopia.NewMockBackupBases().WithMergeBases(
|
||||||
makeMan(fbro, "fb_id1", "", path.EmailCategory)).WithBackups(
|
makeMan(fbro, "fb_id1", "", path.EmailCategory)).WithBackups(
|
||||||
makeBackup(fbro, "fb_id1", path.EmailCategory)),
|
makeBackup(fbro, "fb_id1", path.EmailCategory)),
|
||||||
@ -723,7 +723,7 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata_Fallb
|
|||||||
{
|
{
|
||||||
name: "only fallbacks, drop assist",
|
name: "only fallbacks, drop assist",
|
||||||
bf: &mockBackupFinder{
|
bf: &mockBackupFinder{
|
||||||
data: map[string]kopia.BackupBases{
|
data: map[string]backup.BackupBases{
|
||||||
fbro: kopia.NewMockBackupBases().
|
fbro: kopia.NewMockBackupBases().
|
||||||
WithMergeBases(makeMan(fbro, "fb_id1", "", path.EmailCategory)).
|
WithMergeBases(makeMan(fbro, "fb_id1", "", path.EmailCategory)).
|
||||||
WithBackups(makeBackup(fbro, "fb_id1", path.EmailCategory)),
|
WithBackups(makeBackup(fbro, "fb_id1", path.EmailCategory)),
|
||||||
@ -748,7 +748,7 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata_Fallb
|
|||||||
{
|
{
|
||||||
name: "complete mans and fallbacks",
|
name: "complete mans and fallbacks",
|
||||||
bf: &mockBackupFinder{
|
bf: &mockBackupFinder{
|
||||||
data: map[string]kopia.BackupBases{
|
data: map[string]backup.BackupBases{
|
||||||
ro: kopia.NewMockBackupBases().
|
ro: kopia.NewMockBackupBases().
|
||||||
WithMergeBases(makeMan(ro, "id1", "", path.EmailCategory)),
|
WithMergeBases(makeMan(ro, "id1", "", path.EmailCategory)),
|
||||||
fbro: kopia.NewMockBackupBases().
|
fbro: kopia.NewMockBackupBases().
|
||||||
@ -774,7 +774,7 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata_Fallb
|
|||||||
{
|
{
|
||||||
name: "incomplete mans and fallbacks",
|
name: "incomplete mans and fallbacks",
|
||||||
bf: &mockBackupFinder{
|
bf: &mockBackupFinder{
|
||||||
data: map[string]kopia.BackupBases{
|
data: map[string]backup.BackupBases{
|
||||||
ro: kopia.NewMockBackupBases().WithAssistBases(
|
ro: kopia.NewMockBackupBases().WithAssistBases(
|
||||||
makeMan(ro, "id2", "checkpoint", path.EmailCategory)),
|
makeMan(ro, "id2", "checkpoint", path.EmailCategory)),
|
||||||
fbro: kopia.NewMockBackupBases().WithAssistBases(
|
fbro: kopia.NewMockBackupBases().WithAssistBases(
|
||||||
@ -799,7 +799,7 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata_Fallb
|
|||||||
{
|
{
|
||||||
name: "complete and incomplete mans and fallbacks",
|
name: "complete and incomplete mans and fallbacks",
|
||||||
bf: &mockBackupFinder{
|
bf: &mockBackupFinder{
|
||||||
data: map[string]kopia.BackupBases{
|
data: map[string]backup.BackupBases{
|
||||||
ro: kopia.NewMockBackupBases().
|
ro: kopia.NewMockBackupBases().
|
||||||
WithMergeBases(makeMan(ro, "id1", "", path.EmailCategory)).
|
WithMergeBases(makeMan(ro, "id1", "", path.EmailCategory)).
|
||||||
WithAssistBases(makeMan(ro, "id2", "checkpoint", path.EmailCategory)),
|
WithAssistBases(makeMan(ro, "id2", "checkpoint", path.EmailCategory)),
|
||||||
@ -830,7 +830,7 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata_Fallb
|
|||||||
{
|
{
|
||||||
name: "incomplete mans and complete fallbacks",
|
name: "incomplete mans and complete fallbacks",
|
||||||
bf: &mockBackupFinder{
|
bf: &mockBackupFinder{
|
||||||
data: map[string]kopia.BackupBases{
|
data: map[string]backup.BackupBases{
|
||||||
ro: kopia.NewMockBackupBases().WithAssistBases(
|
ro: kopia.NewMockBackupBases().WithAssistBases(
|
||||||
makeMan(ro, "id2", "checkpoint", path.EmailCategory)),
|
makeMan(ro, "id2", "checkpoint", path.EmailCategory)),
|
||||||
fbro: kopia.NewMockBackupBases().
|
fbro: kopia.NewMockBackupBases().
|
||||||
@ -858,7 +858,7 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata_Fallb
|
|||||||
{
|
{
|
||||||
name: "incomplete mans and complete fallbacks, no assist bases",
|
name: "incomplete mans and complete fallbacks, no assist bases",
|
||||||
bf: &mockBackupFinder{
|
bf: &mockBackupFinder{
|
||||||
data: map[string]kopia.BackupBases{
|
data: map[string]backup.BackupBases{
|
||||||
ro: kopia.NewMockBackupBases().WithAssistBases(
|
ro: kopia.NewMockBackupBases().WithAssistBases(
|
||||||
makeMan(ro, "id2", "checkpoint", path.EmailCategory)),
|
makeMan(ro, "id2", "checkpoint", path.EmailCategory)),
|
||||||
fbro: kopia.NewMockBackupBases().
|
fbro: kopia.NewMockBackupBases().
|
||||||
@ -887,7 +887,7 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata_Fallb
|
|||||||
{
|
{
|
||||||
name: "complete mans and incomplete fallbacks",
|
name: "complete mans and incomplete fallbacks",
|
||||||
bf: &mockBackupFinder{
|
bf: &mockBackupFinder{
|
||||||
data: map[string]kopia.BackupBases{
|
data: map[string]backup.BackupBases{
|
||||||
ro: kopia.NewMockBackupBases().WithMergeBases(
|
ro: kopia.NewMockBackupBases().WithMergeBases(
|
||||||
makeMan(ro, "id1", "", path.EmailCategory)),
|
makeMan(ro, "id1", "", path.EmailCategory)),
|
||||||
fbro: kopia.NewMockBackupBases().WithAssistBases(
|
fbro: kopia.NewMockBackupBases().WithAssistBases(
|
||||||
@ -912,7 +912,7 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata_Fallb
|
|||||||
{
|
{
|
||||||
name: "complete mans and complete fallbacks, multiple reasons",
|
name: "complete mans and complete fallbacks, multiple reasons",
|
||||||
bf: &mockBackupFinder{
|
bf: &mockBackupFinder{
|
||||||
data: map[string]kopia.BackupBases{
|
data: map[string]backup.BackupBases{
|
||||||
ro: kopia.NewMockBackupBases().WithMergeBases(
|
ro: kopia.NewMockBackupBases().WithMergeBases(
|
||||||
makeMan(ro, "id1", "", path.EmailCategory, path.ContactsCategory)),
|
makeMan(ro, "id1", "", path.EmailCategory, path.ContactsCategory)),
|
||||||
fbro: kopia.NewMockBackupBases().
|
fbro: kopia.NewMockBackupBases().
|
||||||
@ -944,7 +944,7 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata_Fallb
|
|||||||
{
|
{
|
||||||
name: "complete mans and complete fallbacks, distinct reasons",
|
name: "complete mans and complete fallbacks, distinct reasons",
|
||||||
bf: &mockBackupFinder{
|
bf: &mockBackupFinder{
|
||||||
data: map[string]kopia.BackupBases{
|
data: map[string]backup.BackupBases{
|
||||||
ro: kopia.NewMockBackupBases().WithMergeBases(
|
ro: kopia.NewMockBackupBases().WithMergeBases(
|
||||||
makeMan(ro, "id1", "", path.EmailCategory)),
|
makeMan(ro, "id1", "", path.EmailCategory)),
|
||||||
fbro: kopia.NewMockBackupBases().
|
fbro: kopia.NewMockBackupBases().
|
||||||
@ -975,7 +975,7 @@ func (suite *OperationsManifestsUnitSuite) TestProduceManifestsAndMetadata_Fallb
|
|||||||
{
|
{
|
||||||
name: "complete mans and complete fallbacks, fallback has superset of reasons",
|
name: "complete mans and complete fallbacks, fallback has superset of reasons",
|
||||||
bf: &mockBackupFinder{
|
bf: &mockBackupFinder{
|
||||||
data: map[string]kopia.BackupBases{
|
data: map[string]backup.BackupBases{
|
||||||
ro: kopia.NewMockBackupBases().WithMergeBases(
|
ro: kopia.NewMockBackupBases().WithMergeBases(
|
||||||
makeMan(ro, "id1", "", path.EmailCategory)),
|
makeMan(ro, "id1", "", path.EmailCategory)),
|
||||||
fbro: kopia.NewMockBackupBases().
|
fbro: kopia.NewMockBackupBases().
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user