inspect

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package inspect aggregates database statistics for the CLI and MCP surfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(s *Stats) string

Render the stats as a plain text block.

func HumanDuration

func HumanDuration(seconds int64) string

Render a non-negative duration in seconds as the largest non-zero unit (s/m/h/d).

func HumanSize

func HumanSize(n int64) string

Render n as a human-readable size (B / KB / MB / …).

func RunePad

func RunePad(s string, width int) string

Pad s to width visible runes, appending spaces on the right.

func TruncateHash

func TruncateHash(h string) string

Truncate an opaque hash to maxHashLen runes, suffixing "..." if shortened.

Types

type LatestSnapshot

type LatestSnapshot struct {
	ID         int64
	CursorHash string
	Message    string
	AgeSeconds int64
}

type Stats

type Stats struct {
	DBPath               string
	DBSizeBytes          int64
	NodeCount            int
	SnapshotCount        int
	AvgTemp              float64
	MedianTemp           float64
	HotThreshold         float64
	ColdThreshold        float64
	HotCount             int
	ColdCount            int
	PinnedCount          int
	TokenCountTotal      int64
	FTSRowCount          int
	NodeCountsByType     map[string]int
	RelationCount        int
	RelationsByOrigin    map[string]int
	PendingRelationCount int
	Latest               *LatestSnapshot
}

func Collect

func Collect(ctx context.Context, st *store.Store, hotThreshold, coldThreshold float64) (*Stats, error)

Collect every stat surfaced by inspect and MemoryStats from the given store.

Jump to

Keyboard shortcuts

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