wal

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseFilename added in v1.2.0

func ParseFilename(filename string) (uuid.UUID, string, string, backend.Encoding, string, error)

ParseFilename returns (blockID, tenant, version, encoding, dataEncoding, error). Example: "00000000-0000-0000-0000-000000000000:1:v2:snappy:v1"

func ReplayWALAndGetRecords added in v1.2.0

func ReplayWALAndGetRecords(file *os.File, enc backend.Encoding, handleObj func([]byte) error) ([]common.Record, error, error)

ReplayWALAndGetRecords replays a WAL file that could contain either traces or searchdata

Types

type AppendBlock

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

AppendBlock is a block that is actively used to append new objects to. It stores all data in the appendFile in the order it was received and an in memory sorted index.

func (*AppendBlock) Append added in v1.2.0

func (a *AppendBlock) Append(id common.ID, b []byte, start, end uint32) error

Append adds an id and object to this wal block. start/end should indicate the time range associated with the past object. They are unix epoch seconds.

func (*AppendBlock) BlockID added in v0.7.0

func (a *AppendBlock) BlockID() uuid.UUID

func (*AppendBlock) Clear

func (a *AppendBlock) Clear() error

func (*AppendBlock) DataLength added in v0.6.0

func (a *AppendBlock) DataLength() uint64

func (*AppendBlock) Find

func (a *AppendBlock) Find(id common.ID, combiner model.ObjectCombiner) ([]byte, error)

func (*AppendBlock) Iterator added in v1.2.0

func (a *AppendBlock) Iterator(combiner model.ObjectCombiner) (common.Iterator, error)

func (*AppendBlock) Meta added in v0.7.0

func (a *AppendBlock) Meta() *backend.BlockMeta

type Config

type Config struct {
	Filepath          string `yaml:"path"`
	CompletedFilepath string
	BlocksFilepath    string
	Encoding          backend.Encoding `yaml:"encoding"`
	SearchEncoding    backend.Encoding `yaml:"search_encoding"`
	IngestionSlack    time.Duration    `yaml:"ingestion_time_range_slack"`
}

type LocalBlock added in v0.7.0

type LocalBlock struct {
	common.BackendBlock
	// contains filtered or unexported fields
}

LocalBlock is a block stored in a local storage. It can be searched and flushed to a remote backend, and permanently tracks the flushed time with a special file in the block

func NewLocalBlock added in v0.7.0

func NewLocalBlock(ctx context.Context, existingBlock common.BackendBlock, l *local.Backend) (*LocalBlock, error)

func (*LocalBlock) FindTraceByID added in v1.4.0

func (c *LocalBlock) FindTraceByID(ctx context.Context, id common.ID) (*tempopb.Trace, error)

func (*LocalBlock) FlushedTime added in v0.7.0

func (c *LocalBlock) FlushedTime() time.Time

FlushedTime returns the time the block was flushed. Will return 0

if the block was never flushed

func (*LocalBlock) SetFlushed added in v0.7.0

func (c *LocalBlock) SetFlushed(ctx context.Context) error

func (*LocalBlock) Write added in v0.7.0

func (c *LocalBlock) Write(ctx context.Context, w backend.Writer) error

type RangeFunc added in v1.4.0

type RangeFunc func(obj []byte, dataEncoding string) (uint32, uint32, error)

extracts a time range from an object. start/end times returned are unix epoch seconds

type WAL

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

func New

func New(c *Config) (*WAL, error)

func (*WAL) ClearFolder added in v1.2.0

func (w *WAL) ClearFolder(dir string) error

func (*WAL) GetFilepath added in v1.2.0

func (w *WAL) GetFilepath() string

func (*WAL) LocalBackend added in v0.7.0

func (w *WAL) LocalBackend() *local.Backend

func (*WAL) NewBlock

func (w *WAL) NewBlock(id uuid.UUID, tenantID string, dataEncoding string) (*AppendBlock, error)

func (*WAL) NewFile added in v1.2.0

func (w *WAL) NewFile(blockid uuid.UUID, tenantid string, dir string) (*os.File, backend.Encoding, error)

func (*WAL) RescanBlocks added in v1.0.0

func (w *WAL) RescanBlocks(fn RangeFunc, additionalStartSlack time.Duration, log log.Logger) ([]*AppendBlock, error)

RescanBlocks returns a slice of append blocks from the wal folder

Jump to

Keyboard shortcuts

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