Documentation
¶
Overview ¶
Package pluginkit provides compile-time plugin infrastructure: a lifecycle contract, a plugin host, and route guarding for plugin namespaces.
Index ¶
- func Protect(handler http.Handler, publicPaths []string, ...) http.Handler
- type Host
- func (h *Host) Migrate(ctx context.Context) error
- func (h *Host) PublicPaths() map[string][]string
- func (h *Host) Routes() map[string]http.Handler
- func (h *Host) Seed(ctx context.Context) error
- func (h *Host) Start(ctx context.Context, stopGrace time.Duration) error
- func (h *Host) Stop(ctx context.Context) error
- type Migrator
- type Plugin
- type PublicPathProvider
- type RouteProvider
- type Seeder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
Host starts and stops a fixed set of plugins.
func (*Host) Migrate ¶
Migrate applies the schema of every Migrator plugin in registration order, stopping at the first failure.
func (*Host) PublicPaths ¶
PublicPaths returns the session-exempt paths of every PublicPathProvider plugin, keyed by plugin ID.
func (*Host) Routes ¶
Routes returns the HTTP handler of every RouteProvider plugin, keyed by plugin ID.
func (*Host) Seed ¶
Seed asks every Seeder plugin to fill its schema in registration order, stopping at the first failure.
type Migrator ¶
Migrator is implemented by plugins that own database schema, which the host migrates before starting any plugin.
type Plugin ¶
type Plugin interface {
ID() string
Start(ctx context.Context) error
// Stop releases what the plugin holds, returning by the time ctx ends, whether or not Start ran.
Stop(ctx context.Context) error
}
Plugin is an independently addable unit of functionality with a managed lifecycle.
type PublicPathProvider ¶
type PublicPathProvider interface {
PublicPaths() []string
}
PublicPathProvider is implemented by plugins declaring namespace-relative paths that must stay reachable without a session. Paths match exactly, for every HTTP method, and all else stays protected.
type RouteProvider ¶
RouteProvider is implemented by plugins that expose HTTP endpoints under their own namespace.
Directories
¶
| Path | Synopsis |
|---|---|
|
graphwire
module
|
|
|
Package wire generates an application's plugin wiring files from the plugin.json manifest of every directory under each configured plugin root.
|
Package wire generates an application's plugin wiring files from the plugin.json manifest of every directory under each configured plugin root. |