rename DetailsEntry to Entry to avoid stuttering (#3265)

#### Does this PR need a docs update or release note?

- [x]  No

#### Type of change

- [x] 🧹 Tech Debt/Cleanup

#### Test Plan

- [x]  Unit test
- [x] 💚 E2E
This commit is contained in:
Keepers 2023-05-01 13:29:06 -06:00 committed by GitHub
parent c3cc40176e
commit 3b9d2841d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 185 additions and 185 deletions

View File

@ -21,7 +21,7 @@ type ExchangeOptionsTest struct {
Name string Name string
Opts utils.ExchangeOpts Opts utils.ExchangeOpts
BackupGetter *MockBackupGetter BackupGetter *MockBackupGetter
Expected []details.DetailsEntry Expected []details.Entry
} }
var ( var (
@ -150,7 +150,7 @@ var (
}, },
{ {
Name: "EmailsFolderWithSlashPrefixMatch", Name: "EmailsFolderWithSlashPrefixMatch",
Expected: []details.DetailsEntry{ Expected: []details.Entry{
testdata.ExchangeEmailItems[1], testdata.ExchangeEmailItems[1],
testdata.ExchangeEmailItems[2], testdata.ExchangeEmailItems[2],
}, },
@ -160,7 +160,7 @@ var (
}, },
{ {
Name: "EmailsFolderWithSlashPrefixMatchTrailingSlash", Name: "EmailsFolderWithSlashPrefixMatchTrailingSlash",
Expected: []details.DetailsEntry{ Expected: []details.Entry{
testdata.ExchangeEmailItems[1], testdata.ExchangeEmailItems[1],
testdata.ExchangeEmailItems[2], testdata.ExchangeEmailItems[2],
}, },
@ -170,7 +170,7 @@ var (
}, },
{ {
Name: "EmailsBySubject", Name: "EmailsBySubject",
Expected: []details.DetailsEntry{ Expected: []details.Entry{
testdata.ExchangeEmailItems[0], testdata.ExchangeEmailItems[0],
testdata.ExchangeEmailItems[1], testdata.ExchangeEmailItems[1],
}, },
@ -183,7 +183,7 @@ var (
Expected: append( Expected: append(
append( append(
append( append(
[]details.DetailsEntry{}, []details.Entry{},
testdata.ExchangeEmailItems..., testdata.ExchangeEmailItems...,
), ),
testdata.ExchangeContactsItems..., testdata.ExchangeContactsItems...,
@ -193,28 +193,28 @@ var (
}, },
{ {
Name: "MailReceivedTime", Name: "MailReceivedTime",
Expected: []details.DetailsEntry{testdata.ExchangeEmailItems[0]}, Expected: []details.Entry{testdata.ExchangeEmailItems[0]},
Opts: utils.ExchangeOpts{ Opts: utils.ExchangeOpts{
EmailReceivedBefore: common.FormatTime(testdata.Time1.Add(time.Second)), EmailReceivedBefore: common.FormatTime(testdata.Time1.Add(time.Second)),
}, },
}, },
{ {
Name: "MailItemRef", Name: "MailItemRef",
Expected: []details.DetailsEntry{testdata.ExchangeEmailItems[0]}, Expected: []details.Entry{testdata.ExchangeEmailItems[0]},
Opts: utils.ExchangeOpts{ Opts: utils.ExchangeOpts{
Email: []string{testdata.ExchangeEmailItems[0].ItemRef}, Email: []string{testdata.ExchangeEmailItems[0].ItemRef},
}, },
}, },
{ {
Name: "MailShortRef", Name: "MailShortRef",
Expected: []details.DetailsEntry{testdata.ExchangeEmailItems[0]}, Expected: []details.Entry{testdata.ExchangeEmailItems[0]},
Opts: utils.ExchangeOpts{ Opts: utils.ExchangeOpts{
Email: []string{testdata.ExchangeEmailItemPath1.RR.ShortRef()}, Email: []string{testdata.ExchangeEmailItemPath1.RR.ShortRef()},
}, },
}, },
{ {
Name: "MultipleMailShortRef", Name: "MultipleMailShortRef",
Expected: []details.DetailsEntry{ Expected: []details.Entry{
testdata.ExchangeEmailItems[0], testdata.ExchangeEmailItems[0],
testdata.ExchangeEmailItems[1], testdata.ExchangeEmailItems[1],
}, },
@ -227,7 +227,7 @@ var (
}, },
{ {
Name: "AllEventsAndMailWithSubject", Name: "AllEventsAndMailWithSubject",
Expected: []details.DetailsEntry{testdata.ExchangeEmailItems[0]}, Expected: []details.Entry{testdata.ExchangeEmailItems[0]},
Opts: utils.ExchangeOpts{ Opts: utils.ExchangeOpts{
EmailSubject: "foo", EmailSubject: "foo",
Event: selectors.Any(), Event: selectors.Any(),
@ -235,7 +235,7 @@ var (
}, },
{ {
Name: "EventsAndMailWithSubject", Name: "EventsAndMailWithSubject",
Expected: []details.DetailsEntry{}, Expected: []details.Entry{},
Opts: utils.ExchangeOpts{ Opts: utils.ExchangeOpts{
EmailSubject: "foo", EmailSubject: "foo",
EventSubject: "foo", EventSubject: "foo",
@ -243,7 +243,7 @@ var (
}, },
{ {
Name: "EventsAndMailByShortRef", Name: "EventsAndMailByShortRef",
Expected: []details.DetailsEntry{ Expected: []details.Entry{
testdata.ExchangeEmailItems[0], testdata.ExchangeEmailItems[0],
testdata.ExchangeEventsItems[0], testdata.ExchangeEventsItems[0],
}, },
@ -259,7 +259,7 @@ type OneDriveOptionsTest struct {
Name string Name string
Opts utils.OneDriveOpts Opts utils.OneDriveOpts
BackupGetter *MockBackupGetter BackupGetter *MockBackupGetter
Expected []details.DetailsEntry Expected []details.Entry
} }
var ( var (
@ -377,14 +377,14 @@ var (
}, },
{ {
Name: "FolderRepoRefMatchesNothing", Name: "FolderRepoRefMatchesNothing",
Expected: []details.DetailsEntry{}, Expected: []details.Entry{},
Opts: utils.OneDriveOpts{ Opts: utils.OneDriveOpts{
FolderPath: []string{testdata.OneDriveFolderPath.RR.Folder(true)}, FolderPath: []string{testdata.OneDriveFolderPath.RR.Folder(true)},
}, },
}, },
{ {
Name: "ShortRef", Name: "ShortRef",
Expected: []details.DetailsEntry{ Expected: []details.Entry{
testdata.OneDriveItems[0], testdata.OneDriveItems[0],
testdata.OneDriveItems[1], testdata.OneDriveItems[1],
}, },
@ -397,7 +397,7 @@ var (
}, },
{ {
Name: "SingleItem", Name: "SingleItem",
Expected: []details.DetailsEntry{testdata.OneDriveItems[0]}, Expected: []details.Entry{testdata.OneDriveItems[0]},
Opts: utils.OneDriveOpts{ Opts: utils.OneDriveOpts{
FileName: []string{ FileName: []string{
testdata.OneDriveItems[0].OneDrive.ItemName, testdata.OneDriveItems[0].OneDrive.ItemName,
@ -406,7 +406,7 @@ var (
}, },
{ {
Name: "MultipleItems", Name: "MultipleItems",
Expected: []details.DetailsEntry{ Expected: []details.Entry{
testdata.OneDriveItems[0], testdata.OneDriveItems[0],
testdata.OneDriveItems[1], testdata.OneDriveItems[1],
}, },
@ -419,7 +419,7 @@ var (
}, },
{ {
Name: "ItemRefMatchesNothing", Name: "ItemRefMatchesNothing",
Expected: []details.DetailsEntry{}, Expected: []details.Entry{},
Opts: utils.OneDriveOpts{ Opts: utils.OneDriveOpts{
FileName: []string{ FileName: []string{
testdata.OneDriveItems[0].ItemRef, testdata.OneDriveItems[0].ItemRef,
@ -428,7 +428,7 @@ var (
}, },
{ {
Name: "CreatedBefore", Name: "CreatedBefore",
Expected: []details.DetailsEntry{testdata.OneDriveItems[1]}, Expected: []details.Entry{testdata.OneDriveItems[1]},
Opts: utils.OneDriveOpts{ Opts: utils.OneDriveOpts{
FileCreatedBefore: common.FormatTime(testdata.Time1.Add(time.Second)), FileCreatedBefore: common.FormatTime(testdata.Time1.Add(time.Second)),
}, },
@ -440,7 +440,7 @@ type SharePointOptionsTest struct {
Name string Name string
Opts utils.SharePointOpts Opts utils.SharePointOpts
BackupGetter *MockBackupGetter BackupGetter *MockBackupGetter
Expected []details.DetailsEntry Expected []details.Entry
} }
var ( var (
@ -503,14 +503,14 @@ var (
}, },
{ {
Name: "FolderRepoRefMatchesNothing", Name: "FolderRepoRefMatchesNothing",
Expected: []details.DetailsEntry{}, Expected: []details.Entry{},
Opts: utils.SharePointOpts{ Opts: utils.SharePointOpts{
FolderPath: []string{testdata.SharePointLibraryPath.RR.Folder(true)}, FolderPath: []string{testdata.SharePointLibraryPath.RR.Folder(true)},
}, },
}, },
{ {
Name: "ShortRef", Name: "ShortRef",
Expected: []details.DetailsEntry{ Expected: []details.Entry{
testdata.SharePointLibraryItems[0], testdata.SharePointLibraryItems[0],
testdata.SharePointLibraryItems[1], testdata.SharePointLibraryItems[1],
}, },
@ -523,7 +523,7 @@ var (
}, },
{ {
Name: "SingleItem", Name: "SingleItem",
Expected: []details.DetailsEntry{testdata.SharePointLibraryItems[0]}, Expected: []details.Entry{testdata.SharePointLibraryItems[0]},
Opts: utils.SharePointOpts{ Opts: utils.SharePointOpts{
FileName: []string{ FileName: []string{
testdata.SharePointLibraryItems[0].SharePoint.ItemName, testdata.SharePointLibraryItems[0].SharePoint.ItemName,
@ -532,7 +532,7 @@ var (
}, },
{ {
Name: "MultipleItems", Name: "MultipleItems",
Expected: []details.DetailsEntry{ Expected: []details.Entry{
testdata.SharePointLibraryItems[0], testdata.SharePointLibraryItems[0],
testdata.SharePointLibraryItems[1], testdata.SharePointLibraryItems[1],
}, },
@ -545,7 +545,7 @@ var (
}, },
{ {
Name: "ItemRefMatchesNothing", Name: "ItemRefMatchesNothing",
Expected: []details.DetailsEntry{}, Expected: []details.Entry{},
Opts: utils.SharePointOpts{ Opts: utils.SharePointOpts{
FileName: []string{ FileName: []string{
testdata.SharePointLibraryItems[0].ItemRef, testdata.SharePointLibraryItems[0].ItemRef,

View File

@ -540,7 +540,7 @@ func matchesReason(reasons []kopia.Reason, p path.Path) bool {
// 4. any errors encountered // 4. any errors encountered
func getNewPathRefs( func getNewPathRefs(
dataFromBackup kopia.DetailsMergeInfoer, dataFromBackup kopia.DetailsMergeInfoer,
entry *details.DetailsEntry, entry *details.Entry,
repoRef path.Path, repoRef path.Path,
backupVersion int, backupVersion int,
) (path.Path, *path.Builder, bool, error) { ) (path.Path, *path.Builder, bool, error) {

View File

@ -271,10 +271,10 @@ func makeFolderEntry(
size int64, size int64,
modTime time.Time, modTime time.Time,
dt details.ItemType, dt details.ItemType,
) *details.DetailsEntry { ) *details.Entry {
t.Helper() t.Helper()
return &details.DetailsEntry{ return &details.Entry{
RepoRef: pb.String(), RepoRef: pb.String(),
ShortRef: pb.ShortRef(), ShortRef: pb.ShortRef(),
ParentRef: pb.Dir().ShortRef(), ParentRef: pb.Dir().ShortRef(),
@ -308,7 +308,7 @@ func makeDetailsEntry(
l *path.Builder, l *path.Builder,
size int, size int,
updated bool, updated bool,
) *details.DetailsEntry { ) *details.Entry {
t.Helper() t.Helper()
var lr string var lr string
@ -316,7 +316,7 @@ func makeDetailsEntry(
lr = l.String() lr = l.String()
} }
res := &details.DetailsEntry{ res := &details.Entry{
RepoRef: p.String(), RepoRef: p.String(),
ShortRef: p.ShortRef(), ShortRef: p.ShortRef(),
ParentRef: p.ToBuilder().Dir().ShortRef(), ParentRef: p.ToBuilder().Dir().ShortRef(),
@ -718,20 +718,20 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
mdm *mockDetailsMergeInfoer mdm *mockDetailsMergeInfoer
errCheck assert.ErrorAssertionFunc errCheck assert.ErrorAssertionFunc
expectedEntries []*details.DetailsEntry expectedEntries []*details.Entry
}{ }{
{ {
name: "NilShortRefsFromPrevBackup", name: "NilShortRefsFromPrevBackup",
errCheck: assert.NoError, errCheck: assert.NoError,
// Use empty slice so we don't error out on nil != empty. // Use empty slice so we don't error out on nil != empty.
expectedEntries: []*details.DetailsEntry{}, expectedEntries: []*details.Entry{},
}, },
{ {
name: "EmptyShortRefsFromPrevBackup", name: "EmptyShortRefsFromPrevBackup",
mdm: newMockDetailsMergeInfoer(), mdm: newMockDetailsMergeInfoer(),
errCheck: assert.NoError, errCheck: assert.NoError,
// Use empty slice so we don't error out on nil != empty. // Use empty slice so we don't error out on nil != empty.
expectedEntries: []*details.DetailsEntry{}, expectedEntries: []*details.Entry{},
}, },
{ {
name: "BackupIDNotFound", name: "BackupIDNotFound",
@ -800,7 +800,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
populatedDetails: map[string]*details.Details{ populatedDetails: map[string]*details.Details{
backup1.DetailsID: { backup1.DetailsID: {
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{ Entries: []details.Entry{
*makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false), *makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false),
}, },
}, },
@ -836,7 +836,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
populatedDetails: map[string]*details.Details{ populatedDetails: map[string]*details.Details{
backup1.DetailsID: { backup1.DetailsID: {
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{ Entries: []details.Entry{
*makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false), *makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false),
}, },
}, },
@ -866,7 +866,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
populatedDetails: map[string]*details.Details{ populatedDetails: map[string]*details.Details{
backup1.DetailsID: { backup1.DetailsID: {
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{ Entries: []details.Entry{
{ {
RepoRef: stdpath.Join( RepoRef: stdpath.Join(
append( append(
@ -928,7 +928,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
populatedDetails: map[string]*details.Details{ populatedDetails: map[string]*details.Details{
backup1.DetailsID: { backup1.DetailsID: {
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{ Entries: []details.Entry{
*makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false), *makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false),
}, },
}, },
@ -958,14 +958,14 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
populatedDetails: map[string]*details.Details{ populatedDetails: map[string]*details.Details{
backup1.DetailsID: { backup1.DetailsID: {
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{ Entries: []details.Entry{
*makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false), *makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false),
}, },
}, },
}, },
}, },
errCheck: assert.NoError, errCheck: assert.NoError,
expectedEntries: []*details.DetailsEntry{ expectedEntries: []*details.Entry{
makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false), makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false),
}, },
}, },
@ -991,14 +991,14 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
populatedDetails: map[string]*details.Details{ populatedDetails: map[string]*details.Details{
backup1.DetailsID: { backup1.DetailsID: {
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{ Entries: []details.Entry{
*makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false), *makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false),
}, },
}, },
}, },
}, },
errCheck: assert.NoError, errCheck: assert.NoError,
expectedEntries: []*details.DetailsEntry{ expectedEntries: []*details.Entry{
makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false), makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false),
}, },
}, },
@ -1024,7 +1024,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
populatedDetails: map[string]*details.Details{ populatedDetails: map[string]*details.Details{
backup1.DetailsID: { backup1.DetailsID: {
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{ Entries: []details.Entry{
*makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false), *makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false),
*makeDetailsEntry(suite.T(), itemPath2, locationPath2, 84, false), *makeDetailsEntry(suite.T(), itemPath2, locationPath2, 84, false),
}, },
@ -1032,7 +1032,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
}, },
}, },
errCheck: assert.NoError, errCheck: assert.NoError,
expectedEntries: []*details.DetailsEntry{ expectedEntries: []*details.Entry{
makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false), makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false),
}, },
}, },
@ -1058,14 +1058,14 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
populatedDetails: map[string]*details.Details{ populatedDetails: map[string]*details.Details{
backup1.DetailsID: { backup1.DetailsID: {
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{ Entries: []details.Entry{
*makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false), *makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false),
}, },
}, },
}, },
}, },
errCheck: assert.NoError, errCheck: assert.NoError,
expectedEntries: []*details.DetailsEntry{ expectedEntries: []*details.Entry{
makeDetailsEntry(suite.T(), itemPath2, locationPath2, 42, true), makeDetailsEntry(suite.T(), itemPath2, locationPath2, 42, true),
}, },
}, },
@ -1099,14 +1099,14 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
populatedDetails: map[string]*details.Details{ populatedDetails: map[string]*details.Details{
backup1.DetailsID: { backup1.DetailsID: {
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{ Entries: []details.Entry{
*makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false), *makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false),
}, },
}, },
}, },
backup2.DetailsID: { backup2.DetailsID: {
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{ Entries: []details.Entry{
// This entry should not be picked due to a mismatch on Reasons. // This entry should not be picked due to a mismatch on Reasons.
*makeDetailsEntry(suite.T(), itemPath1, locationPath1, 84, false), *makeDetailsEntry(suite.T(), itemPath1, locationPath1, 84, false),
// This item should be picked. // This item should be picked.
@ -1116,7 +1116,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
}, },
}, },
errCheck: assert.NoError, errCheck: assert.NoError,
expectedEntries: []*details.DetailsEntry{ expectedEntries: []*details.Entry{
makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false), makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false),
makeDetailsEntry(suite.T(), itemPath3, locationPath3, 37, false), makeDetailsEntry(suite.T(), itemPath3, locationPath3, 37, false),
}, },
@ -1150,14 +1150,14 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
populatedDetails: map[string]*details.Details{ populatedDetails: map[string]*details.Details{
backup1.DetailsID: { backup1.DetailsID: {
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{ Entries: []details.Entry{
*makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false), *makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false),
}, },
}, },
}, },
backup2.DetailsID: { backup2.DetailsID: {
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{ Entries: []details.Entry{
// This entry should not be picked due to being incomplete. // This entry should not be picked due to being incomplete.
*makeDetailsEntry(suite.T(), itemPath1, locationPath1, 84, false), *makeDetailsEntry(suite.T(), itemPath1, locationPath1, 84, false),
}, },
@ -1165,7 +1165,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
}, },
}, },
errCheck: assert.NoError, errCheck: assert.NoError,
expectedEntries: []*details.DetailsEntry{ expectedEntries: []*details.Entry{
makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false), makeDetailsEntry(suite.T(), itemPath1, locationPath1, 42, false),
}, },
}, },
@ -1265,12 +1265,12 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsFolde
populatedDetails := map[string]*details.Details{ populatedDetails := map[string]*details.Details{
backup1.DetailsID: { backup1.DetailsID: {
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{*itemDetails}, Entries: []details.Entry{*itemDetails},
}, },
}, },
} }
expectedEntries := []details.DetailsEntry{*itemDetails} expectedEntries := []details.Entry{*itemDetails}
// update the details // update the details
itemDetails.Exchange.Modified = now itemDetails.Exchange.Modified = now
@ -1312,7 +1312,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsFolde
// assert.elementsMatch to fail. // assert.elementsMatch to fail.
func compareDeetEntries( func compareDeetEntries(
t *testing.T, t *testing.T,
expect, result []details.DetailsEntry, expect, result []details.Entry,
) { ) {
if !assert.Equal(t, len(expect), len(result), "entry slices should be equal len") { if !assert.Equal(t, len(expect), len(result), "entry slices should be equal len") {
require.ElementsMatch(t, expect, result) require.ElementsMatch(t, expect, result)
@ -1321,8 +1321,8 @@ func compareDeetEntries(
var ( var (
// repoRef -> modified time // repoRef -> modified time
eMods = map[string]time.Time{} eMods = map[string]time.Time{}
es = make([]details.DetailsEntry, 0, len(expect)) es = make([]details.Entry, 0, len(expect))
rs = make([]details.DetailsEntry, 0, len(expect)) rs = make([]details.Entry, 0, len(expect))
) )
for _, e := range expect { for _, e := range expect {
@ -1347,7 +1347,7 @@ func compareDeetEntries(
assert.ElementsMatch(t, es, rs) assert.ElementsMatch(t, es, rs)
} }
func withoutModified(de details.DetailsEntry) details.DetailsEntry { func withoutModified(de details.Entry) details.Entry {
switch { switch {
case de.Exchange != nil: case de.Exchange != nil:
de.Exchange.Modified = time.Time{} de.Exchange.Modified = time.Time{}

View File

@ -133,7 +133,7 @@ func NewSharePointLocationIDer(
// DetailsModel describes what was stored in a Backup // DetailsModel describes what was stored in a Backup
type DetailsModel struct { type DetailsModel struct {
Entries []DetailsEntry `json:"entries"` Entries []Entry `json:"entries"`
} }
// Print writes the DetailModel Entries to StdOut, in the format // Print writes the DetailModel Entries to StdOut, in the format
@ -194,8 +194,8 @@ func (dm DetailsModel) Paths() []string {
// Items returns a slice of *ItemInfo that does not contain any FolderInfo // Items returns a slice of *ItemInfo that does not contain any FolderInfo
// entries. Required because not all folders in the details are valid resource // entries. Required because not all folders in the details are valid resource
// paths, and we want to slice out metadata. // paths, and we want to slice out metadata.
func (dm DetailsModel) Items() []*DetailsEntry { func (dm DetailsModel) Items() []*Entry {
res := make([]*DetailsEntry, 0, len(dm.Entries)) res := make([]*Entry, 0, len(dm.Entries))
for i := 0; i < len(dm.Entries); i++ { for i := 0; i < len(dm.Entries); i++ {
ent := dm.Entries[i] ent := dm.Entries[i]
@ -213,7 +213,7 @@ func (dm DetailsModel) Items() []*DetailsEntry {
// .meta files removed from the entries. // .meta files removed from the entries.
func (dm DetailsModel) FilterMetaFiles() DetailsModel { func (dm DetailsModel) FilterMetaFiles() DetailsModel {
d2 := DetailsModel{ d2 := DetailsModel{
Entries: []DetailsEntry{}, Entries: []Entry{},
} }
for _, ent := range dm.Entries { for _, ent := range dm.Entries {
@ -228,7 +228,7 @@ func (dm DetailsModel) FilterMetaFiles() DetailsModel {
// Check if a file is a metadata file. These are used to store // Check if a file is a metadata file. These are used to store
// additional data like permissions in case of OneDrive and are not to // additional data like permissions in case of OneDrive and are not to
// be treated as regular files. // be treated as regular files.
func (de DetailsEntry) isMetaFile() bool { func (de Entry) isMetaFile() bool {
// TODO: Add meta file filtering to SharePoint as well once we add // TODO: Add meta file filtering to SharePoint as well once we add
// meta files for SharePoint. // meta files for SharePoint.
return de.ItemInfo.OneDrive != nil && de.ItemInfo.OneDrive.IsMeta return de.ItemInfo.OneDrive != nil && de.ItemInfo.OneDrive.IsMeta
@ -241,8 +241,8 @@ func (de DetailsEntry) isMetaFile() bool {
// Builder should be used to create a details model. // Builder should be used to create a details model.
type Builder struct { type Builder struct {
d Details d Details
mu sync.Mutex `json:"-"` mu sync.Mutex `json:"-"`
knownFolders map[string]DetailsEntry `json:"-"` knownFolders map[string]Entry `json:"-"`
} }
func (b *Builder) Add( func (b *Builder) Add(
@ -276,7 +276,7 @@ func (b *Builder) Add(
func (b *Builder) addFolderEntries( func (b *Builder) addFolderEntries(
repoRef, locationRef *path.Builder, repoRef, locationRef *path.Builder,
entry DetailsEntry, entry Entry,
) error { ) error {
if len(repoRef.Elements()) < len(locationRef.Elements()) { if len(repoRef.Elements()) < len(locationRef.Elements()) {
return clues.New("RepoRef shorter than LocationRef"). return clues.New("RepoRef shorter than LocationRef").
@ -284,7 +284,7 @@ func (b *Builder) addFolderEntries(
} }
if b.knownFolders == nil { if b.knownFolders == nil {
b.knownFolders = map[string]DetailsEntry{} b.knownFolders = map[string]Entry{}
} }
// Need a unique location because we want to have separate folders for // Need a unique location because we want to have separate folders for
@ -317,7 +317,7 @@ func (b *Builder) addFolderEntries(
if !ok { if !ok {
loc := uniqueLoc.InDetails().String() loc := uniqueLoc.InDetails().String()
folder = DetailsEntry{ folder = Entry{
RepoRef: rr, RepoRef: rr,
ShortRef: shortRef, ShortRef: shortRef,
ParentRef: parentRef, ParentRef: parentRef,
@ -380,12 +380,12 @@ func (d *Details) add(
locationRef *path.Builder, locationRef *path.Builder,
updated bool, updated bool,
info ItemInfo, info ItemInfo,
) (DetailsEntry, error) { ) (Entry, error) {
if locationRef == nil { if locationRef == nil {
return DetailsEntry{}, clues.New("nil LocationRef").With("repo_ref", repoRef) return Entry{}, clues.New("nil LocationRef").With("repo_ref", repoRef)
} }
entry := DetailsEntry{ entry := Entry{
RepoRef: repoRef.String(), RepoRef: repoRef.String(),
ShortRef: repoRef.ShortRef(), ShortRef: repoRef.ShortRef(),
ParentRef: repoRef.ToBuilder().Dir().ShortRef(), ParentRef: repoRef.ToBuilder().Dir().ShortRef(),
@ -457,8 +457,8 @@ func withoutMetadataSuffix(id string) string {
// Entry // Entry
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
// DetailsEntry describes a single item stored in a Backup // Entry describes a single item stored in a Backup
type DetailsEntry struct { type Entry struct {
// RepoRef is the full storage path of the item in Kopia // RepoRef is the full storage path of the item in Kopia
RepoRef string `json:"repoRef"` RepoRef string `json:"repoRef"`
ShortRef string `json:"shortRef"` ShortRef string `json:"shortRef"`
@ -490,7 +490,7 @@ type DetailsEntry struct {
// ToLocationIDer takes a backup version and produces the unique location for // ToLocationIDer takes a backup version and produces the unique location for
// this entry if possible. Reasons it may not be possible to produce the unique // this entry if possible. Reasons it may not be possible to produce the unique
// location include an unsupported backup version or missing information. // location include an unsupported backup version or missing information.
func (de DetailsEntry) ToLocationIDer(backupVersion int) (LocationIDer, error) { func (de Entry) ToLocationIDer(backupVersion int) (LocationIDer, error) {
if len(de.LocationRef) > 0 { if len(de.LocationRef) > 0 {
baseLoc, err := path.Builder{}.SplitUnescapeAppend(de.LocationRef) baseLoc, err := path.Builder{}.SplitUnescapeAppend(de.LocationRef)
if err != nil { if err != nil {
@ -538,17 +538,17 @@ func (de DetailsEntry) ToLocationIDer(backupVersion int) (LocationIDer, error) {
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
// interface compliance checks // interface compliance checks
var _ print.Printable = &DetailsEntry{} var _ print.Printable = &Entry{}
// MinimumPrintable DetailsEntries is a passthrough func, because no // MinimumPrintable DetailsEntries is a passthrough func, because no
// reduction is needed for the json output. // reduction is needed for the json output.
func (de DetailsEntry) MinimumPrintable() any { func (de Entry) MinimumPrintable() any {
return de return de
} }
// Headers returns the human-readable names of properties in a DetailsEntry // Headers returns the human-readable names of properties in a DetailsEntry
// for printing out to a terminal in a columnar display. // for printing out to a terminal in a columnar display.
func (de DetailsEntry) Headers() []string { func (de Entry) Headers() []string {
hs := []string{"ID"} hs := []string{"ID"}
if de.ItemInfo.Folder != nil { if de.ItemInfo.Folder != nil {
@ -571,7 +571,7 @@ func (de DetailsEntry) Headers() []string {
} }
// Values returns the values matching the Headers list. // Values returns the values matching the Headers list.
func (de DetailsEntry) Values() []string { func (de Entry) Values() []string {
vs := []string{de.ShortRef} vs := []string{de.ShortRef}
if de.ItemInfo.Folder != nil { if de.ItemInfo.Folder != nil {

View File

@ -40,13 +40,13 @@ func (suite *DetailsUnitSuite) TestDetailsEntry_HeadersValues() {
table := []struct { table := []struct {
name string name string
entry DetailsEntry entry Entry
expectHs []string expectHs []string
expectVs []string expectVs []string
}{ }{
{ {
name: "no info", name: "no info",
entry: DetailsEntry{ entry: Entry{
RepoRef: "reporef", RepoRef: "reporef",
ShortRef: "deadbeef", ShortRef: "deadbeef",
LocationRef: "locationref", LocationRef: "locationref",
@ -57,7 +57,7 @@ func (suite *DetailsUnitSuite) TestDetailsEntry_HeadersValues() {
}, },
{ {
name: "exchange event info", name: "exchange event info",
entry: DetailsEntry{ entry: Entry{
RepoRef: "reporef", RepoRef: "reporef",
ShortRef: "deadbeef", ShortRef: "deadbeef",
LocationRef: "locationref", LocationRef: "locationref",
@ -78,7 +78,7 @@ func (suite *DetailsUnitSuite) TestDetailsEntry_HeadersValues() {
}, },
{ {
name: "exchange contact info", name: "exchange contact info",
entry: DetailsEntry{ entry: Entry{
RepoRef: "reporef", RepoRef: "reporef",
ShortRef: "deadbeef", ShortRef: "deadbeef",
LocationRef: "locationref", LocationRef: "locationref",
@ -95,7 +95,7 @@ func (suite *DetailsUnitSuite) TestDetailsEntry_HeadersValues() {
}, },
{ {
name: "exchange mail info", name: "exchange mail info",
entry: DetailsEntry{ entry: Entry{
RepoRef: "reporef", RepoRef: "reporef",
ShortRef: "deadbeef", ShortRef: "deadbeef",
LocationRef: "locationref", LocationRef: "locationref",
@ -116,7 +116,7 @@ func (suite *DetailsUnitSuite) TestDetailsEntry_HeadersValues() {
}, },
{ {
name: "sharepoint info", name: "sharepoint info",
entry: DetailsEntry{ entry: Entry{
RepoRef: "reporef", RepoRef: "reporef",
ShortRef: "deadbeef", ShortRef: "deadbeef",
LocationRef: "locationref", LocationRef: "locationref",
@ -148,7 +148,7 @@ func (suite *DetailsUnitSuite) TestDetailsEntry_HeadersValues() {
}, },
{ {
name: "oneDrive info", name: "oneDrive info",
entry: DetailsEntry{ entry: Entry{
RepoRef: "reporef", RepoRef: "reporef",
ShortRef: "deadbeef", ShortRef: "deadbeef",
LocationRef: "locationref", LocationRef: "locationref",
@ -181,7 +181,7 @@ func (suite *DetailsUnitSuite) TestDetailsEntry_HeadersValues() {
} }
} }
func exchangeEntry(t *testing.T, id string, size int, it ItemType) DetailsEntry { func exchangeEntry(t *testing.T, id string, size int, it ItemType) Entry {
rr := makeItemPath( rr := makeItemPath(
t, t,
path.ExchangeService, path.ExchangeService,
@ -190,7 +190,7 @@ func exchangeEntry(t *testing.T, id string, size int, it ItemType) DetailsEntry
"user-id", "user-id",
[]string{"Inbox", "folder1", id}) []string{"Inbox", "folder1", id})
return DetailsEntry{ return Entry{
RepoRef: rr.String(), RepoRef: rr.String(),
ShortRef: rr.ShortRef(), ShortRef: rr.ShortRef(),
ParentRef: rr.ToBuilder().Dir().ShortRef(), ParentRef: rr.ToBuilder().Dir().ShortRef(),
@ -206,7 +206,7 @@ func exchangeEntry(t *testing.T, id string, size int, it ItemType) DetailsEntry
} }
} }
func oneDriveishEntry(t *testing.T, id string, size int, it ItemType) DetailsEntry { func oneDriveishEntry(t *testing.T, id string, size int, it ItemType) Entry {
service := path.OneDriveService service := path.OneDriveService
category := path.FilesCategory category := path.FilesCategory
info := ItemInfo{ info := ItemInfo{
@ -252,7 +252,7 @@ func oneDriveishEntry(t *testing.T, id string, size int, it ItemType) DetailsEnt
loc := path.Builder{}.Append(rr.Folders()...).PopFront().PopFront() loc := path.Builder{}.Append(rr.Folders()...).PopFront().PopFront()
return DetailsEntry{ return Entry{
RepoRef: rr.String(), RepoRef: rr.String(),
ShortRef: rr.ShortRef(), ShortRef: rr.ShortRef(),
ParentRef: rr.ToBuilder().Dir().ShortRef(), ParentRef: rr.ToBuilder().Dir().ShortRef(),
@ -268,7 +268,7 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_NoLocationFolders() {
t := suite.T() t := suite.T()
table := []struct { table := []struct {
name string name string
entry DetailsEntry entry Entry
// shortRefEqual allows checking that OneDrive and SharePoint have their // shortRefEqual allows checking that OneDrive and SharePoint have their
// ShortRef updated in the returned entry. // ShortRef updated in the returned entry.
// //
@ -293,7 +293,7 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_NoLocationFolders() {
}, },
{ {
name: "Legacy SharePoint File", name: "Legacy SharePoint File",
entry: func() DetailsEntry { entry: func() Entry {
res := oneDriveishEntry(t, itemID, 42, SharePointLibrary) res := oneDriveishEntry(t, itemID, 42, SharePointLibrary)
res.SharePoint.ItemType = OneDriveItem res.SharePoint.ItemType = OneDriveItem
@ -360,7 +360,7 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_LocationFolders() {
exchangeMail2 := exchangeEntry(t, "foo2", 43, ExchangeMail) exchangeMail2 := exchangeEntry(t, "foo2", 43, ExchangeMail)
exchangeContact1 := exchangeEntry(t, "foo3", 44, ExchangeContact) exchangeContact1 := exchangeEntry(t, "foo3", 44, ExchangeContact)
exchangeFolders := []DetailsEntry{ exchangeFolders := []Entry{
{ {
ItemInfo: ItemInfo{ ItemInfo: ItemInfo{
Folder: &FolderInfo{ Folder: &FolderInfo{
@ -382,7 +382,7 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_LocationFolders() {
}, },
} }
exchangeContactFolders := []DetailsEntry{ exchangeContactFolders := []Entry{
{ {
ItemInfo: ItemInfo{ ItemInfo: ItemInfo{
Folder: &FolderInfo{ Folder: &FolderInfo{
@ -404,7 +404,7 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_LocationFolders() {
}, },
} }
oneDriveishFolders := []DetailsEntry{ oneDriveishFolders := []Entry{
{ {
ItemInfo: ItemInfo{ ItemInfo: ItemInfo{
Folder: &FolderInfo{ Folder: &FolderInfo{
@ -441,20 +441,20 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_LocationFolders() {
table := []struct { table := []struct {
name string name string
entries func() []DetailsEntry entries func() []Entry
expectedDirs func() []DetailsEntry expectedDirs func() []Entry
}{ }{
{ {
name: "One Exchange Email None Updated", name: "One Exchange Email None Updated",
entries: func() []DetailsEntry { entries: func() []Entry {
e := exchangeMail1 e := exchangeMail1
ei := *exchangeMail1.Exchange ei := *exchangeMail1.Exchange
e.Exchange = &ei e.Exchange = &ei
return []DetailsEntry{e} return []Entry{e}
}, },
expectedDirs: func() []DetailsEntry { expectedDirs: func() []Entry {
res := []DetailsEntry{} res := []Entry{}
for _, entry := range exchangeFolders { for _, entry := range exchangeFolders {
e := entry e := entry
@ -472,16 +472,16 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_LocationFolders() {
}, },
{ {
name: "One Exchange Email Updated", name: "One Exchange Email Updated",
entries: func() []DetailsEntry { entries: func() []Entry {
e := exchangeMail1 e := exchangeMail1
ei := *exchangeMail1.Exchange ei := *exchangeMail1.Exchange
e.Exchange = &ei e.Exchange = &ei
e.Updated = true e.Updated = true
return []DetailsEntry{e} return []Entry{e}
}, },
expectedDirs: func() []DetailsEntry { expectedDirs: func() []Entry {
res := []DetailsEntry{} res := []Entry{}
for _, entry := range exchangeFolders { for _, entry := range exchangeFolders {
e := entry e := entry
@ -500,10 +500,10 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_LocationFolders() {
}, },
{ {
name: "Two Exchange Emails None Updated", name: "Two Exchange Emails None Updated",
entries: func() []DetailsEntry { entries: func() []Entry {
res := []DetailsEntry{} res := []Entry{}
for _, entry := range []DetailsEntry{exchangeMail1, exchangeMail2} { for _, entry := range []Entry{exchangeMail1, exchangeMail2} {
e := entry e := entry
ei := *entry.Exchange ei := *entry.Exchange
e.Exchange = &ei e.Exchange = &ei
@ -513,8 +513,8 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_LocationFolders() {
return res return res
}, },
expectedDirs: func() []DetailsEntry { expectedDirs: func() []Entry {
res := []DetailsEntry{} res := []Entry{}
for _, entry := range exchangeFolders { for _, entry := range exchangeFolders {
e := entry e := entry
@ -532,10 +532,10 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_LocationFolders() {
}, },
{ {
name: "Two Exchange Emails One Updated", name: "Two Exchange Emails One Updated",
entries: func() []DetailsEntry { entries: func() []Entry {
res := []DetailsEntry{} res := []Entry{}
for i, entry := range []DetailsEntry{exchangeMail1, exchangeMail2} { for i, entry := range []Entry{exchangeMail1, exchangeMail2} {
e := entry e := entry
ei := *entry.Exchange ei := *entry.Exchange
e.Exchange = &ei e.Exchange = &ei
@ -546,8 +546,8 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_LocationFolders() {
return res return res
}, },
expectedDirs: func() []DetailsEntry { expectedDirs: func() []Entry {
res := []DetailsEntry{} res := []Entry{}
for _, entry := range exchangeFolders { for _, entry := range exchangeFolders {
e := entry e := entry
@ -566,10 +566,10 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_LocationFolders() {
}, },
{ {
name: "One Email And One Contact None Updated", name: "One Email And One Contact None Updated",
entries: func() []DetailsEntry { entries: func() []Entry {
res := []DetailsEntry{} res := []Entry{}
for _, entry := range []DetailsEntry{exchangeMail1, exchangeContact1} { for _, entry := range []Entry{exchangeMail1, exchangeContact1} {
e := entry e := entry
ei := *entry.Exchange ei := *entry.Exchange
e.Exchange = &ei e.Exchange = &ei
@ -579,8 +579,8 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_LocationFolders() {
return res return res
}, },
expectedDirs: func() []DetailsEntry { expectedDirs: func() []Entry {
res := []DetailsEntry{} res := []Entry{}
for _, entry := range exchangeFolders { for _, entry := range exchangeFolders {
e := entry e := entry
@ -609,15 +609,15 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_LocationFolders() {
}, },
{ {
name: "One OneDrive Item None Updated", name: "One OneDrive Item None Updated",
entries: func() []DetailsEntry { entries: func() []Entry {
e := oneDrive1 e := oneDrive1
ei := *oneDrive1.OneDrive ei := *oneDrive1.OneDrive
e.OneDrive = &ei e.OneDrive = &ei
return []DetailsEntry{e} return []Entry{e}
}, },
expectedDirs: func() []DetailsEntry { expectedDirs: func() []Entry {
res := []DetailsEntry{} res := []Entry{}
for _, entry := range oneDriveishFolders { for _, entry := range oneDriveishFolders {
e := entry e := entry
@ -636,15 +636,15 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_LocationFolders() {
}, },
{ {
name: "One SharePoint Item None Updated", name: "One SharePoint Item None Updated",
entries: func() []DetailsEntry { entries: func() []Entry {
e := sharePoint1 e := sharePoint1
ei := *sharePoint1.SharePoint ei := *sharePoint1.SharePoint
e.SharePoint = &ei e.SharePoint = &ei
return []DetailsEntry{e} return []Entry{e}
}, },
expectedDirs: func() []DetailsEntry { expectedDirs: func() []Entry {
res := []DetailsEntry{} res := []Entry{}
for _, entry := range oneDriveishFolders { for _, entry := range oneDriveishFolders {
e := entry e := entry
@ -663,15 +663,15 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_LocationFolders() {
}, },
{ {
name: "One SharePoint Legacy Item None Updated", name: "One SharePoint Legacy Item None Updated",
entries: func() []DetailsEntry { entries: func() []Entry {
e := sharePoint1 e := sharePoint1
ei := *sharePoint1.SharePoint ei := *sharePoint1.SharePoint
e.SharePoint = &ei e.SharePoint = &ei
return []DetailsEntry{e} return []Entry{e}
}, },
expectedDirs: func() []DetailsEntry { expectedDirs: func() []Entry {
res := []DetailsEntry{} res := []Entry{}
for _, entry := range oneDriveishFolders { for _, entry := range oneDriveishFolders {
e := entry e := entry
@ -707,7 +707,7 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_LocationFolders() {
} }
deets := db.Details() deets := db.Details()
gotDirs := []DetailsEntry{} gotDirs := []Entry{}
for _, entry := range deets.Entries { for _, entry := range deets.Entries {
// Other test checks items are populated properly. // Other test checks items are populated properly.
@ -730,7 +730,7 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_LocationFolders() {
var pathItemsTable = []struct { var pathItemsTable = []struct {
name string name string
ents []DetailsEntry ents []Entry
expectRepoRefs []string expectRepoRefs []string
expectLocationRefs []string expectLocationRefs []string
}{ }{
@ -742,7 +742,7 @@ var pathItemsTable = []struct {
}, },
{ {
name: "single entry", name: "single entry",
ents: []DetailsEntry{ ents: []Entry{
{ {
RepoRef: "abcde", RepoRef: "abcde",
LocationRef: "locationref", LocationRef: "locationref",
@ -754,7 +754,7 @@ var pathItemsTable = []struct {
}, },
{ {
name: "multiple entries", name: "multiple entries",
ents: []DetailsEntry{ ents: []Entry{
{ {
RepoRef: "abcde", RepoRef: "abcde",
LocationRef: "locationref", LocationRef: "locationref",
@ -771,7 +771,7 @@ var pathItemsTable = []struct {
}, },
{ {
name: "multiple entries with folder", name: "multiple entries with folder",
ents: []DetailsEntry{ ents: []Entry{
{ {
RepoRef: "abcde", RepoRef: "abcde",
LocationRef: "locationref", LocationRef: "locationref",
@ -797,7 +797,7 @@ var pathItemsTable = []struct {
}, },
{ {
name: "multiple entries with meta file", name: "multiple entries with meta file",
ents: []DetailsEntry{ ents: []Entry{
{ {
RepoRef: "abcde", RepoRef: "abcde",
LocationRef: "locationref", LocationRef: "locationref",
@ -824,7 +824,7 @@ var pathItemsTable = []struct {
}, },
{ {
name: "multiple entries with folder and meta file", name: "multiple entries with folder and meta file",
ents: []DetailsEntry{ ents: []Entry{
{ {
RepoRef: "abcde", RepoRef: "abcde",
LocationRef: "locationref", LocationRef: "locationref",
@ -908,7 +908,7 @@ func (suite *DetailsUnitSuite) TestDetailsModel_FilterMetaFiles() {
t := suite.T() t := suite.T()
d := &DetailsModel{ d := &DetailsModel{
Entries: []DetailsEntry{ Entries: []Entry{
{ {
RepoRef: "a.data", RepoRef: "a.data",
ItemInfo: ItemInfo{ ItemInfo: ItemInfo{
@ -1360,7 +1360,7 @@ func (suite *DetailsUnitSuite) TestLocationIDer_FromEntry() {
suite.Run(test.name, func() { suite.Run(test.name, func() {
t := suite.T() t := suite.T()
entry := DetailsEntry{ entry := Entry{
RepoRef: fmt.Sprintf(rrString, test.service, test.category), RepoRef: fmt.Sprintf(rrString, test.service, test.category),
ItemInfo: test.itemInfo, ItemInfo: test.itemInfo,
} }

View File

@ -145,7 +145,7 @@ var (
ExchangeEmailItemPath2 = ExchangeEmailBasePath2.mustAppend(ItemName2, true) ExchangeEmailItemPath2 = ExchangeEmailBasePath2.mustAppend(ItemName2, true)
ExchangeEmailItemPath3 = ExchangeEmailBasePath3.mustAppend(ItemName3, true) ExchangeEmailItemPath3 = ExchangeEmailBasePath3.mustAppend(ItemName3, true)
ExchangeEmailItems = []details.DetailsEntry{ ExchangeEmailItems = []details.Entry{
{ {
RepoRef: ExchangeEmailItemPath1.RR.String(), RepoRef: ExchangeEmailItemPath1.RR.String(),
ShortRef: ExchangeEmailItemPath1.RR.ShortRef(), ShortRef: ExchangeEmailItemPath1.RR.ShortRef(),
@ -199,7 +199,7 @@ var (
ExchangeContactsItemPath1 = ExchangeContactsBasePath.mustAppend(ItemName1, true) ExchangeContactsItemPath1 = ExchangeContactsBasePath.mustAppend(ItemName1, true)
ExchangeContactsItemPath2 = ExchangeContactsBasePath2.mustAppend(ItemName2, true) ExchangeContactsItemPath2 = ExchangeContactsBasePath2.mustAppend(ItemName2, true)
ExchangeContactsItems = []details.DetailsEntry{ ExchangeContactsItems = []details.Entry{
{ {
RepoRef: ExchangeContactsItemPath1.RR.String(), RepoRef: ExchangeContactsItemPath1.RR.String(),
ShortRef: ExchangeContactsItemPath1.RR.ShortRef(), ShortRef: ExchangeContactsItemPath1.RR.ShortRef(),
@ -234,7 +234,7 @@ var (
ExchangeEventsItemPath1 = ExchangeEventsBasePath.mustAppend(ItemName1, true) ExchangeEventsItemPath1 = ExchangeEventsBasePath.mustAppend(ItemName1, true)
ExchangeEventsItemPath2 = ExchangeEventsBasePath2.mustAppend(ItemName2, true) ExchangeEventsItemPath2 = ExchangeEventsBasePath2.mustAppend(ItemName2, true)
ExchangeEventsItems = []details.DetailsEntry{ ExchangeEventsItems = []details.Entry{
{ {
RepoRef: ExchangeEventsItemPath1.RR.String(), RepoRef: ExchangeEventsItemPath1.RR.String(),
ShortRef: ExchangeEventsItemPath1.RR.ShortRef(), ShortRef: ExchangeEventsItemPath1.RR.ShortRef(),
@ -282,7 +282,7 @@ var (
OneDriveParentFolder1 = OneDriveBasePath1.loc.PopFront().String() OneDriveParentFolder1 = OneDriveBasePath1.loc.PopFront().String()
OneDriveParentFolder2 = OneDriveBasePath2.loc.PopFront().String() OneDriveParentFolder2 = OneDriveBasePath2.loc.PopFront().String()
OneDriveItems = []details.DetailsEntry{ OneDriveItems = []details.Entry{
{ {
RepoRef: OneDriveItemPath1.RR.String(), RepoRef: OneDriveItemPath1.RR.String(),
ShortRef: OneDriveItemPath1.RR.ShortRef(), ShortRef: OneDriveItemPath1.RR.ShortRef(),
@ -352,7 +352,7 @@ var (
SharePointParentLibrary1 = SharePointBasePath1.loc.PopFront().String() SharePointParentLibrary1 = SharePointBasePath1.loc.PopFront().String()
SharePointParentLibrary2 = SharePointBasePath2.loc.PopFront().String() SharePointParentLibrary2 = SharePointBasePath2.loc.PopFront().String()
SharePointLibraryItems = []details.DetailsEntry{ SharePointLibraryItems = []details.Entry{
{ {
RepoRef: SharePointLibraryItemPath1.RR.String(), RepoRef: SharePointLibraryItemPath1.RR.String(),
ShortRef: SharePointLibraryItemPath1.RR.ShortRef(), ShortRef: SharePointLibraryItemPath1.RR.ShortRef(),
@ -411,7 +411,7 @@ var (
) )
func GetDetailsSet() *details.Details { func GetDetailsSet() *details.Details {
entries := []details.DetailsEntry{} entries := []details.Entry{}
for _, e := range ExchangeEmailItems { for _, e := range ExchangeEmailItems {
entries = append(entries, e) entries = append(entries, e)

View File

@ -302,10 +302,10 @@ func doRestoreLoadTest(
} }
// noFolders removes all "folder" category details entries // noFolders removes all "folder" category details entries
func noFolders(t *testing.T, des []details.DetailsEntry) []details.DetailsEntry { func noFolders(t *testing.T, des []details.Entry) []details.Entry {
t.Helper() t.Helper()
sansfldr := []details.DetailsEntry{} sansfldr := []details.Entry{}
for _, ent := range des { for _, ent := range des {
if ent.Folder == nil { if ent.Folder == nil {

View File

@ -121,7 +121,7 @@ var (
ctxBG = context.Background() ctxBG = context.Background()
exampleDetails = &details.Details{ exampleDetails = &details.Details{
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{ Entries: []details.Entry{
{ {
RepoRef: "tID/exchange/your-user-id/email/example/itemID", RepoRef: "tID/exchange/your-user-id/email/example/itemID",
LocationRef: "example", LocationRef: "example",

View File

@ -593,7 +593,7 @@ func (ec exchangeCategory) isLeaf() bool {
// => {exchMailFolder: mailFolder, exchMail: mailID} // => {exchMailFolder: mailFolder, exchMail: mailID}
func (ec exchangeCategory) pathValues( func (ec exchangeCategory) pathValues(
repo path.Path, repo path.Path,
ent details.DetailsEntry, ent details.Entry,
cfg Config, cfg Config,
) (map[categorizer][]string, error) { ) (map[categorizer][]string, error) {
var folderCat, itemCat categorizer var folderCat, itemCat categorizer

View File

@ -725,7 +725,7 @@ func (suite *ExchangeSelectorSuite) TestExchangeScope_MatchesPath() {
loc = strings.Join([]string{fld1, fld2, mail}, "/") loc = strings.Join([]string{fld1, fld2, mail}, "/")
short = "thisisahashofsomekind" short = "thisisahashofsomekind"
es = NewExchangeRestore(Any()) es = NewExchangeRestore(Any())
ent = details.DetailsEntry{ ent = details.Entry{
RepoRef: repo.String(), RepoRef: repo.String(),
ShortRef: short, ShortRef: short,
ItemRef: mail, ItemRef: mail,
@ -822,7 +822,7 @@ func (suite *ExchangeSelectorSuite) TestExchangeRestore_Reduce() {
makeDeets := func(refs ...path.Path) *details.Details { makeDeets := func(refs ...path.Path) *details.Details {
deets := &details.Details{ deets := &details.Details{
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{}, Entries: []details.Entry{},
}, },
} }
@ -838,7 +838,7 @@ func (suite *ExchangeSelectorSuite) TestExchangeRestore_Reduce() {
itype = details.ExchangeMail itype = details.ExchangeMail
} }
deets.Entries = append(deets.Entries, details.DetailsEntry{ deets.Entries = append(deets.Entries, details.Entry{
RepoRef: toRR(r), RepoRef: toRR(r),
// Don't escape because we assume nice paths. // Don't escape because we assume nice paths.
LocationRef: r.Folder(false), LocationRef: r.Folder(false),
@ -1069,7 +1069,7 @@ func (suite *ExchangeSelectorSuite) TestExchangeRestore_Reduce_locationRef() {
makeDeets := func(refs ...string) *details.Details { makeDeets := func(refs ...string) *details.Details {
deets := &details.Details{ deets := &details.Details{
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{}, Entries: []details.Entry{},
}, },
} }
@ -1091,7 +1091,7 @@ func (suite *ExchangeSelectorSuite) TestExchangeRestore_Reduce_locationRef() {
location = mailLocation location = mailLocation
} }
deets.Entries = append(deets.Entries, details.DetailsEntry{ deets.Entries = append(deets.Entries, details.Entry{
RepoRef: r, RepoRef: r,
LocationRef: location, LocationRef: location,
ItemInfo: details.ItemInfo{ ItemInfo: details.ItemInfo{
@ -1345,7 +1345,7 @@ func (suite *ExchangeSelectorSuite) TestPasses() {
) )
short := "thisisahashofsomekind" short := "thisisahashofsomekind"
entry := details.DetailsEntry{ entry := details.Entry{
ShortRef: short, ShortRef: short,
ItemRef: mid, ItemRef: mid,
} }
@ -1357,7 +1357,7 @@ func (suite *ExchangeSelectorSuite) TestPasses() {
noMail = setScopesToDefault(es.Mails(Any(), None())) noMail = setScopesToDefault(es.Mails(Any(), None()))
allMail = setScopesToDefault(es.Mails(Any(), Any())) allMail = setScopesToDefault(es.Mails(Any(), Any()))
repo = stubPath(suite.T(), "user", []string{"folder", mid}, path.EmailCategory) repo = stubPath(suite.T(), "user", []string{"folder", mid}, path.EmailCategory)
ent = details.DetailsEntry{ ent = details.Entry{
RepoRef: repo.String(), RepoRef: repo.String(),
} }
) )
@ -1524,7 +1524,7 @@ func (suite *ExchangeSelectorSuite) TestExchangeCategory_PathValues() {
for _, test := range table { for _, test := range table {
suite.Run(string(test.cat), func() { suite.Run(string(test.cat), func() {
t := suite.T() t := suite.T()
ent := details.DetailsEntry{ ent := details.Entry{
RepoRef: test.path.String(), RepoRef: test.path.String(),
ShortRef: "short", ShortRef: "short",
LocationRef: test.loc.Folder(true), LocationRef: test.loc.Folder(true),

View File

@ -59,7 +59,7 @@ func (mc mockCategorizer) isLeaf() bool {
func (mc mockCategorizer) pathValues( func (mc mockCategorizer) pathValues(
repo path.Path, repo path.Path,
ent details.DetailsEntry, ent details.Entry,
cfg Config, cfg Config,
) (map[categorizer][]string, error) { ) (map[categorizer][]string, error) {
return map[categorizer][]string{ return map[categorizer][]string{

View File

@ -391,7 +391,7 @@ func (c oneDriveCategory) isLeaf() bool {
// => {odFolder: folder, odFileID: fileID} // => {odFolder: folder, odFileID: fileID}
func (c oneDriveCategory) pathValues( func (c oneDriveCategory) pathValues(
repo path.Path, repo path.Path,
ent details.DetailsEntry, ent details.Entry,
cfg Config, cfg Config,
) (map[categorizer][]string, error) { ) (map[categorizer][]string, error) {
if ent.OneDrive == nil { if ent.OneDrive == nil {

View File

@ -188,7 +188,7 @@ func (suite *OneDriveSelectorSuite) TestOneDriveRestore_Reduce() {
deets := &details.Details{ deets := &details.Details{
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{ Entries: []details.Entry{
{ {
RepoRef: file, RepoRef: file,
ItemRef: "file", ItemRef: "file",
@ -361,7 +361,7 @@ func (suite *OneDriveSelectorSuite) TestOneDriveCategory_PathValues() {
test.pathElems...) test.pathElems...)
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
ent := details.DetailsEntry{ ent := details.Entry{
RepoRef: filePath.String(), RepoRef: filePath.String(),
ShortRef: shortRef, ShortRef: shortRef,
ItemRef: fileID, ItemRef: fileID,

View File

@ -89,7 +89,7 @@ type (
// folderCat: folder, // folderCat: folder,
// itemCat: itemID, // itemCat: itemID,
// } // }
pathValues(path.Path, details.DetailsEntry, Config) (map[categorizer][]string, error) pathValues(path.Path, details.Entry, Config) (map[categorizer][]string, error)
// pathKeys produces a list of categorizers that can be used as keys in the pathValues // pathKeys produces a list of categorizers that can be used as keys in the pathValues
// map. The combination of the two funcs generically interprets the context of the // map. The combination of the two funcs generically interprets the context of the
@ -360,7 +360,7 @@ func reduce[T scopeT, C categoryT](
filts := scopesByCategory[T](s.Filters, dataCategories, true) filts := scopesByCategory[T](s.Filters, dataCategories, true)
incls := scopesByCategory[T](s.Includes, dataCategories, false) incls := scopesByCategory[T](s.Includes, dataCategories, false)
ents := []details.DetailsEntry{} ents := []details.Entry{}
// for each entry, compare that entry against the scopes of the same data type // for each entry, compare that entry against the scopes of the same data type
for _, ent := range deets.Items() { for _, ent := range deets.Items() {
@ -441,7 +441,7 @@ func scopesByCategory[T scopeT, C categoryT](
func passes[T scopeT, C categoryT]( func passes[T scopeT, C categoryT](
cat C, cat C,
pathValues map[categorizer][]string, pathValues map[categorizer][]string,
entry details.DetailsEntry, entry details.Entry,
excs, filts, incs []T, excs, filts, incs []T,
) bool { ) bool {
// a passing match requires either a filter or an inclusion // a passing match requires either a filter or an inclusion
@ -490,7 +490,7 @@ func matchesEntry[T scopeT, C categoryT](
sc T, sc T,
cat C, cat C,
pathValues map[categorizer][]string, pathValues map[categorizer][]string,
entry details.DetailsEntry, entry details.Entry,
) bool { ) bool {
// InfoCategory requires matching against service-specific info values // InfoCategory requires matching against service-specific info values
if len(getInfoCategory(sc)) > 0 { if len(getInfoCategory(sc)) > 0 {

View File

@ -257,7 +257,7 @@ func (suite *SelectorScopesSuite) TestReduce() {
deets := func() details.Details { deets := func() details.Details {
return details.Details{ return details.Details{
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{ Entries: []details.Entry{
{ {
RepoRef: stubRepoRef( RepoRef: stubRepoRef(
pathServiceStub, pathServiceStub,
@ -302,7 +302,7 @@ func (suite *SelectorScopesSuite) TestReduce_locationRef() {
deets := func() details.Details { deets := func() details.Details {
return details.Details{ return details.Details{
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{ Entries: []details.Entry{
{ {
RepoRef: stubRepoRef( RepoRef: stubRepoRef(
pathServiceStub, pathServiceStub,
@ -361,7 +361,7 @@ func (suite *SelectorScopesSuite) TestPasses() {
var ( var (
cat = rootCatStub cat = rootCatStub
pth = stubPath(suite.T(), "uid", []string{"fld"}, path.EventsCategory) pth = stubPath(suite.T(), "uid", []string{"fld"}, path.EventsCategory)
entry = details.DetailsEntry{ entry = details.Entry{
RepoRef: pth.String(), RepoRef: pth.String(),
} }
) )

View File

@ -31,7 +31,7 @@ func (suite *SelectorReduceSuite) TestReduce() {
table := []struct { table := []struct {
name string name string
selFunc func() selectors.Reducer selFunc func() selectors.Reducer
expected []details.DetailsEntry expected []details.Entry
}{ }{
{ {
name: "ExchangeAllMail", name: "ExchangeAllMail",
@ -63,7 +63,7 @@ func (suite *SelectorReduceSuite) TestReduce() {
return sel return sel
}, },
expected: []details.DetailsEntry{testdata.ExchangeEmailItems[0]}, expected: []details.Entry{testdata.ExchangeEmailItems[0]},
}, },
{ {
name: "ExchangeMailSubjectExcludeItem", name: "ExchangeMailSubjectExcludeItem",
@ -77,7 +77,7 @@ func (suite *SelectorReduceSuite) TestReduce() {
return sel return sel
}, },
expected: []details.DetailsEntry{testdata.ExchangeEmailItems[0]}, expected: []details.Entry{testdata.ExchangeEmailItems[0]},
}, },
{ {
name: "ExchangeMailSender", name: "ExchangeMailSender",
@ -87,7 +87,7 @@ func (suite *SelectorReduceSuite) TestReduce() {
return sel return sel
}, },
expected: []details.DetailsEntry{ expected: []details.Entry{
testdata.ExchangeEmailItems[0], testdata.ExchangeEmailItems[0],
testdata.ExchangeEmailItems[1], testdata.ExchangeEmailItems[1],
}, },
@ -102,7 +102,7 @@ func (suite *SelectorReduceSuite) TestReduce() {
return sel return sel
}, },
expected: []details.DetailsEntry{testdata.ExchangeEmailItems[0]}, expected: []details.Entry{testdata.ExchangeEmailItems[0]},
}, },
{ {
name: "ExchangeMailID", name: "ExchangeMailID",
@ -115,7 +115,7 @@ func (suite *SelectorReduceSuite) TestReduce() {
return sel return sel
}, },
expected: []details.DetailsEntry{testdata.ExchangeEmailItems[0]}, expected: []details.Entry{testdata.ExchangeEmailItems[0]},
}, },
{ {
name: "ExchangeMailShortRef", name: "ExchangeMailShortRef",
@ -128,7 +128,7 @@ func (suite *SelectorReduceSuite) TestReduce() {
return sel return sel
}, },
expected: []details.DetailsEntry{testdata.ExchangeEmailItems[0]}, expected: []details.Entry{testdata.ExchangeEmailItems[0]},
}, },
{ {
name: "ExchangeAllEventsAndMailWithSubject", name: "ExchangeAllEventsAndMailWithSubject",
@ -142,7 +142,7 @@ func (suite *SelectorReduceSuite) TestReduce() {
return sel return sel
}, },
expected: []details.DetailsEntry{testdata.ExchangeEmailItems[0]}, expected: []details.Entry{testdata.ExchangeEmailItems[0]},
}, },
{ {
name: "ExchangeEventsAndMailWithSubject", name: "ExchangeEventsAndMailWithSubject",
@ -153,7 +153,7 @@ func (suite *SelectorReduceSuite) TestReduce() {
return sel return sel
}, },
expected: []details.DetailsEntry{}, expected: []details.Entry{},
}, },
{ {
name: "ExchangeAll", name: "ExchangeAll",
@ -166,7 +166,7 @@ func (suite *SelectorReduceSuite) TestReduce() {
expected: append( expected: append(
append( append(
append( append(
[]details.DetailsEntry{}, []details.Entry{},
testdata.ExchangeEmailItems...), testdata.ExchangeEmailItems...),
testdata.ExchangeContactsItems...), testdata.ExchangeContactsItems...),
testdata.ExchangeEventsItems..., testdata.ExchangeEventsItems...,
@ -182,7 +182,7 @@ func (suite *SelectorReduceSuite) TestReduce() {
return sel return sel
}, },
expected: []details.DetailsEntry{testdata.ExchangeEmailItems[0]}, expected: []details.Entry{testdata.ExchangeEmailItems[0]},
}, },
// TODO (keepers): all folders are treated as prefix-matches at this time. // TODO (keepers): all folders are treated as prefix-matches at this time.
// so this test actually does nothing different. In the future, we'll // so this test actually does nothing different. In the future, we'll
@ -198,7 +198,7 @@ func (suite *SelectorReduceSuite) TestReduce() {
return sel return sel
}, },
expected: []details.DetailsEntry{testdata.ExchangeEmailItems[0]}, expected: []details.Entry{testdata.ExchangeEmailItems[0]},
}, },
{ {
name: "ExchangeMailByFolderRoot", name: "ExchangeMailByFolderRoot",
@ -222,7 +222,7 @@ func (suite *SelectorReduceSuite) TestReduce() {
return sel return sel
}, },
expected: []details.DetailsEntry{testdata.ExchangeContactsItems[0]}, expected: []details.Entry{testdata.ExchangeContactsItems[0]},
}, },
{ {
name: "ExchangeContactByFolderRoot", name: "ExchangeContactByFolderRoot",
@ -247,7 +247,7 @@ func (suite *SelectorReduceSuite) TestReduce() {
return sel return sel
}, },
expected: []details.DetailsEntry{testdata.ExchangeEventsItems[0]}, expected: []details.Entry{testdata.ExchangeEventsItems[0]},
}, },
{ {
name: "ExchangeEventsByFolderRoot", name: "ExchangeEventsByFolderRoot",

View File

@ -516,7 +516,7 @@ func (c sharePointCategory) isLeaf() bool {
// => {spFolder: folder, spItemID: itemID} // => {spFolder: folder, spItemID: itemID}
func (c sharePointCategory) pathValues( func (c sharePointCategory) pathValues(
repo path.Path, repo path.Path,
ent details.DetailsEntry, ent details.Entry,
cfg Config, cfg Config,
) (map[categorizer][]string, error) { ) (map[categorizer][]string, error) {
var ( var (

View File

@ -253,7 +253,7 @@ func (suite *SharePointSelectorSuite) TestSharePointRestore_Reduce() {
deets := &details.Details{ deets := &details.Details{
DetailsModel: details.DetailsModel{ DetailsModel: details.DetailsModel{
Entries: []details.DetailsEntry{ Entries: []details.Entry{
{ {
RepoRef: item, RepoRef: item,
ItemRef: "item", ItemRef: "item",
@ -478,7 +478,7 @@ func (suite *SharePointSelectorSuite) TestSharePointCategory_PathValues() {
test.pathElems...) test.pathElems...)
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
ent := details.DetailsEntry{ ent := details.Entry{
RepoRef: itemPath.String(), RepoRef: itemPath.String(),
ShortRef: shortRef, ShortRef: shortRef,
ItemRef: itemPath.Item(), ItemRef: itemPath.Item(),