Skip to content

Commit 4ec1d66

Browse files
authored
docs(storage): add preview comment to NewMultiRangeDownloader (#11420)
* docs(storage): add preview comment to NewMultiRangeDownloader * Add preview note to append
1 parent 0ddf338 commit 4ec1d66

3 files changed

Lines changed: 28 additions & 17 deletions

File tree

‎storage/reader.go‎

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ func (o *ObjectHandle) NewRangeReader(ctx context.Context, offset, length int64)
158158
}
159159

160160
// NewMultiRangeDownloader creates a multi-range reader for an object.
161+
// Must be called on a gRPC client created using [NewGRPCClient].
162+
//
163+
// This uses the gRPC-specific bi-directional read API, which is in private
164+
// preview; please contact your account manager if interested.
161165
func (o *ObjectHandle) NewMultiRangeDownloader(ctx context.Context) (mrd *MultiRangeDownloader, err error) {
162166
// This span covers the life of the reader. It is closed via the context
163167
// in Reader.Close.
@@ -344,8 +348,24 @@ func (r *Reader) LastModified() (time.Time, error) {
344348
return r.Attrs.LastModified, nil
345349
}
346350

351+
// Metadata returns user-provided metadata, in key/value pairs.
352+
//
353+
// It can be nil if no metadata is present, or if the client uses the JSON
354+
// API for downloads. Only the XML and gRPC APIs support getting
355+
// custom metadata via the Reader; for JSON make a separate call to
356+
// ObjectHandle.Attrs.
357+
func (r *Reader) Metadata() map[string]string {
358+
if r.objectMetadata != nil {
359+
return *r.objectMetadata
360+
}
361+
return nil
362+
}
363+
347364
// ReadHandle returns the read handle associated with an object.
348-
// Read Handle will be periodically refreshed.
365+
// ReadHandle will be periodically refreshed.
366+
//
367+
// ReadHandle requires the gRPC-specific bi-directional read API, which is in
368+
// private preview; please contact your account manager if interested.
349369
// Note that this only valid for gRPC and only with zonal buckets.
350370
func (r *Reader) ReadHandle() ReadHandle {
351371
if r.handle == nil {
@@ -360,6 +380,8 @@ func (r *Reader) ReadHandle() ReadHandle {
360380
//
361381
// Typically, a MultiRangeDownloader opens a stream to which we can add
362382
// different ranges to read from the object.
383+
//
384+
// This API is currently in preview and is not yet available for general use.
363385
type MultiRangeDownloader struct {
364386
Attrs ReaderObjectAttrs
365387
reader multiRangeDownloader
@@ -398,6 +420,7 @@ func (mrd *MultiRangeDownloader) Add(output io.Writer, offset, length int64, cal
398420
//
399421
// This will immediately close the stream and can result in a
400422
// "stream closed early" error if a response for a range is still not processed.
423+
// Call [MultiRangeDownloader.Wait] to avoid this error.
401424
func (mrd *MultiRangeDownloader) Close() error {
402425
err := mrd.reader.close()
403426
trace.EndSpan(mrd.ctx, err)
@@ -416,16 +439,3 @@ func (mrd *MultiRangeDownloader) Wait() {
416439
func (mrd *MultiRangeDownloader) GetHandle() []byte {
417440
return mrd.reader.getHandle()
418441
}
419-
420-
// Metadata returns user-provided metadata, in key/value pairs.
421-
//
422-
// It can be nil if no metadata is present, or if the client uses the JSON
423-
// API for downloads. Only the XML and gRPC APIs support getting
424-
// custom metadata via the Reader; for JSON make a separate call to
425-
// ObjectHandle.Attrs.
426-
func (r *Reader) Metadata() map[string]string {
427-
if r.objectMetadata != nil {
428-
return *r.objectMetadata
429-
}
430-
return nil
431-
}

‎storage/storage.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ func signedURLV2(bucket, name string, opts *SignedURLOptions) (string, error) {
937937
return u.String(), nil
938938
}
939939

940-
// ReadHandle associated with the object. This would be periodically refreshed.
940+
// ReadHandle associated with the object. This is periodically refreshed.
941941
type ReadHandle []byte
942942

943943
// ObjectHandle provides operations on an object in a Google Cloud Storage bucket.
@@ -965,7 +965,7 @@ type ObjectHandle struct {
965965
// This produces the exact same object and generation and does not check if
966966
// the generation is still the newest one.
967967
// Note that this will be a noop unless it's set on a gRPC client on buckets with
968-
// appendable write access.
968+
// bi-directional read API access.
969969
// Also note that you can get a ReadHandle only via calling reader.ReadHandle() on a
970970
// previous read of the same object.
971971
func (o *ObjectHandle) ReadHandle(r ReadHandle) *ObjectHandle {

‎storage/writer.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ type Writer struct {
107107
// visible on the first Write() call, and can be appended to until they are
108108
// finalized. The object is finalized on a call to Close().
109109
//
110-
// Append is only supported for gRPC.
110+
// Append is only supported for gRPC. This feature is in preview and is not
111+
// yet available for general use.
111112
Append bool
112113

113114
// ProgressFunc can be used to monitor the progress of a large write

0 commit comments

Comments
 (0)