storage

package
v0.0.0-...-5195419 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ChunkLength = 5 * time.Minute

Variables

View Source
var (
	ErrNotFound = errors.New("Not found")
	ErrDBClosed = errors.New("DB already closed")
)
View Source
var ErrAddToCompletedChunk = errors.New("Unabled to add a new snapshot into a completed chunk")

Functions

func ChunkID

func ChunkID(ts time.Time) int64

Types

type Appender

type Appender interface {
	Add(*model.Snapshot) error
}

type Chunk

type Chunk interface {
	ID() int64
	SetCompleted(bool)
	IsCompleted() bool
	Len() int
	Clone() Chunk

	Add(*model.Snapshot) error

	Iterator() ChunkIterator

	Marshal() ([]byte, error)
	Unmarshal([]byte) error
}

func NewChunk

func NewChunk(id int64) Chunk

type ChunkIterator

type ChunkIterator interface {
	FindBestSnapshot(time.Time) *model.Snapshot
}

type Options

type Options struct {
	Retention time.Duration
}

type Querier

type Querier interface {
	GetChunk(int64) (Chunk, error)
	GetLatestSnapshot() (*model.Snapshot, error)
}

type Storage

type Storage interface {
	Appender
	Querier
	Close() error
}

func Open

func Open(path string, logger *zap.Logger, r prometheus.Registerer, opts *Options) (Storage, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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