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

feat(storage): merge support for bi-directional multiple range reads #11377

Merged
merged 11 commits into from
Jan 8, 2025
8 changes: 4 additions & 4 deletions storage/bucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1119,11 +1119,11 @@ func TestBucketRetryer(t *testing.T) {
WithErrorFunc(func(err error) bool { return false }))
},
want: &retryConfig{
backoff: gaxBackoffFromStruct(&gax.Backoff{
backoff: &gax.Backoff{
Initial: 2 * time.Second,
Max: 30 * time.Second,
Multiplier: 3,
}),
},
policy: RetryAlways,
maxAttempts: expectedAttempts(5),
shouldRetry: func(err error) bool { return false },
Expand All @@ -1138,9 +1138,9 @@ func TestBucketRetryer(t *testing.T) {
}))
},
want: &retryConfig{
backoff: gaxBackoffFromStruct(&gax.Backoff{
backoff: &gax.Backoff{
Multiplier: 3,
})},
}},
},
{
name: "set policy only",
Expand Down
15 changes: 15 additions & 0 deletions storage/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ type storageClient interface {
ListNotifications(ctx context.Context, bucket string, opts ...storageOption) (map[string]*Notification, error)
CreateNotification(ctx context.Context, bucket string, n *Notification, opts ...storageOption) (*Notification, error)
DeleteNotification(ctx context.Context, bucket string, id string, opts ...storageOption) error

NewMultiRangeDownloader(ctx context.Context, params *newMultiRangeDownloaderParams, opts ...storageOption) (*MultiRangeDownloader, error)
}

// settings contains transport-agnostic configuration for API calls made via
Expand Down Expand Up @@ -261,6 +263,9 @@ type openWriterParams struct {
// sendCRC32C - see `Writer.SendCRC32C`.
// Optional.
sendCRC32C bool
// append - Write with appendable object semantics.
// Optional.
append bool

// Writer callbacks

Expand All @@ -278,6 +283,15 @@ type openWriterParams struct {
setObj func(*ObjectAttrs)
}

type newMultiRangeDownloaderParams struct {
bucket string
conds *Conditions
encryptionKey []byte
gen int64
object string
handle *ReadHandle
}

type newRangeReaderParams struct {
bucket string
conds *Conditions
Expand All @@ -287,6 +301,7 @@ type newRangeReaderParams struct {
object string
offset int64
readCompressed bool // Use accept-encoding: gzip. Only works for HTTP currently.
handle *ReadHandle
}

type getObjectParams struct {
Expand Down
Loading
Loading