@@ -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.
161165func (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.
350370func (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.
363385type 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.
401424func (mrd * MultiRangeDownloader ) Close () error {
402425 err := mrd .reader .close ()
403426 trace .EndSpan (mrd .ctx , err )
@@ -416,16 +439,3 @@ func (mrd *MultiRangeDownloader) Wait() {
416439func (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- }
0 commit comments