Documentation
¶
Overview ¶
Package sqlite provides SQLite-backed persistent storage for ToolHive.
Index ¶
- func DefaultDBPath() string
- func NewDefaultPluginStore() (storage.PluginStore, error)
- func NewDefaultSkillStore() (storage.SkillStore, error)
- type DB
- type PluginStore
- func (s *PluginStore) Close() error
- func (s *PluginStore) Create(ctx context.Context, plugin plugins.InstalledPlugin) error
- func (s *PluginStore) Delete(ctx context.Context, name string, scope plugins.Scope, projectRoot string) error
- func (s *PluginStore) Get(ctx context.Context, name string, scope plugins.Scope, projectRoot string) (plugins.InstalledPlugin, error)
- func (s *PluginStore) List(ctx context.Context, filter storage.ListFilter) ([]plugins.InstalledPlugin, error)
- func (s *PluginStore) Update(ctx context.Context, plugin plugins.InstalledPlugin) error
- type SkillStore
- func (s *SkillStore) Close() error
- func (s *SkillStore) Create(ctx context.Context, skill skills.InstalledSkill) error
- func (s *SkillStore) Delete(ctx context.Context, name string, scope skills.Scope, projectRoot string) error
- func (s *SkillStore) Get(ctx context.Context, name string, scope skills.Scope, projectRoot string) (skills.InstalledSkill, error)
- func (s *SkillStore) List(ctx context.Context, filter storage.ListFilter) ([]skills.InstalledSkill, error)
- func (s *SkillStore) Update(ctx context.Context, skill skills.InstalledSkill) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultDBPath ¶
func DefaultDBPath() string
DefaultDBPath returns the default file path for the ToolHive SQLite database, located under the XDG state directory.
func NewDefaultPluginStore ¶ added in v0.32.0
func NewDefaultPluginStore() (storage.PluginStore, error)
NewDefaultPluginStore creates a PluginStore using OS environment for runtime detection. In Kubernetes it returns a NoopPluginStore; locally it opens the shared SQLite database at the default path (the same file as skills — Open runs all migrations including 002_create_plugins). The caller owns the returned store. Mirrors NewDefaultSkillStore.
func NewDefaultSkillStore ¶
func NewDefaultSkillStore() (storage.SkillStore, error)
NewDefaultSkillStore creates a SkillStore using OS environment for runtime detection. In Kubernetes it returns a NoopSkillStore; locally it opens a SQLite database at the default path. The caller owns the returned store.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB wraps a *sql.DB connection to a SQLite database.
type PluginStore ¶ added in v0.32.0
type PluginStore struct {
// contains filtered or unexported fields
}
PluginStore implements storage.PluginStore using SQLite. It is a structural mirror of SkillStore (pkg/storage/sqlite/skill_store.go), substituting plugin types and the installed_plugins/plugin_dependencies tables. It shares the entries table with SkillStore via the entry_type discriminator (storage.EntryTypePlugin), so a skill and a plugin can share the same name.
func NewPluginStore ¶ added in v0.32.0
func NewPluginStore(db *DB) *PluginStore
NewPluginStore creates a new SQLite-backed PluginStore.
func (*PluginStore) Close ¶ added in v0.32.0
func (s *PluginStore) Close() error
Close closes the underlying database connection.
func (*PluginStore) Create ¶ added in v0.32.0
func (s *PluginStore) Create(ctx context.Context, plugin plugins.InstalledPlugin) error
Create stores a new installed plugin.
func (*PluginStore) Delete ¶ added in v0.32.0
func (s *PluginStore) Delete(ctx context.Context, name string, scope plugins.Scope, projectRoot string) error
Delete removes an installed plugin by name, scope, and project root.
func (*PluginStore) Get ¶ added in v0.32.0
func (s *PluginStore) Get( ctx context.Context, name string, scope plugins.Scope, projectRoot string, ) (plugins.InstalledPlugin, error)
Get retrieves an installed plugin by name, scope, and project root.
func (*PluginStore) List ¶ added in v0.32.0
func (s *PluginStore) List(ctx context.Context, filter storage.ListFilter) ([]plugins.InstalledPlugin, error)
List returns all installed plugins matching the given filter. It uses the SAME two-phase fetch pattern as SkillStore.List: Phase 1 collects rows + IDs and closes the rows cursor; Phase 2 fetches dependencies per ID. This is required because SQLite MaxOpenConns=1 means fetchDependencies cannot run while the List rows cursor is still open — forgetting this deadlocks under load.
func (*PluginStore) Update ¶ added in v0.32.0
func (s *PluginStore) Update(ctx context.Context, plugin plugins.InstalledPlugin) error
Update modifies an existing installed plugin.
type SkillStore ¶
type SkillStore struct {
// contains filtered or unexported fields
}
SkillStore implements storage.SkillStore using SQLite.
func NewSkillStore ¶
func NewSkillStore(db *DB) *SkillStore
NewSkillStore creates a new SQLite-backed SkillStore.
func (*SkillStore) Close ¶
func (s *SkillStore) Close() error
Close closes the underlying database connection.
func (*SkillStore) Create ¶
func (s *SkillStore) Create(ctx context.Context, skill skills.InstalledSkill) error
Create stores a new installed skill.
func (*SkillStore) Delete ¶
func (s *SkillStore) Delete(ctx context.Context, name string, scope skills.Scope, projectRoot string) error
Delete removes an installed skill by name, scope, and project root.
func (*SkillStore) Get ¶
func (s *SkillStore) Get( ctx context.Context, name string, scope skills.Scope, projectRoot string, ) (skills.InstalledSkill, error)
Get retrieves an installed skill by name, scope, and project root.
func (*SkillStore) List ¶
func (s *SkillStore) List(ctx context.Context, filter storage.ListFilter) ([]skills.InstalledSkill, error)
List returns all installed skills matching the given filter.
func (*SkillStore) Update ¶
func (s *SkillStore) Update(ctx context.Context, skill skills.InstalledSkill) error
Update modifies an existing installed skill.