db

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 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
	BucketProviders           = []byte("providers")            // Legacy bucket, no longer used as provider source of truth
	BucketProviderInstances   = []byte("provider_instances")   // Unified provider records (all types)
	BucketCustomProviders     = []byte("custom_providers")     // Legacy custom providers, migrated to provider_instances on startup
	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
	BucketModelInfo           = []byte("model_info")           // Legacy bucket, no longer used for model metadata caching
	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
	BucketProxies             = []byte("proxies_v2")           // Proxy pool records (manual + list-sourced)
	BucketProxyLimits         = []byte("proxy_limits")         // Per-pair live state: (proxy, provider) limits and blocks
	BucketActiveRegions       = []byte("active_regions")       // Demanded proxy exit locations
	BucketProxySourceMeta     = []byte("proxy_source_meta")    // Last fetch totals per proxy list source
)

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

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