Thread contexts through some GC functions (#728)
## Description Will be used later and just generally useful if we ever add tracing or such to these functions. ## Type of change Please check the type of change your PR introduces: - [ ] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Test - [x] 🐹 Trivial/Minor ## Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> #456 ## Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
4a96f2571d
commit
ae28971be3
@ -1,6 +1,7 @@
|
||||
package exchange
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
absser "github.com/microsoft/kiota-abstractions-go/serialization"
|
||||
@ -75,6 +76,7 @@ func loadService(t *testing.T) *exchangeService {
|
||||
// functions are valid for current versioning of msgraph-go-sdk
|
||||
func (suite *ExchangeIteratorSuite) TestIterativeFunctions() {
|
||||
var (
|
||||
ctx = context.Background()
|
||||
t = suite.T()
|
||||
mailScope, contactScope selectors.ExchangeScope
|
||||
userID = tester.M365UserID(t)
|
||||
@ -141,6 +143,7 @@ func (suite *ExchangeIteratorSuite) TestIterativeFunctions() {
|
||||
// callbackFunc iterates through all models.Messageable and fills exchange.Collection.jobs[]
|
||||
// with corresponding item IDs. New collections are created for each directory
|
||||
callbackFunc := test.iterativeFunction(
|
||||
ctx,
|
||||
userID,
|
||||
test.scope,
|
||||
errs, false,
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package exchange
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
@ -29,6 +30,7 @@ type displayable interface {
|
||||
// GraphIterateFuncs are iterate functions to be used with the M365 iterators (e.g. msgraphgocore.NewPageIterator)
|
||||
// @returns a callback func that works with msgraphgocore.PageIterator.Iterate function
|
||||
type GraphIterateFunc func(
|
||||
ctx context.Context,
|
||||
user string,
|
||||
scope selectors.ExchangeScope,
|
||||
errs error,
|
||||
@ -43,6 +45,7 @@ type GraphIterateFunc func(
|
||||
// objects belonging to any folder are
|
||||
// placed into a Collection based on the parent folder
|
||||
func IterateSelectAllDescendablesForCollections(
|
||||
ctx context.Context,
|
||||
user string,
|
||||
scope selectors.ExchangeScope,
|
||||
errs error,
|
||||
@ -108,6 +111,7 @@ func IterateSelectAllDescendablesForCollections(
|
||||
// and storing events in collections based on
|
||||
// the calendarID which originates from M365.
|
||||
func IterateSelectAllEventsForCollections(
|
||||
ctx context.Context,
|
||||
user string,
|
||||
scope selectors.ExchangeScope,
|
||||
errs error,
|
||||
@ -191,6 +195,7 @@ func IterateSelectAllEventsForCollections(
|
||||
// that places exchange mail message ids belonging to specific directories
|
||||
// into a Collection. Messages outside of those directories are omitted.
|
||||
func IterateAndFilterMessagesForCollections(
|
||||
ctx context.Context,
|
||||
user string,
|
||||
scope selectors.ExchangeScope,
|
||||
errs error,
|
||||
@ -204,6 +209,7 @@ func IterateAndFilterMessagesForCollections(
|
||||
return func(messageItem any) bool {
|
||||
if !isFilterSet {
|
||||
err := CollectMailFolders(
|
||||
ctx,
|
||||
scope,
|
||||
user,
|
||||
collections,
|
||||
@ -237,6 +243,7 @@ func IterateAndFilterMessagesForCollections(
|
||||
}
|
||||
|
||||
func IterateFilterFolderDirectoriesForCollections(
|
||||
ctx context.Context,
|
||||
user string,
|
||||
scope selectors.ExchangeScope,
|
||||
errs error,
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package exchange
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
absser "github.com/microsoft/kiota-abstractions-go/serialization"
|
||||
@ -124,6 +125,7 @@ func RetrieveMessageDataForUser(gs graph.Service, user, m365ID string) (absser.P
|
||||
}
|
||||
|
||||
func CollectMailFolders(
|
||||
ctx context.Context,
|
||||
scope selectors.ExchangeScope,
|
||||
user string,
|
||||
collections map[string]*Collection,
|
||||
@ -155,6 +157,7 @@ func CollectMailFolders(
|
||||
}
|
||||
|
||||
callbackFunc := IterateFilterFolderDirectoriesForCollections(
|
||||
ctx,
|
||||
user,
|
||||
scope,
|
||||
err,
|
||||
|
||||
@ -350,7 +350,7 @@ func (gc *GraphConnector) createCollections(
|
||||
// callbackFunc iterates through all M365 object target and fills exchange.Collection.jobs[]
|
||||
// with corresponding item M365IDs. New collections are created for each directory.
|
||||
// Each directory used the M365 Identifier. The use of ID stops collisions betweens users
|
||||
callbackFunc := gIter(user, scope, errs, gc.failFast, gc.credentials, collections, gc.statusCh)
|
||||
callbackFunc := gIter(ctx, user, scope, errs, gc.failFast, gc.credentials, collections, gc.statusCh)
|
||||
iterateError := pageIterator.Iterate(callbackFunc)
|
||||
|
||||
if iterateError != nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user