storage

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SegmentKey

func SegmentKey(dst []byte, labels []*prompb.Label, hash uint64) ([]byte, error)

Types

type LocalStore

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

LocalStore provides local storage of time series data. It manages Write Ahead Logs (WALs) for each metric.

func NewLocalStore

func NewLocalStore(opts StoreOpts) *LocalStore

func (*LocalStore) Close

func (s *LocalStore) Close() error

func (*LocalStore) GetWAL

func (s *LocalStore) GetWAL(ctx context.Context, key []byte) (*wal.WAL, error)

func (*LocalStore) Import

func (s *LocalStore) Import(filename string, body io.ReadCloser) (int, error)

func (*LocalStore) Index

func (s *LocalStore) Index() *wal.Index

func (*LocalStore) Open

func (s *LocalStore) Open(ctx context.Context) error

func (*LocalStore) PrefixesByAge

func (s *LocalStore) PrefixesByAge() []string

func (*LocalStore) Remove

func (s *LocalStore) Remove(path string) error

func (*LocalStore) WALCount

func (s *LocalStore) WALCount() int

func (*LocalStore) WriteNativeLogs

func (s *LocalStore) WriteNativeLogs(ctx context.Context, logs *types.LogBatch) error

func (*LocalStore) WriteOTLPLogs

func (s *LocalStore) WriteOTLPLogs(ctx context.Context, database, table string, logs *otlp.Logs) error

func (*LocalStore) WriteTimeSeries

func (s *LocalStore) WriteTimeSeries(ctx context.Context, ts []*prompb.TimeSeries) error

type Store

type Store interface {
	service.Component

	// WriteTimeSeries writes a batch of time series to the Store.
	WriteTimeSeries(ctx context.Context, ts []*prompb.TimeSeries) error

	// WriteOTLPLogs writes a batch of logs to the Store.
	WriteOTLPLogs(ctx context.Context, database, table string, logs *otlp.Logs) error

	// WriteNativeLogs writes a batch of logs to the Store.
	WriteNativeLogs(ctx context.Context, logs *types.LogBatch) error

	// Import imports a file into the LocalStore and returns the number of bytes stored.
	Import(filename string, body io.ReadCloser) (int, error)
}

type StoreOpts

type StoreOpts struct {
	StorageDir     string
	SegmentMaxSize int64
	SegmentMaxAge  time.Duration
	MaxDiskUsage   int64

	LiftedLabels     []string
	LiftedAttributes []string
	LiftedResources  []string
	WALFlushInterval time.Duration
}

Jump to

Keyboard shortcuts

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