Documentation
¶
Index ¶
- Variables
- type Extio
- func (eio *Extio) Attach() error
- func (eio *Extio) DetectNeeded() bool
- func (eio *Extio) DetectPath(path string) (success bool)
- func (eio *Extio) DetectSample(br *bufio.Reader) (success bool)
- 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) (read_err error)
- func (eio *Extio) ReadSingle(buf []byte, cb pipe.CallbackFunc) (read_err error)
- func (eio *Extio) ReadStream(rd io.Reader, cb pipe.CallbackFunc) (read_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
Detected bool // auto-detected the data format?
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) DetectNeeded ¶ added in v0.12.0
DetectNeeded returns true iff data format detection is (still) needed
func (*Extio) DetectPath ¶ added in v0.12.0
DetectPath tries to detect data format from given path. Returns true if format was successfully detected.
func (*Extio) DetectSample ¶ added in v0.12.0
DetectSample tries to detect data format by peeking at the buffered reader. Returns true if format was successfully detected.
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) (read_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) (read_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.