db

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package db manages the embedded bbolt database and all bucket definitions.

Index

Constants

This section is empty.

Variables

View Source
var (
	BucketMeta                = []byte("meta")                 // bootstrap state, schema version
	BucketAdmin               = []byte("admin")                // AdminUser records
	BucketTokens              = []byte("tokens")               // RouterToken records (keyed by ID)
	BucketTokenIndex          = []byte("token_index")          // token value → token ID lookup
	BucketProviderInstances   = []byte("provider_instances")   // Unified provider records (all types)
	BucketCredentials         = []byte("credentials")          // Credential records
	BucketPlugins             = []byte("plugins")              // Installed Lua plugin records
	BucketPluginRepos         = []byte("plugin_repos")         // Added plugin repositories
	BucketPluginStorage       = []byte("plugin_storage")       // llm_router.storage.* key/value per plugin
	BucketAuth                = []byte("auth")                 // Ephemeral auth state
	BucketSessions            = []byte("sessions")             // Dashboard sessions
	BucketMetrics             = []byte("metrics")              // Time-series metrics data
	BucketVirtualModels       = []byte("virtual_models")       // VirtualModel records
	BucketRouterConfiguration = []byte("router_configuration") // Instance configuration (RouterConfiguration)
	BucketModelOverrides      = []byte("model_overrides")      // Per-provider model enable/disable and custom models
	BucketModelInfos          = []byte("model_infos")          // Persisted per-provider model metadata cache
	BucketProxyCache          = []byte("proxy_cache_v1")       // proxypool ProxyState records keyed by canonical URL
	BucketCustomPools         = []byte("custom_pools")         // Manually managed proxy pools: ID → CustomProxyPool
	BucketVideoJobs           = []byte("video_jobs")           // Router-side video generation jobs: ID → VideoJob
	BucketResponses           = []byte("responses")            // Router-side compat records: ID → ResponseRecord (responses, conversations, assistants, threads, messages, runs)
	BucketMessageBatches      = []byte("message_batches")      // Router-side Anthropic message batches: ID → BatchRecord
	BucketCredentialHealth    = []byte("credential_health")    // Credential health-check state: credential ID → last check
	BucketCredentialParks     = []byte("credential_parks")     // Unified cooldown parks: credential ID → ParkEntry
)

Bucket names — the single source of truth for all DB keys.

View Source
var (
	MetaKeyBootstrapped = []byte("bootstrapped")
	MetaValueTrue       = []byte("true")
)

Meta keys inside the meta bucket.

Functions

This section is empty.

Types

type DB

type DB struct {
	*bolt.DB
}

DB wraps a bbolt.DB and ensures all required buckets exist.

func Open

func Open(path string) (*DB, error)

Open opens (or creates) the bbolt database at the given path and ensures every required bucket is created.

func (*DB) IsBootstrapped

func (db *DB) IsBootstrapped() (bool, error)

IsBootstrapped returns true once the admin account has been created.

func (*DB) SetBootstrapped

func (db *DB) SetBootstrapped() error

SetBootstrapped marks the database as fully initialized.

Jump to

Keyboard shortcuts

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