package readyreader
import "google.golang.org/grpc/internal/transport/readyreader"
Package readyreader provides utilities to perform non-memory-pinning reads.
Index ¶
Types ¶
type Reader ¶
type Reader interface {
// 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.
ReadOnReady(bufSize int, pool mem.BufferPool) (b *[]byte, n int, err error)
}
Reader is an optional interface that can be implemented by net.Conn implementations to enable gRPC to perform non-memory-pinning reads.
func New ¶
New detects if syscall.RawConn is available for non-memory-pinning reads. If syscall.RawConn is unavailable, it falls back to using the simpler net.Conn interface for reads.
Source Files ¶
raw_conn_nonlinux.go ready_reader.go
- Version
- v1.82.0-dev
- Published
- Apr 15, 2026
- Platform
- js/wasm
- Imports
- 4 packages
- Last checked
- 22 minutes ago –
Tools for package owners.