Reader is an optional interface that can be implemented by [net.Conn]
implementations to enable gRPC to perform non-memory-pinning reads. ReadOnReady waits for data to arrive, fetches a buffer, and performs a
read. When the underlying IO is readable, it allocates a buffer of size
bufSize from the pool and reads up to bufSize bytes into the buffer.
It returns a pointer to the buffer so it can be returned to the pool
later, the number of bytes read, and an error.
Callers should always process the n > 0 bytes returned before considering
the error. Doing so correctly handles I/O errors that happen after
reading some bytes, as well as both of the allowed EOF behaviors.
func New(r io.Reader) Reader
func NewNonBlocking(r io.Reader) Reader
func NewBuffered(rd Reader, size int, pool mem.BufferPool) io.Reader
Package-Level Functions (total 3)
New detects if [syscall.RawConn] is available for non-memory-pinning reads.
If [syscall.RawConn] is unavailable, it falls back to using the simpler
[io.Reader] interface for reads.
NewBuffered returns a new [io.Reader] with a buffer of the specified size
which is allocated from the provided pool.
NewNonBlocking returns a ReadyReader if the passed reader supports
non-memory-pinning reads, else nil.
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.