buffer

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchBuffer

type BatchBuffer struct {
	// contains filtered or unexported fields
}

BatchBuffer is a buffer to cache the input data in Sender.

func NewBatchBuffer

func NewBatchBuffer(capacity int) *BatchBuffer

NewBatchBuffer creates a new BatchBuffer according to the capacity param.

func (*BatchBuffer) Add

func (b *BatchBuffer) Add(data *event.OutputEventContext)

Add adds a new data input buffer.

func (*BatchBuffer) Buf

func (b *BatchBuffer) Buf() []*event.OutputEventContext

Buf returns the cached data in BatchBuffer.

func (*BatchBuffer) First

func (b *BatchBuffer) First() event.Offset

First returns the first OutputEventContext offset.

func (*BatchBuffer) Last

func (b *BatchBuffer) Last() event.Offset

Last returns the last OutputEventContext offset.

func (*BatchBuffer) Len

func (b *BatchBuffer) Len() int

Len returns the usage size.

type Checker added in v0.3.0

type Checker func() int

type Flusher added in v0.3.0

type Flusher func()

type Limiter added in v0.3.0

type Limiter struct {
	Config LimiterConfig
	// contains filtered or unexported fields
}

func NewLimiter added in v0.3.0

func NewLimiter(config LimiterConfig, checker Checker) *Limiter

func (*Limiter) Check added in v0.3.0

func (l *Limiter) Check()

func (*Limiter) Start added in v0.3.0

func (l *Limiter) Start(ctx context.Context, flush Flusher)

func (*Limiter) Stop added in v0.3.0

func (l *Limiter) Stop()

type LimiterConfig added in v0.3.0

type LimiterConfig struct {
	// The time interval between two flush operations. And the time unit is millisecond.
	FlushTime int `mapstructure:"flush_time" yaml:"flush_time"`
	// The max cache count when receive the message
	LimitCount int `mapstructure:"limit_count" yaml:"limit_count"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL