Documentation ¶
Index ¶
- type FixedBuffer
- type Pipe
- func (p *Pipe) BreakWithError(err error)
- func (p *Pipe) CloseWithError(err error)
- func (p *Pipe) CloseWithErrorAndCode(err error, fn func())
- func (p *Pipe) Done() <-chan struct{}
- func (p *Pipe) Err() error
- func (p *Pipe) Read(d []byte) (n int, err error)
- func (p *Pipe) Release(pool *sync.Pool)
- func (p *Pipe) Write(d []byte) (n int, err error)
- type PipeBuffer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FixedBuffer ¶
type FixedBuffer struct {
// contains filtered or unexported fields
}
FixedBuffer is an io.ReadWriter backed by a fixed size buffer. It never allocates, but moves old data as new data is written.
func NewFixedBuffer ¶
func NewFixedBuffer(buf []byte) *FixedBuffer
func (*FixedBuffer) Len ¶
func (b *FixedBuffer) Len() int
Len returns the number of bytes of the unread portion of the buffer.
type Pipe ¶
type Pipe struct {
// contains filtered or unexported fields
}
Pipe is a goroutine-safe io.Reader/io.Writer pair. It's like io.Pipe except there are no PipeReader/PipeWriter halves, and the underlying buffer is an interface. (io.Pipe is always unbuffered)
func NewPipeFromBufferPool ¶
func NewPipeWithSize ¶
func (*Pipe) BreakWithError ¶
BreakWithError causes the next Read (waking up a current blocked Read if needed) to return the provided err immediately, without waiting for unread data.
func (*Pipe) CloseWithError ¶
CloseWithError causes the next Read (waking up a current blocked Read if needed) to return the provided err after all data has been read.
The error must be non-nil.
func (*Pipe) CloseWithErrorAndCode ¶
CloseWithErrorAndCode is like CloseWithError but also sets some code to run in the caller's goroutine before returning the error.
func (*Pipe) Done ¶
func (p *Pipe) Done() <-chan struct{}
Done returns a channel which is closed if and when this pipe is closed with CloseWithError.