encoding

package
v0.0.0-...-22113b6 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyBlock

func CopyBlock(ctx context.Context, meta *backend.BlockMeta, from backend.Reader, to backend.Writer) error

CopyBlock from one backend to another. It automatically chooses the encoding for the given block.

func OpenBlock

func OpenBlock(meta *backend.BlockMeta, r backend.Reader) (common.BackendBlock, error)

OpenBlock for reading in the backend. It automatically chooes the encoding for the given block.

Types

type VersionedEncoding

type VersionedEncoding interface {
	Version() string

	// OpenBlock for reading
	OpenBlock(meta *backend.BlockMeta, r backend.Reader) (common.BackendBlock, error)

	// NewCompactor creates a Compactor that can be used to combine blocks of this
	// encoding. It is expected to use internal details for efficiency.
	NewCompactor(common.CompactionOptions) common.Compactor

	// CreateBlock with the given attributes and snapshot contents.
	// BlockMeta is used as a container for many options. Required fields:
	// * BlockID
	// * TenantID
	// * Encoding
	// * DataEncoding
	// * StartTime
	// * EndTime
	// * TotalObjects
	CreateBlock(ctx context.Context, cfg *common.BlockConfig, meta *backend.BlockMeta, i common.Iterator, r backend.Reader, to backend.Writer) (*backend.BlockMeta, error)

	// CopyBlock from one backend to another.
	CopyBlock(ctx context.Context, meta *backend.BlockMeta, from backend.Reader, to backend.Writer) error

	// MigrateBlock from one backend and tenant to another.
	MigrateBlock(ctx context.Context, fromMeta, toMeta *backend.BlockMeta, from backend.Reader, to backend.Writer) error

	// OpenWALBlock opens an existing appendable block for the WAL
	OpenWALBlock(filename string, path string, ingestionSlack time.Duration, additionalStartSlack time.Duration) (common.WALBlock, error, error)

	// CreateWALBlock creates a new appendable block for the WAL
	CreateWALBlock(id uuid.UUID, tenantID string, filepath string, e backend.Encoding, dataEncoding string, ingestionSlack time.Duration) (common.WALBlock, error)

	// OwnsWALBlock indicates if this encoding owns the WAL block
	OwnsWALBlock(entry fs.DirEntry) bool
}

VersionedEncoding represents a backend block version, and the methods to read/write them.

func AllEncodings

func AllEncodings() []VersionedEncoding

AllEncodings returns all encodings

func DefaultEncoding

func DefaultEncoding() VersionedEncoding

DefaultEncoding for newly written blocks.

func FromVersion

func FromVersion(v string) (VersionedEncoding, error)

FromVersion returns a versioned encoding for the provided string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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