pipe

package
v3.25.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseError

func CloseError(v interface{})

CloseError invokes CloseError() method if the object is either Reader or Writer.

func New

func New(opts ...Option) (*Reader, *Writer)

New creates a new Reader and Writer that connects to each other.

Types

type Option

type Option func(*pipe)

Option for creating new Pipes.

func OptionsFromContext

func OptionsFromContext(ctx context.Context) []Option

func WithSizeLimit

func WithSizeLimit(limit int32) Option

func WithoutSizeLimit

func WithoutSizeLimit() Option

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader is a buf.Reader that reads content from a pipe.

func (*Reader) CloseError

func (r *Reader) CloseError()

CloseError sets the pipe to error state. Both reading and writing from/to the pipe will return io.ErrClosedPipe.

func (*Reader) ReadMultiBuffer

func (r *Reader) ReadMultiBuffer() (buf.MultiBuffer, error)

ReadMultiBuffer implements buf.Reader.

func (*Reader) ReadMultiBufferWithTimeout

func (r *Reader) ReadMultiBufferWithTimeout(d time.Duration) (buf.MultiBuffer, error)

ReadMultiBufferWithTimeout reads content from a pipe within the given duration, or returns buf.ErrTimeout otherwise.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer is a buf.Writer that writes data into a pipe.

func (*Writer) Close

func (w *Writer) Close() error

Close implements io.Closer. After the pipe is closed, writing to the pipe will return io.ErrClosedPipe, while reading will return io.EOF.

func (*Writer) CloseError

func (w *Writer) CloseError()

CloseError sets the pipe to error state. Both reading and writing from/to the pipe will return io.ErrClosedPipe.

func (*Writer) WriteMultiBuffer

func (w *Writer) WriteMultiBuffer(mb buf.MultiBuffer) error

WriteMultiBuffer implements buf.Writer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL