writegate

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: 4 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

Overview

Package writegate serializes and measures writes to DuckDB's rebuildable rollup cache.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gate

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

Gate serializes DuckDB writes while measuring how long each operation waits for and holds the critical section. The zero value is ready for use.

func (*Gate) Lock

func (g *Gate) Lock(operation Operation) func()

Lock acquires the cache write gate and returns its release function. Callers must defer the returned function before acquiring a database connection, transaction, or appender, and must call it exactly once.

func (*Gate) LockContext

func (g *Gate) LockContext(ctx context.Context, operation Operation) (func(), error)

LockContext acquires the cache write gate, or returns when ctx expires.

func (*Gate) TryLock

func (g *Gate) TryLock(operation Operation) func()

TryLock acquires an idle gate, returning nil when another writer owns it. Optional cache work must not delay authoritative Parquet publication.

type Operation

type Operation string

Operation is a bounded metric label for a rollup-cache write. Keep this list exhaustive: arbitrary strings would create an unbounded Prometheus label surface.

const (
	RollupSkip    Operation = "rollup_skip_to_latest"
	RollupService Operation = "rollup_service"
	ReadCache     Operation = "read_cache"
	RollupEdge    Operation = "rollup_edge"
	RollupVersion Operation = "rollup_version"
	AnomalyLog    Operation = "anomaly_log"
	Maintenance   Operation = "maintenance"
)

Jump to

Keyboard shortcuts

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