db

package
v0.1.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIndexOutOfBounds = errors.New("db: graph index out of bounds")

ErrIndexOutOfBounds is returned by Select when the graph selector is outside the range of allocated graphs. Callers can match it with errors.Is.

Functions

This section is empty.

Types

type DB

type DB[K ~uint64, P float32 | float64] struct {
	Config *config.ConfigSet
	Graphs []graph.Graph[K, P]
}

the db hols the logic of translating low level calls to the memory Graphs from and to the transaction object (that the server directly serialises to the client)

func NewDB

func NewDB[K ~uint64, P float32 | float64](cfg *config.ConfigSet) (*DB[K, P], error)

func (*DB[K, P]) NumGraphs

func (d *DB[K, P]) NumGraphs() int

NumGraphs reports how many graphs the store holds. Valid selectors are in [0, NumGraphs).

func (*DB[K, P]) Select

func (d *DB[K, P]) Select(index uint8) (graph.Graph[K, P], error)

func (*DB[K, P]) Start

func (d *DB[K, P]) Start() error

func (*DB[K, P]) Stats

func (d *DB[K, P]) Stats() Stats

Stats snapshots every graph in selector order. Graphs not yet populated (before Start, or after Stop) contribute zero-valued entries, so the method is safe to call at any point in the store's lifecycle. Each live graph is read-locked for its snapshot, consistent with the scheduler holding the write lock during merges.

func (*DB[K, P]) Stop

func (d *DB[K, P]) Stop() error

type GraphStats

type GraphStats struct {
	ID int `json:"id"`
	graph.GraphStats
}

GraphStats is one graph's snapshot, tagged with its selector.

type Stats

type Stats struct {
	Graphs []GraphStats `json:"graphs"`
}

Stats is a point-in-time snapshot of the store: one entry per graph, in selector order. It is computed on demand from the live graphs (never cached) and serialised as-is by the server's stats endpoint.

Jump to

Keyboard shortcuts

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