ingestpolicy

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package ingestpolicy assigns an ingestion priority to destination tables.

A Policy is immutable after construction and safe for concurrent use. Lookups do not allocate so they can be used on the write and upload hot paths.

Index

Constants

View Source
const NumPriorities = int(PriorityRealtime) + 1

NumPriorities is the number of defined priorities. It can be used to size per-priority arrays.

Variables

This section is empty.

Functions

This section is empty.

Types

type Policy

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

Policy maps destination tables to priorities. The zero value and a nil *Policy assign PriorityQueued to every table.

func New

func New(realtime []Table) (*Policy, error)

New returns a Policy where the given tables are realtime and all other tables are queued. Database and table names are normalized the same way as WAL segment keys. Names that are empty after normalization and duplicate tables are rejected.

func (*Policy) HasRealtime

func (p *Policy) HasRealtime() bool

HasRealtime returns true if any table is realtime.

func (*Policy) Priority

func (p *Policy) Priority(database, table string) Priority

Priority returns the priority for the normalized database and table. For WAL segments, obtain the database and table with wal.ParseFilename.

func (*Policy) PriorityBytes

func (p *Policy) PriorityBytes(database, table []byte) Priority

PriorityBytes is like Priority but accepts byte slices without allocating.

func (*Policy) RealtimeDatabases

func (p *Policy) RealtimeDatabases() []string

RealtimeDatabases returns the distinct normalized databases that contain realtime tables, sorted.

func (*Policy) RealtimeTables

func (p *Policy) RealtimeTables() []Table

RealtimeTables returns the normalized realtime tables sorted by database then table. The returned slice must not be modified.

type Priority

type Priority uint8

Priority is the ingestion priority of a destination table.

const (
	// PriorityQueued is the default priority. Data is uploaded with queued ingestion.
	PriorityQueued Priority = iota
	// PriorityRealtime data is uploaded with streaming ingestion.
	PriorityRealtime
)

func (Priority) String

func (p Priority) String() string

type Table

type Table struct {
	Database string
	Table    string
}

Table identifies a destination table.

func (Table) String

func (t Table) String() string

Jump to

Keyboard shortcuts

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