hybridbuffer

package
v0.0.0-...-b41040d Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package hybridbuffer provides an ChunkBufferer implementation which keeps N numbers of unsent chunks in memory and starts saving to and loading from the queue directory when the limit is reached.

At shutdown, all unsent chunks are saved for recovery next time.

The bufferer creates subdirs for each buffer ID under root path. A subdir name is made of sanitized buffer/pipeline ID and hash to prevent collision, while the original ID is stored as an extended attribute on the subdir itself.

If for any reason the queue directory cannot be created or accessed, the buffer drops all chunks after the limit is reached and logs errors; at shutdown all pending chunks would be held until they're sent or timed out.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	bconfig.Header `yaml:",inline"`
	RootPath       string            `yaml:"rootPath"`   // root path on top of buffer subdirs, may contain environment variables
	MaxBufSize     datasize.ByteSize `yaml:"maxBufSize"` // max total size of on-disk chunks for each buffer subdir
}

Config defines the configuration for HybridBufferer

func (*Config) ListBufferIDs

func (cfg *Config) ListBufferIDs(parentLogger logger.Logger, matchChunkID func(string) bool,
	metricCreator promreg.MetricCreator,
) []string

ListBufferIDs lists existing buffer IDs

func (*Config) NewBufferer

func (cfg *Config) NewBufferer(parentLogger logger.Logger, bufferID string, matchChunkID func(string) bool,
	metricCreator promreg.MetricCreator, sendAllAtEnd bool,
) base.ChunkBufferer

NewBufferer creates a HybridBufferer. If bufferID is empty, the queue dir is the root dir as defined in .path.

func (*Config) VerifyConfig

func (cfg *Config) VerifyConfig() error

VerifyConfig checks configuration

Jump to

Keyboard shortcuts

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