Documentation ¶
Index ¶
- Variables
- func BatchConsume(ctx context.Context, r BatchReader, w BatchWriter, opts *BatchConsumeOptions) error
- type BatchConsumeOptions
- type BatchReader
- type BatchWriter
- type BufferedWriter
- type Comparer
- type ConsumeStatistics
- type Data
- type EmptyIterator
- type Flusher
- type Int64Comparer
- type Iterator
- type ListIterator
- type Matcher
- type MultiplierBackoff
- type NopWriter
- type StdoutWriter
- type TimerBackoff
- type Writer
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidData . ErrInvalidData = errors.New("invalid data") // ErrIteratorClosed . ErrIteratorClosed = errors.New("iterator closed") // ErrWriterClosed . ErrWriterClosed = errors.New("writer closed") // ErrOpNotSupported . ErrOpNotSupported = errors.New("operation not supported") )
View Source
var DefaultNopWriter = NopWriter{}
DefaultNopWriter .
View Source
var DefaultStdoutWriter = StdoutWriter{ Filter: func(val Data) bool { return true }, }
DefaultStdoutWriter .
View Source
var ErrExitConsume = errors.New("exit consume")
ErrExitConsume .
Functions ¶
func BatchConsume ¶
func BatchConsume(ctx context.Context, r BatchReader, w BatchWriter, opts *BatchConsumeOptions) error
BatchConsume .
Types ¶
type BatchConsumeOptions ¶
type BatchConsumeOptions struct { BufferSize int ReadTimeout time.Duration // ReadErrorHandler return err to exit, return nil to continue ReadErrorHandler func(err error) error // WriteErrorHandler return err to retry write, return nil to continue WriteErrorHandler func(list []Data, err error) error // ConfirmErrorHandler return err to exit, return nil to continue ConfirmErrorHandler func(err error) error Backoff TimerBackoff Statistics ConsumeStatistics }
BatchConsumeOptions .
type BatchReader ¶
type BatchReader interface { ReadN(buf []Data, timeout time.Duration) (int, error) Confirm() error Close() error }
BatchReader .
func NewMockBatchReader ¶
func NewMockBatchReader(ctx context.Context, interval time.Duration, batchSize int, creator func() interface{}) BatchReader
NewMockBatchReader .
type BatchWriter ¶
BatchWriter .
type BufferedWriter ¶
type BufferedWriter struct {
// contains filtered or unexported fields
}
BufferedWriter .
func NewBufferedWriter ¶
func NewBufferedWriter(w BatchWriter, capacity int) *BufferedWriter
NewBufferedWriter .
type ConsumeStatistics ¶
type ConsumeStatistics interface { ReadError(err error) WriteError(data []Data, err error) ConfirmError(data []Data, err error) Success(data []Data) }
ConsumeStatistics .
var NopConsumeStatistics ConsumeStatistics = &nopConsumeStatistics{}
type Iterator ¶
type Iterator interface { First() bool Last() bool Next() bool Prev() bool Value() Data Error() error Close() error }
Iterator .
func MergedHeadOverlappedIterator ¶
MergedHeadOverlappedIterator .
type ListIterator ¶
type ListIterator struct {
// contains filtered or unexported fields
}
ListIterator .
type MultiplierBackoff ¶
type MultiplierBackoff struct { Base time.Duration Max time.Duration Duration time.Duration Factor float64 }
MultiplierBackoff .
func (*MultiplierBackoff) Reset ¶
func (b *MultiplierBackoff) Reset()
func (*MultiplierBackoff) Wait ¶
func (b *MultiplierBackoff) Wait() <-chan time.Time
type StdoutWriter ¶
StdoutWriter .
func (StdoutWriter) Close ¶
func (w StdoutWriter) Close() error
func (StdoutWriter) Write ¶
func (w StdoutWriter) Write(val Data) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.