Documentation ¶
Overview ¶
Package AsyncWriter implements the io.Writer which batch writes (maybe writev if it's net.Conn) to writer by channel
Index ¶
- Variables
- type AsyncWriter
- type AsyncWriterOptionSetter
- type AsyncWriterOptionSetterFunc
- type Metrics
- func (m *Metrics) AddBytes(n int64)
- func (m *Metrics) AddCommands()
- func (m *Metrics) AddPendingCommands(n int64)
- func (m *Metrics) GetBytes() int64
- func (m *Metrics) GetCommands() int64
- func (m *Metrics) GetPendingCommands() int64
- func (m *Metrics) SetBytes(i *int64)
- func (m *Metrics) SetCommands(i *int64)
- func (m *Metrics) SetPendingCommands(i *int64)
- type Option
- type WriteMode
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrAsyncWriterClosed indicates the writer was closed. ErrAsyncWriterClosed = errors.New("asyncwriter: writer was closed") // ErrAsyncWriterTooManyWrite indicates writer cannot process the write because of // too many write. ErrAsyncWriterTooManyWrite = errors.New("asyncwriter: writer wrote too fast") )
Functions ¶
This section is empty.
Types ¶
type AsyncWriter ¶
type AsyncWriter struct {
// contains filtered or unexported fields
}
func New ¶
func New(w io.Writer, options ...AsyncWriterOptionSetter) (*AsyncWriter, error)
func (*AsyncWriter) Close ¶
func (bw *AsyncWriter) Close() error
func (*AsyncWriter) DoWrite ¶
func (bw *AsyncWriter) DoWrite() error
func (*AsyncWriter) GetMetrics ¶
func (bw *AsyncWriter) GetMetrics() *Metrics
func (*AsyncWriter) IsClosed ¶
func (bw *AsyncWriter) IsClosed() bool
type AsyncWriterOptionSetter ¶
type AsyncWriterOptionSetter interface {
// contains filtered or unexported methods
}
type AsyncWriterOptionSetterFunc ¶
type AsyncWriterOptionSetterFunc func(*AsyncWriter)
func WithAsyncWriterMetrics ¶
func WithAsyncWriterMetrics(m *Metrics) AsyncWriterOptionSetterFunc
func WithAsyncWriterOption ¶
func WithAsyncWriterOption(o *Option) AsyncWriterOptionSetterFunc
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
func NewMetrics ¶
func NewMetrics() *Metrics
func (*Metrics) AddCommands ¶
func (m *Metrics) AddCommands()
func (*Metrics) AddPendingCommands ¶
func (*Metrics) GetCommands ¶
func (*Metrics) GetPendingCommands ¶
func (*Metrics) SetCommands ¶
func (*Metrics) SetPendingCommands ¶
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
Option configruates the option of write.
func (*Option) AllowBlockForever ¶
AllowBlockForever indicates caller can blockly write to io.Writer.
Click to show internal directories.
Click to hide internal directories.