Documentation ¶
Overview ¶
Package streams provides the standard streams used by murex and thus is REQUIRED by murex.
Index ¶
- Variables
- func NewTee(primary stdio.Io) (primaryTee *Tee, secondaryTee *Stdin)
- type ReadCloser
- type Reader
- func (r *Reader) Close()
- func (r *Reader) DefaultDataType(err bool)
- func (t *Reader) File() *os.File
- func (r *Reader) ForceClose()
- func (r *Reader) GetDataType() (dt string)
- func (r *Reader) IsTTY() bool
- func (r *Reader) Open()
- func (r *Reader) Read(p []byte) (int, error)
- func (r *Reader) ReadAll() (b []byte, err error)
- func (r *Reader) ReadArray(ctx context.Context, callback func([]byte)) error
- func (r *Reader) ReadArrayWithType(ctx context.Context, callback func(interface{}, string)) error
- func (r *Reader) ReadLine(callback func([]byte)) error
- func (r *Reader) ReadMap(config *config.Config, callback func(*stdio.Map)) error
- func (r *Reader) SetDataType(dt string)
- func (r *Reader) Stats() (bytesWritten, bytesRead uint64)
- func (r *Reader) Write(p []byte) (int, error)
- func (r *Reader) WriteArray(dataType string) (stdio.ArrayWriter, error)
- func (r *Reader) WriteTo(w io.Writer) (int64, error)
- func (r *Reader) Writeln(b []byte) (int, error)
- type Stdin
- func (stdin *Stdin) Close()
- func (stdin *Stdin) File() *os.File
- func (stdin *Stdin) ForceClose()
- func (stdin *Stdin) GetDataType() (dt string)
- func (stdin *Stdin) IsTTY() bool
- func (stdin *Stdin) Open()
- func (stdin *Stdin) Read(p []byte) (i int, err error)
- func (stdin *Stdin) ReadAll() ([]byte, error)
- func (stdin *Stdin) ReadArray(ctx context.Context, callback func([]byte)) error
- func (stdin *Stdin) ReadArrayWithType(ctx context.Context, callback func(interface{}, string)) error
- func (stdin *Stdin) ReadFrom(r io.Reader) (int64, error)
- func (stdin *Stdin) ReadLine(callback func([]byte)) error
- func (stdin *Stdin) ReadMap(config *config.Config, callback func(*stdio.Map)) error
- func (stdin *Stdin) SetDataType(dt string)
- func (stdin *Stdin) Stats() (bytesWritten, bytesRead uint64)
- func (stdin *Stdin) Write(p []byte) (int, error)
- func (stdin *Stdin) WriteArray(dataType string) (stdio.ArrayWriter, error)
- func (stdin *Stdin) WriteTo(w io.Writer) (int64, error)
- func (stdin *Stdin) Writeln(b []byte) (int, error)
- type Stdtest
- type Tee
- func (tee *Tee) Close()
- func (tee *Tee) File() *os.File
- func (tee *Tee) ForceClose()
- func (tee *Tee) GetDataType() (dt string)
- func (tee *Tee) IsTTY() bool
- func (tee *Tee) Open()
- func (tee *Tee) Read(p []byte) (int, error)
- func (tee *Tee) ReadAll() ([]byte, error)
- func (tee *Tee) ReadArray(ctx context.Context, callback func([]byte)) error
- func (tee *Tee) ReadArrayWithType(ctx context.Context, callback func(interface{}, string)) error
- func (tee *Tee) ReadLine(callback func([]byte)) error
- func (tee *Tee) ReadMap(config *config.Config, callback func(*stdio.Map)) error
- func (tee *Tee) SetDataType(dt string)
- func (tee *Tee) Stats() (uint64, uint64)
- func (tee *Tee) Write(p []byte) (int, error)
- func (tee *Tee) WriteArray(dataType string) (stdio.ArrayWriter, error)
- func (tee *Tee) WriteTo(w io.Writer) (n int64, err error)
- func (tee *Tee) Writeln(p []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
var DefaultMaxBufferSize = 1024 * 1024 * 1 // 1 meg
DefaultMaxBufferSize is the maximum size of buffer for stdin var DefaultMaxBufferSize = 1024 * 1024 * 1000 // 10 meg
Functions ¶
Types ¶
type ReadCloser ¶
type ReadCloser struct {
Reader
}
ReadCloser is a wrapper around an io.ReadCloser interface
func NewReadCloser ¶
func NewReadCloser(reader io.ReadCloser) (r *ReadCloser)
NewReadCloser creates a new Stdio.Io interface wrapper around a io.ReadCloser interface
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is a wrapper around an io.Reader interface
func (*Reader) DefaultDataType ¶
DefaultDataType defines the murex data type for the stream.Io interface if it's not already set
func (*Reader) ForceClose ¶
func (r *Reader) ForceClose()
ForceClose forces the stream.Io interface to close. This should only be called by a STDIN reader
func (*Reader) GetDataType ¶
GetDataType returns the murex data type for the stream.Io interface
func (*Reader) ReadArray ¶
ReadArray returns a data type-specific array returned via a callback function
func (*Reader) ReadArrayWithType ¶
ReadArrayWithType returns a data type-specific array returned via a callback function
func (*Reader) ReadMap ¶
ReadMap returns a data type-specific key/values returned via a callback function
func (*Reader) SetDataType ¶
SetDataType defines the murex data type for the stream.Io interface
func (*Reader) WriteArray ¶
func (r *Reader) WriteArray(dataType string) (stdio.ArrayWriter, error)
WriteArray is a dummy function because it's a reader interface
type Stdin ¶
type Stdin struct {
// contains filtered or unexported fields
}
Stdin is the default stdio.Io interface. Despite it's name, this interface can and is used for Stdout and Stderr streams too.
func NewStdin ¶
func NewStdin() (stdin *Stdin)
NewStdin creates a new stream.Io interface for piping data between processes. Despite it's name, this interface can and is used for Stdout and Stderr streams too.
func NewStdinWithContext ¶
func NewStdinWithContext(ctx context.Context, forceClose context.CancelFunc) (stdin *Stdin)
NewStdinWithContext creates a new stream.Io interface for piping data between processes. Despite it's name, this interface can and is used for Stdout and Stderr streams too. This function is also useful as a context aware version of ioutil.ReadAll
func (*Stdin) ForceClose ¶
func (stdin *Stdin) ForceClose()
ForceClose forces the stream.Io interface to close. This should only be called by a STDIN reader
func (*Stdin) GetDataType ¶
GetDataType returns the murex data type for the stream.Io interface
func (*Stdin) ReadArray ¶
ReadArray returns a data type-specific array returned via a callback function
func (*Stdin) ReadArrayWithType ¶
func (stdin *Stdin) ReadArrayWithType(ctx context.Context, callback func(interface{}, string)) error
ReadArrayWithType returns an array like "ReadArray" plus data type via a callback function
func (*Stdin) ReadMap ¶
ReadMap returns a data type-specific key/values returned via a callback function
func (*Stdin) SetDataType ¶
SetDataType defines the murex data type for the stream.Io interface
func (*Stdin) WriteArray ¶
func (stdin *Stdin) WriteArray(dataType string) (stdio.ArrayWriter, error)
WriteArray performs data type specific buffered writes to an stdio.Io interface
type Stdtest ¶
type Stdtest struct {
Stdin
}
Stdtest is a testing Io interface user to workaround writing to the terminal
func NewStdtest ¶
func NewStdtest() (stdtest *Stdtest)
NewStdtest creates a new stream.Io interface for piping data between test processes that need to spoof an PTY
type Tee ¶
type Tee struct {
// contains filtered or unexported fields
}
Tee is a stream interface with two output streams (like the `tee` command on UNIX/Linux)
func (*Tee) ForceClose ¶
func (tee *Tee) ForceClose()
ForceClose forces the stream.Io interface to close. This should only be called by a STDIN reader
func (*Tee) GetDataType ¶
GetDataType returns the murex data type for the stream.Io interface
func (*Tee) ReadArrayWithType ¶
ReadArrayWithType reads an array from STDIN (uses the primary tee stream)
func (*Tee) SetDataType ¶
SetDataType defines the murex data type for the stream.Io interface
func (*Tee) WriteArray ¶
func (tee *Tee) WriteArray(dataType string) (stdio.ArrayWriter, error)
WriteArray performs data type specific buffered writes to an stdio.Io interface