Documentation
¶
Overview ¶
Package plugin implements compile-time plugins, settings and migration metadata.
Index ¶
- Variables
- type AdminProvider
- type AdminResource
- type App
- type Configurable
- type Entry
- type FileMigrationStore
- func (s *FileMigrationStore) IsApplied(ctx context.Context, namespace, migrationID string) (bool, error)
- func (s *FileMigrationStore) ListApplied(ctx context.Context, namespace string) (map[string]time.Time, error)
- func (s *FileMigrationStore) MarkApplied(ctx context.Context, namespace, migrationID string, appliedAt time.Time) error
- func (s *FileMigrationStore) UnmarkApplied(ctx context.Context, namespace, migrationID string) error
- type FileSettingsStore
- type Manifest
- type ManifestProvider
- type MemoryMigrationStore
- func (s *MemoryMigrationStore) IsApplied(ctx context.Context, pluginName, migrationID string) (bool, error)
- func (s *MemoryMigrationStore) ListApplied(ctx context.Context, namespace string) (map[string]time.Time, error)
- func (s *MemoryMigrationStore) MarkApplied(ctx context.Context, pluginName, migrationID string, appliedAt time.Time) error
- func (s *MemoryMigrationStore) UnmarkApplied(ctx context.Context, pluginName, migrationID string) error
- type Migratable
- type Migration
- type MigrationReport
- type MigrationStateInspector
- type MigrationStateMutator
- type MigrationStateStore
- type Plugin
- type Registry
- func (r *Registry) Active() []Plugin
- func (r *Registry) AdminResources(name string) ([]AdminResource, bool)
- func (r *Registry) All() []Plugin
- func (r *Registry) ApplyMigrations(ctx context.Context, store MigrationStateStore) (MigrationReport, error)
- func (r *Registry) Disable(name string) error
- func (r *Registry) Enable(name string) error
- func (r *Registry) Entries() []Entry
- func (r *Registry) LoadSettings(ctx context.Context) error
- func (r *Registry) Manifests() []Manifest
- func (r *Registry) Register(p Plugin) error
- func (r *Registry) SetSetting(name, key string, value any) error
- func (r *Registry) SetSettingsStore(store SettingsStateStore)
- func (r *Registry) Setting(name, key string) (any, bool)
- func (r *Registry) Settings(name string) (map[string]any, bool)
- func (r *Registry) SettingsSchema(name string) (SettingsSchema, bool)
- func (r *Registry) UpdateSettings(name string, updates map[string]any) error
- type SessionMigrationStore
- func (s *SessionMigrationStore) IsApplied(ctx context.Context, pluginName, migrationID string) (bool, error)
- func (s *SessionMigrationStore) ListApplied(ctx context.Context, namespace string) (map[string]time.Time, error)
- func (s *SessionMigrationStore) MarkApplied(ctx context.Context, pluginName, migrationID string, appliedAt time.Time) error
- func (s *SessionMigrationStore) UnmarkApplied(ctx context.Context, pluginName, migrationID string) error
- type SessionSettingsStore
- type SettingField
- type SettingsSchema
- type SettingsSchemaProvider
- type SettingsStateStore
Constants ¶
This section is empty.
Variables ¶
var ErrPluginNotFound = errors.New("plugin not found")
ErrPluginNotFound reports an operation on an unknown plugin.
Functions ¶
This section is empty.
Types ¶
type AdminProvider ¶
type AdminProvider interface {
AdminResources() []AdminResource
}
AdminProvider supplies declarative Admin API resources.
type AdminResource ¶
type App ¶
type App interface{}
App is the runtime value passed to plugins during initialization. Plugins may type-assert it to the application contracts they require.
type Configurable ¶
Configurable supplies default plugin settings.
type Entry ¶
type Entry struct {
Plugin Plugin
Manifest Manifest
Enabled bool
Settings map[string]any
SettingsSchema SettingsSchema
AdminResources []AdminResource
Migrations []Migration
// contains filtered or unexported fields
}
type FileMigrationStore ¶
type FileMigrationStore struct {
// contains filtered or unexported fields
}
func NewFileMigrationStore ¶
func NewFileMigrationStore(path string) *FileMigrationStore
func (*FileMigrationStore) ListApplied ¶
func (*FileMigrationStore) MarkApplied ¶
func (*FileMigrationStore) UnmarkApplied ¶
func (s *FileMigrationStore) UnmarkApplied(ctx context.Context, namespace, migrationID string) error
type FileSettingsStore ¶
type FileSettingsStore struct {
// contains filtered or unexported fields
}
func NewFileSettingsStore ¶
func NewFileSettingsStore(path string) *FileSettingsStore
type ManifestProvider ¶
type ManifestProvider interface {
Manifest() Manifest
}
ManifestProvider supplies extended plugin metadata.
type MemoryMigrationStore ¶
type MemoryMigrationStore struct {
// contains filtered or unexported fields
}
func NewMemoryMigrationStore ¶
func NewMemoryMigrationStore() *MemoryMigrationStore
func (*MemoryMigrationStore) ListApplied ¶
func (*MemoryMigrationStore) MarkApplied ¶
func (*MemoryMigrationStore) UnmarkApplied ¶
func (s *MemoryMigrationStore) UnmarkApplied(ctx context.Context, pluginName, migrationID string) error
type Migratable ¶
type Migratable interface {
Migrations() []Migration
}
Migratable supplies plugin migrations.
type Migration ¶
type Migration struct {
ID string
Name string
Up func(ctx context.Context) error
Down func(ctx context.Context) error
}
Migration is an ordered, uniquely identified plugin schema or data change.
type MigrationReport ¶
type MigrationStateInspector ¶
type MigrationStateMutator ¶
type MigrationStateStore ¶
type Plugin ¶
type Plugin interface {
Name() string
Version() string
Init(app App) error
Start(ctx context.Context) error
Stop(ctx context.Context) error
}
Plugin defines the lifecycle required by the runtime registry.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry owns plugin registration, state, settings and metadata.
func (*Registry) AdminResources ¶
func (r *Registry) AdminResources(name string) ([]AdminResource, bool)
func (*Registry) ApplyMigrations ¶
func (r *Registry) ApplyMigrations(ctx context.Context, store MigrationStateStore) (MigrationReport, error)
func (*Registry) SetSettingsStore ¶
func (r *Registry) SetSettingsStore(store SettingsStateStore)
func (*Registry) SettingsSchema ¶
func (r *Registry) SettingsSchema(name string) (SettingsSchema, bool)
type SessionMigrationStore ¶
type SessionMigrationStore struct {
// contains filtered or unexported fields
}
func NewSessionMigrationStore ¶
func NewSessionMigrationStore(repo storage.SessionRepository) *SessionMigrationStore
func (*SessionMigrationStore) ListApplied ¶
func (*SessionMigrationStore) MarkApplied ¶
func (*SessionMigrationStore) UnmarkApplied ¶
func (s *SessionMigrationStore) UnmarkApplied(ctx context.Context, pluginName, migrationID string) error
type SessionSettingsStore ¶
type SessionSettingsStore struct {
// contains filtered or unexported fields
}
func NewSessionSettingsStore ¶
func NewSessionSettingsStore(repo storage.SessionRepository) *SessionSettingsStore
type SettingField ¶
type SettingsSchema ¶
type SettingsSchema struct {
Fields []SettingField
}
type SettingsSchemaProvider ¶
type SettingsSchemaProvider interface {
SettingsSchema() SettingsSchema
}
SettingsSchemaProvider describes accepted plugin settings.