Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTimeout indicates an operation has timed out. ErrTimeout = errors.New("operation timed-out") // ErrClosed indicates the buffer is closed and can no longer be used. ErrClosed = errors.New("buffer is closed") )
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
Buffer represents a data buffer that is asynchronously flushed, either manually or automatically.
func (*Buffer) Close ¶
Close flushes the buffer and prevents it from being further used.
It returns an ErrTimeout if if cannot be performed in a timely fashion, and an ErrClosed if the buffer has already been closed.
An ErrTimeout can either mean that a flush could not be triggered, or it can mean that a flush was triggered but it has not finished yet. In any case it is safe to call Close again.
type Flusher ¶
type Flusher interface {
Write(items []interface{})
}
Flusher represents a destination of buffered data.
type FlusherFunc ¶
type FlusherFunc func(items []interface{})
FlusherFunc represents a flush function.
func (FlusherFunc) Write ¶
func (fn FlusherFunc) Write(items []interface{})
type Option ¶
type Option func(*Options)
Option setter.
func WithCloseTimeout ¶
WithCloseTimeout sets how long
func WithFlushInterval ¶
WithFlushInterval sets the interval between automatic flushes.
func WithFlushTimeout ¶
WithFlushTimeout sets how long a manual flush should wait before giving up.
func WithFlusher ¶
WithFlusher sets the flusher that should be used to write out the buffer.
func WithPushTimeout ¶
WithPushTimeout sets how long a push should wait before giving up.