Documentation ¶
Index ¶
- Variables
- type Extio
- func (eio *Extio) Attach() error
- func (eio *Extio) InputClose() error
- func (eio *Extio) OutputClose() error
- func (eio *Extio) Put(bb *bytebufferpool.ByteBuffer)
- func (eio *Extio) ReadBuf(buf []byte, cb pipe.CallbackFunc) (parse_err error)
- func (eio *Extio) ReadSingle(buf []byte, cb pipe.CallbackFunc) (parse_err error)
- func (eio *Extio) ReadStream(rd io.Reader, cb pipe.CallbackFunc) (parse_err error)
- func (eio *Extio) SendMsg(m *msg.Msg) bool
- func (eio *Extio) WriteStream(w io.Writer) error
- type Mode
Constants ¶
This section is empty.
Variables ¶
var ( ErrFormat = errors.New("unrecognized format") ErrLength = errors.New("invalid buffer length") )
Functions ¶
This section is empty.
Types ¶
type Extio ¶
type Extio struct { *core.StageBase Callback *pipe.Callback // our callback for capturing bgpipe output InputL *pipe.Input // our L input to bgpipe InputR *pipe.Input // our R input to bgpipe InputD *pipe.Input // default input if data doesn't specify the direction Output chan *bytebufferpool.ByteBuffer // output ready to be sent to the process Pool *bytebufferpool.Pool // pool of byte buffers // contains filtered or unexported fields }
Extio helps in I/O with external processes eg. a background JSON filter, or a remote websocket processor. You must read Output and return disposed buffers using Put().
func (*Extio) InputClose ¶
InputClose closes all stage inputs, stopping the flow from the process to bgpipe
func (*Extio) OutputClose ¶
OutputClose closes eio.Output, stopping the flow from bgpipe to the process
func (*Extio) Put ¶
func (eio *Extio) Put(bb *bytebufferpool.ByteBuffer)
Put puts a byte buffer back to pool
func (*Extio) ReadBuf ¶
func (eio *Extio) ReadBuf(buf []byte, cb pipe.CallbackFunc) (parse_err error)
ReadBuf reads all messages from the process, as bytes in buf, buffering if needed. Must not be used concurrently. cb may be nil.
func (*Extio) ReadSingle ¶
func (eio *Extio) ReadSingle(buf []byte, cb pipe.CallbackFunc) (parse_err error)
ReadSingle reads single message from the process, as bytes in buf. Does not keep a reference to buf (copies buf if needed). Can be used concurrently. cb may be nil.
func (*Extio) ReadStream ¶
ReadStream is a ReadBuf wrapper that reads from an io.Reader. Must not be used concurrently. cb may be nil.