buffer

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: May 21, 2019 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBuffer

func NewBuffer(opts Options) (producer.Buffer, error)

NewBuffer returns a new buffer.

Types

type OnFullStrategy

type OnFullStrategy string

OnFullStrategy defines the buffer behavior when the buffer is full.

const (
	// ReturnError means an error will be returned
	// on new buffer requests when the buffer is full.
	ReturnError OnFullStrategy = "returnError"

	// DropOldest means the oldest message in the buffer
	// will be dropped to make room for new buffer requests
	// when the buffer is full.
	DropOldest OnFullStrategy = "dropOldest"
)

func (*OnFullStrategy) UnmarshalYAML

func (t *OnFullStrategy) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals OnFullStrategy from yaml.

type Options

type Options interface {
	// OnFullStrategy returns the strategy when buffer is full.
	OnFullStrategy() OnFullStrategy

	// SetOnFullStrategy sets the strategy when buffer is full.
	SetOnFullStrategy(value OnFullStrategy) Options

	// MaxMessageSize returns the max message size.
	MaxMessageSize() int

	// SetMaxMessageSize sets the max message size.
	SetMaxMessageSize(value int) Options

	// MaxBufferSize returns the max buffer size.
	MaxBufferSize() int

	// SetMaxBufferSize sets the max buffer size.
	SetMaxBufferSize(value int) Options

	// CloseCheckInterval returns the close check interval.
	CloseCheckInterval() time.Duration

	// SetCloseCheckInterval sets the close check interval.
	SetCloseCheckInterval(value time.Duration) Options

	// DropOldestInterval returns the interval to drop oldest buffer.
	// The max buffer size might be spilled over during the interval.
	DropOldestInterval() time.Duration

	// SetDropOldestInterval sets the interval to drop oldest buffer.
	// The max buffer size might be spilled over during the interval.
	SetDropOldestInterval(value time.Duration) Options

	// ScanBatchSize returns the scan batch size.
	ScanBatchSize() int

	// SetScanBatchSize sets the scan batch size.
	SetScanBatchSize(value int) Options

	// AllowedSpilloverRatio returns the ratio for allowed buffer spill over,
	// below which the buffer will drop oldest messages asynchronizely for
	// better performance. When the limit for allowed spill over is reached,
	// the buffer will start to drop oldest messages synchronizely.
	AllowedSpilloverRatio() float64

	// SetAllowedSpilloverRatio sets the ratio for allowed buffer spill over.
	SetAllowedSpilloverRatio(value float64) Options

	// CleanupRetryOptions returns the cleanup retry options.
	CleanupRetryOptions() retry.Options

	// SetCleanupRetryOptions sets the cleanup retry options.
	SetCleanupRetryOptions(value retry.Options) Options

	// InstrumentOptions returns the instrument options.
	InstrumentOptions() instrument.Options

	// SetInstrumentOptions sets the instrument options.
	SetInstrumentOptions(value instrument.Options) Options

	// Validate validates the options.
	Validate() error
}

Options configs the buffer.

func NewOptions

func NewOptions() Options

NewOptions creates Options.

Jump to

Keyboard shortcuts

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