corso/src/internal/m365/debug.go
Keepers 9ecefd2569
use counter in exchange backup enum (#4661)
Increase proliferation of the count bus to record runtime stats.

---

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

- [x]  No

#### Type of change

- [x] 🤖 Supportability/Tests

#### Test Plan

- [x]  Unit test
- [x] 💚 E2E
2023-11-16 23:22:00 +00:00

41 lines
1.3 KiB
Go

package m365
import (
"context"
"github.com/alcionai/clues"
"github.com/alcionai/corso/src/internal/data"
"github.com/alcionai/corso/src/internal/m365/collection/drive"
"github.com/alcionai/corso/src/internal/m365/collection/exchange"
"github.com/alcionai/corso/src/internal/m365/collection/groups"
"github.com/alcionai/corso/src/pkg/count"
"github.com/alcionai/corso/src/pkg/path"
"github.com/alcionai/corso/src/pkg/store"
)
func (ctrl *Controller) DeserializeMetadataFiles(
ctx context.Context,
colls []data.RestoreCollection,
) ([]store.MetadataFile, error) {
if len(colls) == 0 {
return []store.MetadataFile{}, nil
}
// assume all collections refer to the same service
service := colls[0].FullPath().Service()
switch service {
case path.ExchangeService, path.ExchangeMetadataService:
return exchange.DeserializeMetadataFiles(ctx, colls)
case path.OneDriveService, path.OneDriveMetadataService:
return drive.DeserializeMetadataFiles(ctx, colls, count.New())
case path.SharePointService, path.SharePointMetadataService:
return drive.DeserializeMetadataFiles(ctx, colls, count.New())
case path.GroupsService, path.GroupsMetadataService:
return groups.DeserializeMetadataFiles(ctx, colls)
default:
return nil, clues.NewWC(ctx, "unrecognized service").With("service", service)
}
}