Rename existing Exchange collection implementation (#4285)
Will be making another collection type based on the same skeleton. No logic changes in this PR, just naming. --- #### Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No #### Type of change - [ ] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [x] 🧹 Tech Debt/Cleanup #### Issue(s) * #2023 #### Test Plan - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
a60d599eaa
commit
6355cb7bad
@ -617,8 +617,8 @@ func (suite *BackupIntgSuite) TestDelta() {
|
|||||||
// a sanity check that the minimum behavior won't break.
|
// a sanity check that the minimum behavior won't break.
|
||||||
for _, coll := range collections {
|
for _, coll := range collections {
|
||||||
if coll.FullPath().Service() != path.ExchangeMetadataService {
|
if coll.FullPath().Service() != path.ExchangeMetadataService {
|
||||||
ec, ok := coll.(*Collection)
|
ec, ok := coll.(*prefetchCollection)
|
||||||
require.True(t, ok, "collection is *Collection")
|
require.True(t, ok, "collection is *prefetchCollection")
|
||||||
assert.NotNil(t, ec)
|
assert.NotNil(t, ec)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -697,7 +697,7 @@ func (suite *BackupIntgSuite) TestMailSerializationRegression() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TestContactSerializationRegression verifies ability to query contact items
|
// TestContactSerializationRegression verifies ability to query contact items
|
||||||
// and to store contact within Collection. Downloaded contacts are run through
|
// and to store contact within prefetchCollection. Downloaded contacts are run through
|
||||||
// a regression test to ensure that downloaded items can be uploaded.
|
// a regression test to ensure that downloaded items can be uploaded.
|
||||||
func (suite *BackupIntgSuite) TestContactSerializationRegression() {
|
func (suite *BackupIntgSuite) TestContactSerializationRegression() {
|
||||||
var (
|
var (
|
||||||
@ -1176,8 +1176,8 @@ func (suite *CollectionPopulationSuite) TestPopulateCollections() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
exColl, ok := coll.(*Collection)
|
exColl, ok := coll.(*prefetchCollection)
|
||||||
require.True(t, ok, "collection is an *exchange.Collection")
|
require.True(t, ok, "collection is an *exchange.prefetchCollection")
|
||||||
|
|
||||||
ids := [][]string{
|
ids := [][]string{
|
||||||
make([]string, 0, len(exColl.added)),
|
make([]string, 0, len(exColl.added)),
|
||||||
@ -1511,8 +1511,8 @@ func (suite *CollectionPopulationSuite) TestFilterContainersAndFillCollections_D
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
exColl, ok := coll.(*Collection)
|
exColl, ok := coll.(*prefetchCollection)
|
||||||
require.True(t, ok, "collection is an *exchange.Collection")
|
require.True(t, ok, "collection is an *exchange.prefetchCollection")
|
||||||
|
|
||||||
ids := [][]string{
|
ids := [][]string{
|
||||||
make([]string, 0, len(exColl.added)),
|
make([]string, 0, len(exColl.added)),
|
||||||
@ -1677,8 +1677,8 @@ func (suite *CollectionPopulationSuite) TestFilterContainersAndFillCollections_r
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
exColl, ok := coll.(*Collection)
|
exColl, ok := coll.(*prefetchCollection)
|
||||||
require.True(t, ok, "collection is an *exchange.Collection")
|
require.True(t, ok, "collection is an *exchange.prefetchCollection")
|
||||||
|
|
||||||
assert.Equal(t, test.expectAdded, exColl.added, "added items")
|
assert.Equal(t, test.expectAdded, exColl.added, "added items")
|
||||||
assert.Equal(t, test.expectRemoved, exColl.removed, "removed items")
|
assert.Equal(t, test.expectRemoved, exColl.removed, "removed items")
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ data.BackupCollection = &Collection{}
|
_ data.BackupCollection = &prefetchCollection{}
|
||||||
_ data.Item = &Item{}
|
_ data.Item = &Item{}
|
||||||
_ data.ItemInfo = &Item{}
|
_ data.ItemInfo = &Item{}
|
||||||
_ data.ItemModTime = &Item{}
|
_ data.ItemModTime = &Item{}
|
||||||
@ -175,8 +175,8 @@ func NewCollection(
|
|||||||
user string,
|
user string,
|
||||||
items itemGetterSerializer,
|
items itemGetterSerializer,
|
||||||
statusUpdater support.StatusUpdater,
|
statusUpdater support.StatusUpdater,
|
||||||
) Collection {
|
) prefetchCollection {
|
||||||
collection := Collection{
|
collection := prefetchCollection{
|
||||||
baseCollection: bc,
|
baseCollection: bc,
|
||||||
user: user,
|
user: user,
|
||||||
added: map[string]struct{}{},
|
added: map[string]struct{}{},
|
||||||
@ -188,9 +188,9 @@ func NewCollection(
|
|||||||
return collection
|
return collection
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collection implements the interface from data.Collection
|
// prefetchCollection implements the interface from data.BackupCollection
|
||||||
// Structure holds data for an Exchange application for a single user
|
// Structure holds data for an Exchange application for a single user
|
||||||
type Collection struct {
|
type prefetchCollection struct {
|
||||||
baseCollection
|
baseCollection
|
||||||
|
|
||||||
user string
|
user string
|
||||||
@ -207,7 +207,7 @@ type Collection struct {
|
|||||||
|
|
||||||
// Items utility function to asynchronously execute process to fill data channel with
|
// Items utility function to asynchronously execute process to fill data channel with
|
||||||
// M365 exchange objects and returns the data channel
|
// M365 exchange objects and returns the data channel
|
||||||
func (col *Collection) Items(ctx context.Context, errs *fault.Bus) <-chan data.Item {
|
func (col *prefetchCollection) Items(ctx context.Context, errs *fault.Bus) <-chan data.Item {
|
||||||
stream := make(chan data.Item, collectionChannelBufferSize)
|
stream := make(chan data.Item, collectionChannelBufferSize)
|
||||||
go col.streamItems(ctx, stream, errs)
|
go col.streamItems(ctx, stream, errs)
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ func (col *Collection) Items(ctx context.Context, errs *fault.Bus) <-chan data.I
|
|||||||
|
|
||||||
// streamItems is a utility function that uses col.collectionType to be able to serialize
|
// streamItems is a utility function that uses col.collectionType to be able to serialize
|
||||||
// all the M365IDs defined in the added field. data channel is closed by this function
|
// all the M365IDs defined in the added field. data channel is closed by this function
|
||||||
func (col *Collection) streamItems(
|
func (col *prefetchCollection) streamItems(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
stream chan<- data.Item,
|
stream chan<- data.Item,
|
||||||
errs *fault.Bus,
|
errs *fault.Bus,
|
||||||
|
|||||||
@ -71,7 +71,7 @@ func (suite *CollectionUnitSuite) TestCollection_NewCollection() {
|
|||||||
folder)
|
folder)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
edc := Collection{
|
edc := prefetchCollection{
|
||||||
baseCollection: baseCollection{
|
baseCollection: baseCollection{
|
||||||
fullPath: fullPath,
|
fullPath: fullPath,
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user