Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrTooFarBehind = errors.New("trailbuf: read too far behind")
ErrTooFarBehind is returned if a read goes too far behind the current position. It's set as a cause (which callers can unwrap) on some errors returned by ReadAt.
Functions ¶
This section is empty.
Types ¶
type ReaderAt ¶
type ReaderAt struct {
// contains filtered or unexported fields
}
func New ¶
New creates a ReaderAt that can respond to arbitrary reads as long as they're close to the current position. trailSize controls the max distance (controlling buffer space usage). Reads too far behind the current position return an error with cause ErrTooFarBehind. off is the current position of r (for example, zero for the start of a file, or non-zero for reading somewhere in the middle). Note: Alternatively, callers could manipulate the offsets in their ReadAt calls to be relative to r's initial position. However, since we put offsets in our error message strings, users may find debugging easier if they don't need to de-relativize the errors.