Skip to content

Commit b4d86a5

Browse files
feat(storage): merge support for bi-directional multiple range reads (#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 <danielduhh@gmail.com>
1 parent 238ac1c commit b4d86a5

29 files changed

Lines changed: 7007 additions & 2968 deletions

storage/bucket_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,11 +1119,11 @@ func TestBucketRetryer(t *testing.T) {
11191119
WithErrorFunc(func(err error) bool { return false }))
11201120
},
11211121
want: &retryConfig{
1122-
backoff: gaxBackoffFromStruct(&gax.Backoff{
1122+
backoff: &gax.Backoff{
11231123
Initial: 2 * time.Second,
11241124
Max: 30 * time.Second,
11251125
Multiplier: 3,
1126-
}),
1126+
},
11271127
policy: RetryAlways,
11281128
maxAttempts: expectedAttempts(5),
11291129
shouldRetry: func(err error) bool { return false },
@@ -1138,9 +1138,9 @@ func TestBucketRetryer(t *testing.T) {
11381138
}))
11391139
},
11401140
want: &retryConfig{
1141-
backoff: gaxBackoffFromStruct(&gax.Backoff{
1141+
backoff: &gax.Backoff{
11421142
Multiplier: 3,
1143-
})},
1143+
}},
11441144
},
11451145
{
11461146
name: "set policy only",

storage/client.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ type storageClient interface {
108108
ListNotifications(ctx context.Context, bucket string, opts ...storageOption) (map[string]*Notification, error)
109109
CreateNotification(ctx context.Context, bucket string, n *Notification, opts ...storageOption) (*Notification, error)
110110
DeleteNotification(ctx context.Context, bucket string, id string, opts ...storageOption) error
111+
112+
NewMultiRangeDownloader(ctx context.Context, params *newMultiRangeDownloaderParams, opts ...storageOption) (*MultiRangeDownloader, error)
111113
}
112114

113115
// settings contains transport-agnostic configuration for API calls made via
@@ -261,6 +263,9 @@ type openWriterParams struct {
261263
// sendCRC32C - see `Writer.SendCRC32C`.
262264
// Optional.
263265
sendCRC32C bool
266+
// append - Write with appendable object semantics.
267+
// Optional.
268+
append bool
264269

265270
// Writer callbacks
266271

@@ -278,6 +283,15 @@ type openWriterParams struct {
278283
setObj func(*ObjectAttrs)
279284
}
280285

286+
type newMultiRangeDownloaderParams struct {
287+
bucket string
288+
conds *Conditions
289+
encryptionKey []byte
290+
gen int64
291+
object string
292+
handle *ReadHandle
293+
}
294+
281295
type newRangeReaderParams struct {
282296
bucket string
283297
conds *Conditions
@@ -287,6 +301,7 @@ type newRangeReaderParams struct {
287301
object string
288302
offset int64
289303
readCompressed bool // Use accept-encoding: gzip. Only works for HTTP currently.
304+
handle *ReadHandle
290305
}
291306

292307
type getObjectParams struct {

0 commit comments

Comments
 (0)