Documentation
¶
Index ¶
- Variables
- func QuarantineBatch(root, id string) (string, error)
- func WithIngestAdmission(ctx context.Context) context.Context
- type Batch
- type BatchIssue
- type ErrIngestThrottled
- type ParquetPublisher
- type Repository
- func (r *Repository) CleanupParquet() error
- func (r *Repository) Close() error
- func (r *Repository) CollectRetiredParquet() (int, error)
- func (r *Repository) Commit(ctx context.Context, batch Batch) error
- func (r *Repository) CompactParquet(ctx context.Context, publisher ParquetPublisher, maxBatches int) (int, error)
- func (r *Repository) CompactParquetPass(ctx context.Context, publisher ParquetPublisher, maxBatches int, ...) (int, error)
- func (r *Repository) CompactionDebt() int
- func (r *Repository) PruneParquet(ctx context.Context, publisher ParquetPublisher, cutoff int64, maxBatches int) (int, error)
- func (r *Repository) PruneParquetPass(ctx context.Context, publisher ParquetPublisher, cutoff int64, maxBatches int, ...) (int, error)
- func (r *Repository) PublicationBounds() (horizon, published, minimum int64)
- func (r *Repository) RowCount() uint64
- type Writer
- func (w *Writer) Admit(ctx context.Context, rows int) error
- func (w *Writer) Run(ctx context.Context) error
- func (w *Writer) SetAdmission(debt func() int, busy func() uint64)
- func (w *Writer) SetInFlightBudget(bytes int)
- func (w *Writer) Submit(ctx context.Context, batch Batch) error
- func (w *Writer) Wait()
Constants ¶
This section is empty.
Variables ¶
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 ¶
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.
Types ¶
type BatchIssue ¶
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 ¶
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) 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) SetAdmission ¶
SetAdmission must be called before Run or any submissions.
func (*Writer) SetInFlightBudget ¶
SetInFlightBudget caps the decoded telemetry the writer will hold across concurrent requests. Zero is unbounded.
func (*Writer) Submit ¶
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.