storage

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package storage provides domain-specific storage interfaces for ToolHive.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a requested resource does not exist.
	ErrNotFound = httperr.WithCode(
		errors.New("resource not found"),
		http.StatusNotFound,
	)

	// ErrAlreadyExists is returned when a resource already exists.
	ErrAlreadyExists = httperr.WithCode(
		errors.New("resource already exists"),
		http.StatusConflict,
	)
)

Functions

This section is empty.

Types

type EntryType added in v0.32.0

type EntryType string

EntryType is the typed discriminator for the entries.entry_type column. The entries table is shared across installed skills and plugins so that a skill and a plugin can share the same name without colliding; the (entry_type, name) pair is unique, not name alone. Both skill_store.go and plugin_store.go reference these constants without importing each other's domain package.

const (
	// EntryTypeSkill identifies entries that own installed_skills rows.
	EntryTypeSkill EntryType = "skill"
	// EntryTypePlugin identifies entries that own installed_plugins rows.
	EntryTypePlugin EntryType = "plugin"
)

type ListFilter

type ListFilter struct {
	// Scope filters by installation scope. Empty matches all scopes.
	Scope skills.Scope
	// ProjectRoot filters by project root path. Empty matches all projects.
	ProjectRoot string
	// ClientApp filters by client application. Empty matches all clients.
	ClientApp string
}

ListFilter configures filtering for List operations. Shared by SkillStore and PluginStore (the scope/project-root/client-app filtering shape is identical; ListFilter.Scope is skills.Scope, which plugins.Scope aliases).

type NoopPluginStore added in v0.32.0

type NoopPluginStore struct{}

NoopPluginStore is a no-op implementation of PluginStore for Kubernetes environments. Mirrors NoopSkillStore: Get returns ErrNotFound, List returns empty, and write operations succeed silently.

func (*NoopPluginStore) Close added in v0.32.0

func (*NoopPluginStore) Close() error

Close is a no-op that always succeeds.

func (*NoopPluginStore) Create added in v0.32.0

Create is a no-op that always succeeds.

func (*NoopPluginStore) Delete added in v0.32.0

Delete is a no-op that always succeeds.

func (*NoopPluginStore) Get added in v0.32.0

Get always returns ErrNotFound in the no-op implementation.

func (*NoopPluginStore) List added in v0.32.0

List always returns an empty slice in the no-op implementation.

func (*NoopPluginStore) Update added in v0.32.0

Update is a no-op that always succeeds.

type NoopSkillStore

type NoopSkillStore struct{}

NoopSkillStore is a no-op implementation of SkillStore for Kubernetes environments. Get always returns ErrNotFound, List returns empty, and write operations succeed silently.

func (*NoopSkillStore) Close

func (*NoopSkillStore) Close() error

Close is a no-op that always succeeds.

func (*NoopSkillStore) Create

Create is a no-op that always succeeds.

func (*NoopSkillStore) Delete

Delete is a no-op that always succeeds.

func (*NoopSkillStore) Get

Get always returns ErrNotFound in the no-op implementation.

func (*NoopSkillStore) List

List always returns an empty slice in the no-op implementation.

func (*NoopSkillStore) Update

Update is a no-op that always succeeds.

type PluginStore added in v0.32.0

type PluginStore interface {
	// Create stores a new installed plugin.
	Create(ctx context.Context, plugin plugins.InstalledPlugin) error
	// Get retrieves an installed plugin by name, scope, and project root.
	Get(ctx context.Context, name string, scope plugins.Scope, projectRoot string) (plugins.InstalledPlugin, error)
	// List returns all installed plugins matching the given filter.
	List(ctx context.Context, filter ListFilter) ([]plugins.InstalledPlugin, error)
	// Update modifies an existing installed plugin.
	Update(ctx context.Context, plugin plugins.InstalledPlugin) error
	// Delete removes an installed plugin by name, scope, and project root.
	Delete(ctx context.Context, name string, scope plugins.Scope, projectRoot string) error
	// Close releases any resources held by the store.
	Close() error
}

PluginStore defines the interface for managing plugin persistence. Mirrors SkillStore; the two share the ListFilter type and the entries table but store plugin-specific rows in installed_plugins/plugin_dependencies.

type SkillStore

type SkillStore interface {
	// Create stores a new installed skill.
	Create(ctx context.Context, skill skills.InstalledSkill) error
	// Get retrieves an installed skill by name, scope, and project root.
	Get(ctx context.Context, name string, scope skills.Scope, projectRoot string) (skills.InstalledSkill, error)
	// List returns all installed skills matching the given filter.
	List(ctx context.Context, filter ListFilter) ([]skills.InstalledSkill, error)
	// Update modifies an existing installed skill.
	Update(ctx context.Context, skill skills.InstalledSkill) error
	// Delete removes an installed skill by name, scope, and project root.
	Delete(ctx context.Context, name string, scope skills.Scope, projectRoot string) error
	// Close releases any resources held by the store.
	Close() error
}

SkillStore defines the interface for managing skill persistence.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package sqlite provides SQLite-backed persistent storage for ToolHive.
Package sqlite provides SQLite-backed persistent storage for ToolHive.

Jump to

Keyboard shortcuts

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