store

package
v0.0.0-...-0301fe8 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIngestOverBudget = errors.New("telemetry ingest is over its in-flight byte budget")

ErrIngestOverBudget is returned when accepting a request would take the process past the bytes it is willing to hold in flight. Callers map it to a retryable status so a sender backs off and resends: shedding load is the point, and a dropped request would defeat it.

Functions

func QuarantineBatch

func QuarantineBatch(root, id string) (string, error)

QuarantineBatch atomically sets aside one specifically named unreadable batch. Valid data is refused. The returned directory remains beside the authoritative set so an operator can recover it from a backup or rename it back after repair. Repair runs only against a data directory no live instance holds -- the data-directory lock enforces that -- so there is no in-process compaction for it to collide with.

func WithIngestAdmission

func WithIngestAdmission(ctx context.Context) context.Context

WithIngestAdmission gives one export a receipt for pre-conversion admission. Submit consumes it once, so direct callers and repeated submissions still pay.

Types

type Batch

type Batch struct {
	ID      string
	Spans   []telemetry.Span
	Logs    []telemetry.Log
	Metrics []telemetry.Metric
}

type BatchIssue

type BatchIssue struct {
	ID   string
	Path string
	Err  error
}

BatchIssue is one authoritative batch that startup cannot validate.

func VerifyBatches

func VerifyBatches(root string) ([]BatchIssue, error)

VerifyBatches validates every authoritative batch without opening a live repository or changing the filesystem. Batches verify concurrently on one two-thread engine per two CPUs, each with its own fixed memory limit, so a large set uses the machine while no query grows with it; GOMAXPROCS bounds both. Issues keep directory order.

type ErrIngestThrottled

type ErrIngestThrottled struct {
	RetryAfter time.Duration
	Reason     string
}

ErrIngestThrottled refuses the whole export without retaining its payload.

func (*ErrIngestThrottled) Error

func (e *ErrIngestThrottled) Error() string

type ParquetPublisher

type ParquetPublisher interface {
	PublishParquet(context.Context, func(context.Context) error) error
	PublishParquetReplacement(context.Context, telemetry.BatchMetadata, []string, func(context.Context) error) error
}

ParquetPublisher lets the query layer wrap the atomic catalog swap; storage owns native merges, crash-safe replacement state and deferred deletion.

type Repository

type Repository struct {
	Parquet *telemetry.ParquetStore
	// contains filtered or unexported fields
}

Repository publishes self-contained Parquet batch directories. The directory rename is the transaction and the filesystem is the catalog.

func Open

func Open(root string) (*Repository, error)

func (*Repository) CleanupParquet

func (r *Repository) CleanupParquet() error

CleanupParquet removes retired inputs only while no retention or compaction transaction can still need them for rollback.

func (*Repository) Close

func (r *Repository) Close() error

func (*Repository) CollectRetiredParquet

func (r *Repository) CollectRetiredParquet() (int, error)

CollectRetiredParquet deletes batches that retention or compaction retired once no reader that captured them remains. Serialized with both, so a directory is never deleted while a publication or recovery inspects it.

func (*Repository) Commit

func (r *Repository) Commit(ctx context.Context, batch Batch) error

func (*Repository) CompactParquet

func (r *Repository) CompactParquet(ctx context.Context, publisher ParquetPublisher, maxBatches int) (int, error)

CompactParquet combines one same-window, same-generation group. The output is prepared outside the query gate and swapped as one batch directory.

func (*Repository) CompactParquetPass

func (r *Repository) CompactParquetPass(ctx context.Context, publisher ParquetPublisher, maxBatches int, budget time.Duration) (int, error)

CompactParquetPass starts complete compactions until the phase budget expires. The phase budget never cancels an in-flight merge; only blocking ingest debt preempts unprepared higher-generation work. Read pressure must not delay debt retirement: growing file counts hurts both reads and ingestion.

func (*Repository) CompactionDebt

func (r *Repository) CompactionDebt() int

func (*Repository) PruneParquet

func (r *Repository) PruneParquet(ctx context.Context, publisher ParquetPublisher, cutoff int64, maxBatches int) (int, error)

func (*Repository) PruneParquetPass

func (r *Repository) PruneParquetPass(ctx context.Context, publisher ParquetPublisher, cutoff int64, maxBatches int, budget time.Duration) (int, error)

PruneParquetPass starts bounded publications until the phase budget expires. The budget is checked between publications so an atomic swap is never canceled halfway through.

func (*Repository) PublicationBounds

func (r *Repository) PublicationBounds() (horizon, published, minimum int64)

PublicationBounds returns the exact completed-attempt horizon, the largest published stamp (for lag), and the minimum opened or reserved stamp (for initial catch-up). Compaction/recovery only republish existing stamps and do not reserve attempts.

func (*Repository) RowCount

func (r *Repository) RowCount() uint64

type Writer

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

func NewWriter

func NewWriter(repository *Repository, batchSize int) *Writer

func (*Writer) Admit

func (w *Writer) Admit(ctx context.Context, rows int) error

func (*Writer) Run

func (w *Writer) Run(ctx context.Context) error

func (*Writer) SetAdmission

func (w *Writer) SetAdmission(debt func() int, busy func() uint64)

SetAdmission must be called before Run or any submissions.

func (*Writer) SetInFlightBudget

func (w *Writer) SetInFlightBudget(bytes int)

SetInFlightBudget caps the decoded telemetry the writer will hold across concurrent requests. Zero is unbounded.

func (*Writer) Submit

func (w *Writer) Submit(ctx context.Context, batch Batch) error

Submit returns after every row in the request belongs to a durably published atomic Parquet batch directory. A request whose ctx is done before its commit starts is dropped unwritten, so the sender's retry is the only copy. Once the commit has started it completes, so a sender that gives up during it and retries stores the rows twice: delivery is at least once in that window, because OTLP has no idempotency key that survives across requests.

func (*Writer) Wait

func (w *Writer) Wait()

Jump to

Keyboard shortcuts

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