Skip to content

Commit

Permalink
feat(storage): merge support for bi-directional multiple range reads (#…
Browse files Browse the repository at this point in the history
…11377)

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

* add license header

* get object metadata for regular grpc reads

* docs change

* fix offset and remaining bytes calculation

* fix(storage): use mutex for accessing concurrent vars

* remove TestOpenAppendableWriterUnsupportedEmulated

* Add back retry conformance tests to json

* retry tests assume writes are conditionally idempoten

---------

Co-authored-by: Daniel B <[email protected]>
  • Loading branch information
BrennaEpp and danielduhh authored Jan 8, 2025
1 parent 238ac1c commit b4d86a5
Show file tree
Hide file tree
Showing 29 changed files with 7,007 additions and 2,968 deletions.
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

0 comments on commit b4d86a5

Please sign in to comment.