Skip to content

Commit 0db34ab

Browse files
Revise comment per Go style, and extend
1 parent d108437 commit 0db34ab

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

cache/core/core.go

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,27 @@ type LookupOptions struct {
259259
// value of 0 means to read to the end of the object.
260260
To uint64
261261

262+
// AlwaysUseRequestedRange indicates the provided range should be used
263+
// even when the cached item is concurrently streamed.
264+
//
262265
// By default, if:
266+
//
267+
// - AlwaysUseRequestedRange is false
263268
// - The size of the cached item's body was not provided by the writer
264-
// - The reader requests a specific range of the cached item's body (`From` and `To` are set)
265-
// - The writer and reader are concurrent, i.e. the body is streamed from one to the other
266-
// then today, the core cache API will ignore the requested range and provide the whole body.
269+
// - The reader requests a specific range of the cached item's body
270+
// (`From` and `To` are provided in LookupOptions or GetBodyOptions)
271+
// - The writer and reader are concurrent, i.e. the body is streamed from
272+
// the writer to the reader
273+
//
274+
// then the core cache API will ignore the requested range, and provide
275+
// the entire body.
267276
//
268-
// Setting this flag provides the more intuitive behavior: the range will be respected
269-
// during streaming as well.
277+
// Setting AlwaysUseRequestedRange to true changes this behavior:
278+
// - The reader will block until the start of the requested range has been
279+
// written by the writer. This blocking happens within the
280+
// TransactionLookup or Lookup call (if the range is provided in
281+
// LookupOptions) or in GetBody (if the range is provided to GetBody).
282+
// - Only the requested range will be returned to the reader.
270283
AlwaysUseRequestedRange bool
271284
}
272285

0 commit comments

Comments
 (0)