storage

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 23 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 Backend added in v0.2.0

type Backend string
const (
	BackendADX        Backend = "adx"
	BackendClickHouse Backend = "clickhouse"
)

func ParseBackend added in v0.2.0

func ParseBackend(raw string) (Backend, error)

func (Backend) String added in v0.2.0

func (b Backend) String() string

func (Backend) Validate added in v0.2.0

func (b Backend) Validate() error

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) Size added in v0.2.0

func (s *LocalStore) Size() int64

Size returns the total size of the LocalStore, including the size of the repository (active WAL segments), inflight write bytes, and index size (closed WAL segments).

func (*LocalStore) WALCount

func (s *LocalStore) WALCount() int

func (*LocalStore) WriteDebug added in v0.2.0

func (s *LocalStore) WriteDebug(w io.Writer) error

WriteDebug writes debug information to the given writer.

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
	StartupOpenConcurrency int
	Backend                Backend

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

Jump to

Keyboard shortcuts

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