Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Rename existing Exchange collection implementation (#4285)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ashmrtn authored Sep 19, 2023
1 parent a60d599 commit 6355cb7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
18 changes: 9 additions & 9 deletions src/internal/m365/collection/exchange/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,8 @@ func (suite *BackupIntgSuite) TestDelta() {
// a sanity check that the minimum behavior won't break.
for _, coll := range collections {
if coll.FullPath().Service() != path.ExchangeMetadataService {
ec, ok := coll.(*Collection)
require.True(t, ok, "collection is *Collection")
ec, ok := coll.(*prefetchCollection)
require.True(t, ok, "collection is *prefetchCollection")
assert.NotNil(t, ec)
}
}
Expand Down Expand Up @@ -697,7 +697,7 @@ func (suite *BackupIntgSuite) TestMailSerializationRegression() {
}

// 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.
func (suite *BackupIntgSuite) TestContactSerializationRegression() {
var (
Expand Down Expand Up @@ -1176,8 +1176,8 @@ func (suite *CollectionPopulationSuite) TestPopulateCollections() {
continue
}

exColl, ok := coll.(*Collection)
require.True(t, ok, "collection is an *exchange.Collection")
exColl, ok := coll.(*prefetchCollection)
require.True(t, ok, "collection is an *exchange.prefetchCollection")

ids := [][]string{
make([]string, 0, len(exColl.added)),
Expand Down Expand Up @@ -1511,8 +1511,8 @@ func (suite *CollectionPopulationSuite) TestFilterContainersAndFillCollections_D
continue
}

exColl, ok := coll.(*Collection)
require.True(t, ok, "collection is an *exchange.Collection")
exColl, ok := coll.(*prefetchCollection)
require.True(t, ok, "collection is an *exchange.prefetchCollection")

ids := [][]string{
make([]string, 0, len(exColl.added)),
Expand Down Expand Up @@ -1677,8 +1677,8 @@ func (suite *CollectionPopulationSuite) TestFilterContainersAndFillCollections_r
continue
}

exColl, ok := coll.(*Collection)
require.True(t, ok, "collection is an *exchange.Collection")
exColl, ok := coll.(*prefetchCollection)
require.True(t, ok, "collection is an *exchange.prefetchCollection")

assert.Equal(t, test.expectAdded, exColl.added, "added items")
assert.Equal(t, test.expectRemoved, exColl.removed, "removed items")
Expand Down
14 changes: 7 additions & 7 deletions src/internal/m365/collection/exchange/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
)

var (
_ data.BackupCollection = &Collection{}
_ data.BackupCollection = &prefetchCollection{}
_ data.Item = &Item{}
_ data.ItemInfo = &Item{}
_ data.ItemModTime = &Item{}
Expand Down Expand Up @@ -175,8 +175,8 @@ func NewCollection(
user string,
items itemGetterSerializer,
statusUpdater support.StatusUpdater,
) Collection {
collection := Collection{
) prefetchCollection {
collection := prefetchCollection{
baseCollection: bc,
user: user,
added: map[string]struct{}{},
Expand All @@ -188,9 +188,9 @@ func NewCollection(
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
type Collection struct {
type prefetchCollection struct {
baseCollection

user string
Expand All @@ -207,7 +207,7 @@ type Collection struct {

// Items utility function to asynchronously execute process to fill data channel with
// 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)
go col.streamItems(ctx, stream, errs)

Expand All @@ -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
// 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,
stream chan<- data.Item,
errs *fault.Bus,
Expand Down
2 changes: 1 addition & 1 deletion src/internal/m365/collection/exchange/collection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (suite *CollectionUnitSuite) TestCollection_NewCollection() {
folder)
require.NoError(t, err, clues.ToCore(err))

edc := Collection{
edc := prefetchCollection{
baseCollection: baseCollection{
fullPath: fullPath,
},
Expand Down

0 comments on commit 6355cb7

Please sign in to comment.