wal

package
Version: v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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) BlockID

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

func (*AppendBlock) Clear

func (a *AppendBlock) Clear() error

func (*AppendBlock) DataLength

func (a *AppendBlock) DataLength() uint64

func (*AppendBlock) Find

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

func (*AppendBlock) GetIterator

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

func (*AppendBlock) Meta

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

func (*AppendBlock) Write

func (a *AppendBlock) Write(id common.ID, b []byte) error

type Config

type Config struct {
	Filepath          string `yaml:"path"`
	CompletedFilepath string
	BlocksFilepath    string
	Encoding          backend.Encoding `yaml:"encoding"`
}

type LocalBlock

type LocalBlock struct {
	encoding.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

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

func (*LocalBlock) Find

func (c *LocalBlock) Find(ctx context.Context, id common.ID) ([]byte, error)

func (*LocalBlock) FlushedTime

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

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

func (*LocalBlock) Write

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

type WAL

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

func New

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

func (*WAL) LocalBackend

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

func (*WAL) NewBlock

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

func (*WAL) RescanBlocks

func (w *WAL) RescanBlocks(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