store

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: AGPL-3.0 Imports: 13 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MigrateFromGOB

func MigrateFromGOB(stateRoot string, s *Store) error

MigrateFromGOB checks for old GOB settings files and migrates them to bbolt. stateRoot is the absolute path to the state directory (e.g., ~/.omniview). Old files are renamed to .gob.bak after successful migration. Corrupt or unreadable files are skipped and reported in a single aggregated log.

Types

type Option

type Option func(*config)

Option configures the Store. Reserved for future encryption support.

type Store

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

Store wraps bbolt for settings persistence.

func Open

func Open(path string, opts ...Option) (*Store, error)

Open opens (or creates) a bbolt database at path. Both top-level buckets ("core" and "plugins") are pre-created. If the file is corrupt, it is renamed with a .corrupt.<unix-timestamp> suffix and a fresh database is created in its place.

func (*Store) Close

func (s *Store) Close() error

Close closes the underlying bbolt database. It is safe to call on a nil Store or a Store with a nil db.

func (*Store) DeletePluginSettings

func (s *Store) DeletePluginSettings(pluginID string) error

DeletePluginSettings removes a plugin's settings from the "plugins" bucket. It is a no-op if the plugin does not exist.

func (*Store) LoadAllPluginSettings

func (s *Store) LoadAllPluginSettings() (map[string]map[string]any, error)

LoadAllPluginSettings returns all plugin settings keyed by plugin ID. Returns an empty (non-nil) map if no plugins have saved settings.

func (*Store) LoadCategory

func (s *Store) LoadCategory(categoryID string) (map[string]any, error)

LoadCategory retrieves a category's settings from the "core" bucket. Returns an empty (non-nil) map if the category does not exist.

func (*Store) LoadPluginSettings

func (s *Store) LoadPluginSettings(pluginID string) (map[string]any, error)

LoadPluginSettings retrieves a plugin's settings from the "plugins" bucket. Returns an empty (non-nil) map if the plugin does not exist.

func (*Store) SaveCategory

func (s *Store) SaveCategory(categoryID string, values map[string]any) error

SaveCategory persists a category's settings under the "core" bucket. Values are JSON-encoded and stored under the given categoryID key.

func (*Store) SavePluginSettings

func (s *Store) SavePluginSettings(pluginID string, values map[string]any) error

SavePluginSettings persists a plugin's settings under the "plugins" bucket.

Jump to

Keyboard shortcuts

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