Documentation ¶
Overview ¶
Package iochan provides a channel-based io.Reader.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReadRequest ¶
type ReadRequest struct { // Buf is the read buffer into which data should be read. Buf []byte // contains filtered or unexported fields }
ReadRequest holds the buffer and response channel for a read request.
func (*ReadRequest) Respond ¶
func (rr *ReadRequest) Respond(n int, err error)
Respond responds to the Read request. Respond must not be called concurrently with Reader.Close.
type Reader ¶
type Reader struct { // C can be used for receiving read requests. // // Once a read request is received, it must be responded // to, in order to avoid blocking the reader. C <-chan ReadRequest // contains filtered or unexported fields }
Reader is a channel-based io.Reader.
Reader is safe for use in a single producer, single consumer pattern.
func (*Reader) CloseRead ¶
CloseRead closes the reader such that any waiting or future Reads return err. Additional calls to CloseRead have no effect. CloseRead must not be called concurrently with ReadRequest.Respond.
func (*Reader) CloseWrite ¶
func (r *Reader) CloseWrite()
CloseWrite closes reader.C. CloseWrite is idempotent, but must not be called concurrently with Read.
Click to show internal directories.
Click to hide internal directories.