MCPcopy Create free account
hub / github.com/google/go-cloud / NewRangeReader

Method NewRangeReader

blob/blob.go:1027–1029  ·  view source on GitHub ↗

NewRangeReader returns a Reader to read content from the blob stored at key. It reads at most length bytes starting at offset (>= 0). If length is negative, it will read till the end of the blob. For the purposes of Seek, the returned Reader will start at offset and end at the minimum of the actual

(ctx context.Context, key string, offset, length int64, opts *ReaderOptions)

Source from the content-addressed store, hash-verified

1025//
1026// The caller must call Close on the returned Reader when done reading.
1027func (b *Bucket) NewRangeReader(ctx context.Context, key string, offset, length int64, opts *ReaderOptions) (_ *Reader, err error) {
1028 return b.newRangeReader(ctx, key, offset, length, opts)
1029}
1030
1031func (b *Bucket) newRangeReader(ctx context.Context, key string, offset, length int64, opts *ReaderOptions) (_ *Reader, err error) {
1032 b.mu.RLock()

Callers 4

TestSeekAfterReadFailureFunction · 0.95
TestErrorsAreWrappedFunction · 0.95
TestBucketIsClosedFunction · 0.95

Calls 1

newRangeReaderMethod · 0.95

Tested by 4

TestSeekAfterReadFailureFunction · 0.76
TestErrorsAreWrappedFunction · 0.76
TestBucketIsClosedFunction · 0.76