Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
// ErrNoType is returned when no type is specified
ErrNoType = errors.New("plugin: no type")
// ErrNoPluginID is returned when no id is specified
ErrNoPluginID = errors.New("plugin: no id")
// ErrSkipPlugin is used when a plugin is not initialized and should not be loaded,
// this allows the plugin loader differentiate between a plugin which is configured
// not to load and one that fails to load.
ErrSkipPlugin = errors.New("skip plugin")
// ErrInvalidRequires will be thrown if the requirements for a plugin are
// defined in an invalid manner.
ErrInvalidRequires = errors.New("invalid requires")
)
Functions ¶
func IsSkipPlugin ¶
func IsSkipPlugin(err error) bool
IsSkipPlugin returns true if the error is skipping the plugin
Types ¶
type InitContext ¶
type InitContext struct {
Context context.Context
Root string
State string
Config interface{}
Address string
Events *exchange.Exchange
Meta *Meta // plugins can fill in metadata at init.
// contains filtered or unexported fields
}
InitContext is used for plugin inititalization
func NewContext ¶
func NewContext(ctx context.Context, r *Registration, plugins *Set, root, state string) *InitContext
NewContext returns a new plugin InitContext
type Meta ¶
type Meta struct {
Platforms []ocispec.Platform // platforms supported by plugin
Exports map[string]string // values exported by plugin
Capabilities []string // feature switches for plugin
}
Meta contains information gathered from the registration and initialization process.
type Plugin ¶
type Plugin struct {
Registration *Registration // registration, as initialized
Config interface{} // config, as initialized
Meta *Meta
// contains filtered or unexported fields
}
Plugin represents an initialized plugin, used with an init context.
type Registration ¶
type Registration struct {
// Type of the plugin
Type Type
// ID of the plugin
ID string
// Config specific to the plugin
Config interface{}
// Requires is a list of plugins that the registered plugin requires to be available
Requires []Type
// InitFn is called when initializing a plugin. The registration and
// context are passed in. The init function may modify the registration to
// add exports, capabilities and platform support declarations.
InitFn func(*InitContext) (interface{}, error)
}
Registration contains information for registering a plugin
func Graph ¶
func Graph(disableList []string) (ordered []*Registration)
Graph returns an ordered list of registered plugins for initialization. Plugins in disableList specified by id will be disabled.
type Service ¶
type Service interface {
Register(*grpc.Server) error
}
Service allows GRPC services to be registered with the underlying server
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set defines a plugin collection, used with InitContext.
This maintains ordering and unique indexing over the set.
After iteratively instantiating plugins, this set should represent, the ordered, initialization set of plugins for a containerd instance.
type Type ¶
type Type string
Type is the type of the plugin
const (
// AllPlugins declares that the plugin should be initialized after all others.
AllPlugins Type = "*"
// RuntimePlugin implements a runtime
RuntimePlugin Type = "io.containerd.runtime.v1"
// ServicePlugin implements a internal service
ServicePlugin Type = "io.containerd.service.v1"
// GRPCPlugin implements a grpc service
GRPCPlugin Type = "io.containerd.grpc.v1"
// SnapshotPlugin implements a snapshotter
SnapshotPlugin Type = "io.containerd.snapshotter.v1"
// TaskMonitorPlugin implements a task monitor
TaskMonitorPlugin Type = "io.containerd.monitor.v1"
// DiffPlugin implements a differ
DiffPlugin Type = "io.containerd.differ.v1"
// MetadataPlugin implements a metadata store
MetadataPlugin Type = "io.containerd.metadata.v1"
// ContentPlugin implements a content store
ContentPlugin Type = "io.containerd.content.v1"
// GCPlugin implements garbage collection policy
GCPlugin Type = "io.containerd.gc.v1"
)