Documentation ¶
Overview ¶
Package stream provides functions to operate with data streams.
Index ¶
- func Tar(writer io.Writer, src string) error
- func TarBytes(writer io.Writer, bytes []byte) error
- func Untar(r io.Reader, dst string) error
- func UntarBytes(dst io.Writer, r io.Reader) error
- type MessageCloser
- type MessageReadWriteCloser
- type MessageReader
- type MessageWriter
- type ReadWriteCloser
- type Reader
- type Stream
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MessageCloser ¶
type MessageCloser interface { BuildMsg() interface{} CloseMsg() interface{} }
MessageCloser defines a generic interface create a message that closes a stream.
type MessageReadWriteCloser ¶
type MessageReadWriteCloser interface { BuildMsg() interface{} GetBytes(interface{}) ([]byte, error) SetBytes(interface{}, []byte) CloseMsg() interface{} }
MessageReadWriteCloser defines a generic interface to build messages with byte contents.
type MessageReader ¶
MessageReader defines a generic interface to read bytes from a message.
type MessageWriter ¶
type MessageWriter interface { BuildMsg() interface{} SetBytes(interface{}, []byte) }
MessageWriter defines a generic interface to set bytes in a message.
type ReadWriteCloser ¶
type ReadWriteCloser struct { Stream MessageReadWriteCloser // contains filtered or unexported fields }
ReadWriteCloser wraps arbitrary grpc streams around a ReadWriteCloser implementation. Users create a new ReadWriteCloser by calling NewReadWriteCloser passing a base stream. The stream needs to implement RecvMsg and SendMsg (i.e. ClientStream and ServerStream types), And a function to set bytes in the stream message type, get bytes from the message and close the stream. NOTE: The reader follows the same semantics as <Server|Client>Stream. It is ok to have concurrent writes and reads, but it's not ok to have multiple concurrent reads or multiple concurrent writes.
func NewReadWriteCloser ¶
func NewReadWriteCloser(stream Stream, sm MessageReadWriteCloser) *ReadWriteCloser
NewReadWriteCloser returns an initialized ReadWriteCloser.
func (*ReadWriteCloser) CloseRead ¶
func (s *ReadWriteCloser) CloseRead() error
CloseRead closes the read side of the stream.
func (*ReadWriteCloser) CloseWrite ¶
func (s *ReadWriteCloser) CloseWrite() error
CloseWrite closes the write side of the stream and signals the other side.
type Reader ¶
type Reader struct { Stream MessageReader // contains filtered or unexported fields }
Reader wraps arbitrary grpc streams around a Reader implementation.
func NewReader ¶
func NewReader(stream Stream, sm MessageReader) *Reader
NewReader creates and initializes a new Reader.
type Writer ¶
type Writer struct { Stream MessageWriter }
Writer implements a Writer backed by a stream.
func NewWriter ¶
func NewWriter(stream Stream, sm MessageWriter) *Writer
NewWriter creates a new Writer.