aggregate

package
v0.16.11 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 10 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 aggregate provides private, bounded resident storage for capture state.

Index

Constants

View Source
const BatchBytes = 256 << 10
View Source
const BatchRows = 32

Variables

This section is empty.

Functions

This section is empty.

Types

type Health

type Health struct {
	LimitBytes         int64  `json:"limitBytes"`
	ResidentBytes      int64  `json:"residentBytes"`
	PeakBytes          int64  `json:"peakBytes"`
	DiskReads          uint64 `json:"diskReads"`
	DiskWrites         uint64 `json:"diskWrites"`
	Evictions          uint64 `json:"evictions"`
	DatabaseBytes      int64  `json:"databaseBytes"`
	PreparedStatements uint64 `json:"preparedStatements"`
}

type Row added in v0.16.9

type Row struct {
	Key   string
	Value []byte
}

type Store

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

Store owns an ephemeral SQLite file. ResidentBytes charges encoded values, keys and 256 bytes per LRU entry; SQLite has a separate 1 MiB page cache. A caller's decoded record and serialization scratch are outside this cache.

func Open

func Open(directory string, limit int64, cancel func()) (*Store, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) Do

func (s *Store) Do(fn func(*Tx) error) error

func (*Store) Error

func (s *Store) Error() error

func (*Store) Health

func (s *Store) Health() Health

func (*Store) MarkSeen added in v0.16.9

func (s *Store) MarkSeen(key string) (bool, error)

MarkSeen atomically records a namespaced key and reports whether it existed.

type Tx

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

Tx is valid only inside Do's callback. Callbacks must not call Store methods.

func (*Tx) Count

func (t *Tx) Count(prefix string) (int64, error)

func (*Tx) Delete

func (t *Tx) Delete(prefix string) error

func (*Tx) DeleteKey

func (t *Tx) DeleteKey(key string) error

func (*Tx) Each

func (t *Tx) Each(prefix string, fn func(string, []byte) error) error

Each visits an ordered range with one row resident at a time. The callback may replace the same key; it must not add keys to the range being visited.

func (*Tx) EachStable added in v0.16.9

func (t *Tx) EachStable(prefix string, fn func(string, []byte) error) error

EachStable batches a range whose membership and future rows do not change. The callback may rewrite its current row; SQL cursors close before callbacks.

func (*Tx) Find

func (t *Tx) Find(prefix, upper string, descending bool) (string, []byte, bool, error)

Find selects the nearest key in prefix's range, optionally bounded above. It merges dirty cache entries with persisted rows without flushing the cache.

func (*Tx) Get

func (t *Tx) Get(key string) ([]byte, bool, error)

func (*Tx) Last

func (t *Tx) Last(prefix string) (string, []byte, bool, error)

func (*Tx) Next

func (t *Tx) Next(prefix, after string) (string, []byte, bool, error)

Next returns one ordered row after flushing pending writes. An empty after starts at prefix. Callers can release Do's lock between successive records.

func (*Tx) NextBatch added in v0.16.9

func (t *Tx) NextBatch(prefix, after string) ([]Row, error)

NextBatch copies a frozen range before the caller releases Do. Consumers run outside Do; mutable ranges must keep Next/Each's per-record visibility. One oversized first row is returned to make progress, as with Next.

func (*Tx) Put

func (t *Tx) Put(key string, value []byte) error

Jump to

Keyboard shortcuts

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