Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flaky blobs caps systemtest #77

Merged
merged 7 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions azblob/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,27 @@ import (

azStorageBlob "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"

"github.com/datatrails/go-datatrails-common/logger"
"github.com/datatrails/go-datatrails-common/tracing"
)

// Count counts the number of blobs filtered by the given tags filter
func (azp *Storer) Count(ctx context.Context, tagsFilter string, opts ...Option) (int64, error) {

logger.Sugar.Debugf("Count")

r, err := azp.FilteredList(ctx, tagsFilter, opts...)
if err != nil {
return 0, err
}

return int64(len(r.Items)), nil
var count int64
var m ListMarker

for {
r, err := azp.FilteredList(ctx, tagsFilter, append(opts, WithListMarker(m))...)
if err != nil {
return 0, err
}
count += int64(len(r.Items))
if r.Marker == nil || *r.Marker == "" {
break
}
eccles marked this conversation as resolved.
Show resolved Hide resolved
m = r.Marker
}
return count, nil
}

type FilterResponse struct {
Expand Down Expand Up @@ -92,12 +98,11 @@ func (azp *Storer) FilteredList(ctx context.Context, tagsFilter string, opts ...
Items: resp.Blobs,
}

r.Marker = resp.NextMarker
robinbryce marked this conversation as resolved.
Show resolved Hide resolved
if r.Marker != nil {
span.SetTag("nextmarker", *r.Marker)
}

return r, err
return r, nil
}

type ListerResponse struct {
Expand Down
11 changes: 11 additions & 0 deletions azblob/logger.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package azblob

import (
"github.com/datatrails/go-datatrails-common/logger"
)

const (
DebugLevel = logger.DebugLevel
)

type Logger = logger.Logger
2 changes: 2 additions & 0 deletions azblob/storer.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ type Storer struct {
containerURL string
containerClient *ContainerClient
serviceClient *ServiceClient

log Logger
}

// New returns new az blob read/write object
Expand Down
Loading