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

Dev/robin/9780 veracity verify consistency command #24

Merged
merged 17 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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
2 changes: 2 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ includes:
gotest:
taskfile: ./taskfiles/Taskfile_gotest.yml
dir: ./taskfiles
mock:
taskfile: ./taskfiles/Taskfile_mockery.yml

tasks:

Expand Down
21 changes: 3 additions & 18 deletions massifs/bloblast.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"

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

Expand All @@ -15,7 +14,7 @@ var (
// LastPrefixedBlob returns the details of last blob found under the prefix path
// And the total number of blobs under the path.
func LastPrefixedBlob(
ctx context.Context, store logBlobReader, blobPrefixPath string,
ctx context.Context, store LogBlobReader, blobPrefixPath string,
opts ...azblob.Option,
) (LogBlobContext, uint64, error) {

Expand Down Expand Up @@ -57,7 +56,7 @@ func LastPrefixedBlob(

// FirstPrefixedBlob returns the first blob found under the prefix path
func FirstPrefixedBlob(
ctx context.Context, store logBlobReader, blobPrefixPath string,
ctx context.Context, store LogBlobReader, blobPrefixPath string,
opts ...azblob.Option,
) (LogBlobContext, error) {

Expand Down Expand Up @@ -94,7 +93,7 @@ func FirstPrefixedBlob(
// Un filled items are zero valued.
func PrefixedBlobLastN(
ctx context.Context,
store logBlobReader,
store LogBlobReader,
blobPrefixPath string,
n int,
opts ...azblob.Option,
Expand Down Expand Up @@ -152,17 +151,3 @@ func PrefixedBlobLastN(
// Note massifIndex will be zero, the id of the first massif blob
return tail, foundCount, nil
}

func listResponseTags(blobTags *azStorageBlob.BlobTags) map[string]string {
if blobTags == nil {
return nil
}
tags := map[string]string{}
for _, tag := range blobTags.BlobTagSet {
if tag.Key == nil || tag.Value == nil {
continue
}
tags[*tag.Key] = *tag.Value
}
return tags
}
6 changes: 3 additions & 3 deletions massifs/bloblast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

func TestLastPrefixedBlob(t *testing.T) {
type args struct {
store logBlobReader
store LogBlobReader
}
tests := []struct {
name string
Expand Down Expand Up @@ -64,7 +64,7 @@ func TestLastPrefixedBlob(t *testing.T) {
func TestPrefixedBlobLastN(t *testing.T) {

type args struct {
store logBlobReader
store LogBlobReader
n int
}
tests := []struct {
Expand Down Expand Up @@ -146,7 +146,7 @@ func TestPrefixedBlobLastN(t *testing.T) {
}
}

func newLastNBlobStore(itemCounts ...int) logBlobReader {
func newLastNBlobStore(itemCounts ...int) LogBlobReader {

series := newmockblobseries(itemCounts...)
return &mockLastNBlobStore{
Expand Down
21 changes: 21 additions & 0 deletions massifs/bloblastlistresponsetags.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package massifs

// this file exists to avoid an ugly package alias

import (
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func listResponseTags(blobTags *azblob.BlobTags) map[string]string {
if blobTags == nil {
return nil
}
tags := map[string]string{}
for _, tag := range blobTags.BlobTagSet {
if tag.Key == nil || tag.Value == nil {
continue
}
tags[*tag.Key] = *tag.Value
}
return tags
}
2 changes: 1 addition & 1 deletion massifs/blobread.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

// BlobRead reads the blob of the given store.
func BlobRead(
ctx context.Context, blobPath string, store logBlobReader,
ctx context.Context, blobPath string, store LogBlobReader,
opts ...azblob.Option) (*azblob.ReaderResponse, []byte, error) {

rr, err := store.Reader(ctx, blobPath, opts...)
Expand Down
2 changes: 1 addition & 1 deletion massifs/blobreader.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/datatrails/go-datatrails-common/azblob"
)

type logBlobReader interface {
type LogBlobReader interface {
Reader(
ctx context.Context,
identity string,
Expand Down
6 changes: 3 additions & 3 deletions massifs/enumeratepaths.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/datatrails/go-datatrails-common/logger"
)

type VisitFilterResponse func(ctx context.Context, store logBlobReader, it *azStorageBlob.FilterBlobItem) (bool, error)
type VisitFilterResponse func(ctx context.Context, store LogBlobReader, it *azStorageBlob.FilterBlobItem) (bool, error)

// FilterBlobs selects blobs using the provided filter expression
// and application of the provided visitor (which may be nil)
Expand All @@ -19,7 +19,7 @@ type VisitFilterResponse func(ctx context.Context, store logBlobReader, it *azSt
// All blobs in a specific container
// "@container='zoo' AND cat='tiger' AND penguin='emperorpenguin'"
func FilterBlobs(
ctx context.Context, store logBlobReader,
ctx context.Context, store LogBlobReader,
tagsFilter string,
visit VisitFilterResponse,
marker azblob.ListMarker,
Expand Down Expand Up @@ -73,7 +73,7 @@ type ParseIdentifyingSegment func(blobPath string) (string, error)
// those keys. If the parse callback errors, the enumeration is terminated and
// that error is returned.
func EnumerateIdentifiedPaths(
ctx context.Context, store logBlobReader, blobPrefixPath string,
ctx context.Context, store LogBlobReader, blobPrefixPath string,
parseID ParseIdentifyingSegment,
found map[string]any,
marker azblob.ListMarker,
Expand Down
2 changes: 1 addition & 1 deletion massifs/enumeratepaths_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestEnumerateTenants(t *testing.T) {
seed := int64((1698342521) * 1000)
g := mmrtesting.NewTestGenerator(t, seed, mmrtesting.TestGeneratorConfig{
StartTimeMS: seed, EventRate: 500,
TestLabelPrefix: "TestEnumerateTenants"}, generateNumberedLeaf)
TestLabelPrefix: "TestEnumerateTenants"}, MMRTestingGenerateNumberedLeaf)

type args struct {
batches []tenantBatch
Expand Down
1 change: 1 addition & 0 deletions massifs/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ require (
github.com/openzipkin/zipkin-go v0.4.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.uber.org/automaxprocs v1.5.3 // indirect
go.uber.org/multierr v1.11.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions massifs/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
Expand Down
Loading
Loading