From e153c438113bf7ea2dfaacb1945fb67a2d250cad Mon Sep 17 00:00:00 2001 From: Danny Adams Date: Fri, 20 Jan 2023 22:15:41 -0500 Subject: [PATCH] Updates to /internal/connector/sharepoint/collection.go Abstraction applied to pipeline to dynamically populate List objects. Page objects are currently stubbed out. --- .../connector/sharepoint/collection.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/internal/connector/sharepoint/collection.go b/src/internal/connector/sharepoint/collection.go index b392bde9e..3dde5f323 100644 --- a/src/internal/connector/sharepoint/collection.go +++ b/src/internal/connector/sharepoint/collection.go @@ -191,10 +191,15 @@ func (sc *Collection) populate(ctx context.Context) { // do the other thing metrics, errs = sc.retrievePages(ctx, writer, colProgress) } - } -func (sc *Collection) retrieveLists(ctx context.Context, wtr *kw.JsonSerializationWriter, progress chan<- struct{}) (numMetrics, error) { +// retrieveLists utility function for collection that downloads and serializes +// models.Listable objects based on M365 IDs from the jobs field. +func (sc *Collection) retrieveLists( + ctx context.Context, + wtr *kw.JsonSerializationWriter, + progress chan<- struct{}, +) (numMetrics, error) { var ( errs error metrics numMetrics @@ -209,9 +214,9 @@ func (sc *Collection) retrieveLists(ctx context.Context, wtr *kw.JsonSerializati } metrics.attempts += len(lists) - // Write Data and Send + // For each models.Listable, object is serialized and the metrics are collected. + // The progress is objected via the passed in channel. for _, lst := range lists { - byteArray, err := serializeContent(wtr, lst) if err != nil { errs = support.WrapAndAppend(*lst.GetId(), err, errs) @@ -243,7 +248,11 @@ func (sc *Collection) retrieveLists(ctx context.Context, wtr *kw.JsonSerializati return metrics, nil } -func (sc *Collection) retrievePages(ctx context.Context, wtr *kw.JsonSerializationWriter, progress chan<- struct{}) (numMetrics, error) { +func (sc *Collection) retrievePages( + ctx context.Context, + wtr *kw.JsonSerializationWriter, + progress chan<- struct{}, +) (numMetrics, error) { return numMetrics{}, nil }