Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncWriter ¶
type AsyncWriter struct { *Writer // contains filtered or unexported fields }
func NewAsyncWriter ¶
func NewAsyncWriter(w io.Writer) *AsyncWriter
func (*AsyncWriter) Flush ¶
func (w *AsyncWriter) Flush() error
Flush waits for all async writes to complete.
func (*AsyncWriter) WriteLineAsync ¶
func (w *AsyncWriter) WriteLineAsync(data []byte) error
WriteLineAsync writes a single protocol message. The message won't be written immediately and will be batched with other similar messages.
type ErrProtocolViolation ¶
type ErrProtocolViolation struct {
Err error
}
func (*ErrProtocolViolation) Error ¶
func (e *ErrProtocolViolation) Error() string
type Reader ¶
type Reader struct { // OnLine is called each time a raw protocol line is read from the connection. // The buffer will contain a delimiter and is in the connection encoding. // The function may return (false, nil) to ignore the message. OnLine func(line []byte) (bool, error) // contains filtered or unexported fields }
func (*Reader) ReadLine ¶
ReadLine reads a single raw message until the delimiter. The returned buffer contains a delimiter and is in the connection encoding. The buffer is only valid until the next call to Read or ReadLine.
func (*Reader) SetMaxLine ¶
SetMaxLine sets a maximal length of the protocol messages in bytes, including the delimiter.
type Writer ¶
type Writer struct { // OnLine is called each time a raw protocol message is written. OnLine func(line []byte) error // contains filtered or unexported fields }
Writer is safe for concurrent use.
func (*Writer) StartBatch ¶
StartBatch starts a batch of messages. Caller should call EndBatch to flush the buffer.
Click to show internal directories.
Click to hide internal directories.