docker: Index | Files | Directories

package plugin

import ""


Package Files

backend_linux.go defs.go errors.go events.go fetch_linux.go manager.go manager_linux.go progress.go registry.go store.go

type CreateOpt Uses

type CreateOpt func(p *v2.Plugin)

CreateOpt is used to configure specific plugin details when created

func WithEnv Uses

func WithEnv(env []string) CreateOpt

WithEnv is a CreateOpt that passes the user-provided environment variables to the plugin container, de-duplicating variables with the same names case sensitively and only appends valid key=value pairs

func WithSwarmService Uses

func WithSwarmService(id string) CreateOpt

WithSwarmService is a CreateOpt that flags the passed in a plugin as a plugin managed by swarm

type Event Uses

type Event interface {
    // contains filtered or unexported methods

Event is emitted for actions performed on the plugin manager

type EventCreate Uses

type EventCreate struct {
    Interfaces map[string]bool
    Plugin     types.Plugin

EventCreate is an event which is emitted when a plugin is created This is either by pull or create from context.

Use the `Interfaces` field to match only plugins that implement a specific interface. These are matched against using "or" logic. If no interfaces are listed, all are matched.

type EventDisable Uses

type EventDisable struct {
    Plugin types.Plugin

EventDisable is an event that is emitted when a plugin is disabled It maches on the passed in plugin's ID only.

type EventEnable Uses

type EventEnable struct {
    Plugin types.Plugin

EventEnable is an event that is emitted when a plugin is disabled It maches on the passed in plugin's ID only.

type EventRemove Uses

type EventRemove struct {
    Plugin types.Plugin

EventRemove is an event which is emitted when a plugin is removed It maches on the passed in plugin's ID only.

type Executor Uses

type Executor interface {
    Create(id string, spec specs.Spec, stdout, stderr io.WriteCloser) error
    IsRunning(id string) (bool, error)
    Restore(id string, stdout, stderr io.WriteCloser) (alive bool, err error)
    Signal(id string, signal int) error

Executor is the interface that the plugin manager uses to interact with for starting/stopping plugins

type ExecutorCreator Uses

type ExecutorCreator func(*Manager) (Executor, error)

ExecutorCreator is used in the manager config to pass in an `Executor`

type Manager Uses

type Manager struct {
    // contains filtered or unexported fields

Manager controls the plugin subsystem.

func NewManager Uses

func NewManager(config ManagerConfig) (*Manager, error)

NewManager returns a new plugin manager.

func (*Manager) CreateFromContext Uses

func (pm *Manager) CreateFromContext(ctx context.Context, tarCtx io.ReadCloser, options *types.PluginCreateOptions) (err error)

CreateFromContext creates a plugin from the given pluginDir which contains both the rootfs and the config.json and a repoName with optional tag.

func (*Manager) Disable Uses

func (pm *Manager) Disable(refOrID string, config *types.PluginDisableConfig) error

Disable deactivates a plugin. This means resources (volumes, networks) cant use them.

func (*Manager) Enable Uses

func (pm *Manager) Enable(refOrID string, config *types.PluginEnableConfig) error

Enable activates a plugin, which implies that they are ready to be used by containers.

func (*Manager) GC Uses

func (pm *Manager) GC()

GC cleans up unreferenced blobs. This is recommended to run in a goroutine

func (*Manager) Get Uses

func (pm *Manager) Get(idOrName string) (*v2.Plugin, error)

Get looks up the requested plugin in the store.

func (*Manager) HandleExitEvent Uses

func (pm *Manager) HandleExitEvent(id string) error

HandleExitEvent is called when the executor receives the exit event In the future we may change this, but for now all we care about is the exit event.

func (*Manager) Inspect Uses

func (pm *Manager) Inspect(refOrID string) (tp *types.Plugin, err error)

Inspect examines a plugin config

func (*Manager) List Uses

func (pm *Manager) List(pluginFilters filters.Args) ([]types.Plugin, error)

List displays the list of plugins and associated metadata.

func (*Manager) Privileges Uses

func (pm *Manager) Privileges(ctx context.Context, ref reference.Named, metaHeader http.Header, authConfig *types.AuthConfig) (types.PluginPrivileges, error)

Privileges pulls a plugin config and computes the privileges required to install it.

func (*Manager) Pull Uses

func (pm *Manager) Pull(ctx context.Context, ref reference.Named, name string, metaHeader http.Header, authConfig *types.AuthConfig, privileges types.PluginPrivileges, outStream io.Writer, opts ...CreateOpt) (err error)

Pull pulls a plugin, check if the correct privileges are provided and install the plugin.

TODO: replace reference package usage with simpler url.Parse semantics

func (*Manager) Push Uses

func (pm *Manager) Push(ctx context.Context, name string, metaHeader http.Header, authConfig *types.AuthConfig, outStream io.Writer) error

Push pushes a plugin to the registry.

func (*Manager) Remove Uses

func (pm *Manager) Remove(name string, config *types.PluginRmConfig) error

Remove deletes plugin's root directory.

func (*Manager) Set Uses

func (pm *Manager) Set(name string, args []string) error

Set sets plugin args

func (*Manager) Shutdown Uses

func (pm *Manager) Shutdown()

Shutdown stops all plugins and called during daemon shutdown.

func (*Manager) SubscribeEvents Uses

func (pm *Manager) SubscribeEvents(buffer int, watchEvents ...Event) (eventCh <-chan interface{}, cancel func())

SubscribeEvents provides an event channel to listen for structured events from the plugin manager actions, CRUD operations. The caller must call the returned `cancel()` function once done with the channel or this will leak resources.

func (*Manager) Upgrade Uses

func (pm *Manager) Upgrade(ctx context.Context, ref reference.Named, name string, metaHeader http.Header, authConfig *types.AuthConfig, privileges types.PluginPrivileges, outStream io.Writer) (err error)

Upgrade upgrades a plugin

TODO: replace reference package usage with simpler url.Parse semantics

type ManagerConfig Uses

type ManagerConfig struct {
    Store              *Store // remove
    RegistryService    registry.Service
    LiveRestoreEnabled bool // TODO: remove
    LogPluginEvent     eventLogger
    Root               string
    ExecRoot           string
    CreateExecutor     ExecutorCreator
    AuthzMiddleware    *authorization.Middleware

ManagerConfig defines configuration needed to start new manager.

type SpecOpt Uses

type SpecOpt func(*specs.Spec)

SpecOpt is used for subsystems that need to modify the runtime spec of a plugin

func WithSpecMounts Uses

func WithSpecMounts(mounts []specs.Mount) SpecOpt

WithSpecMounts is a SpecOpt which appends the provided mounts to the runtime spec

type Store Uses

type Store struct {
    // contains filtered or unexported fields

Store manages the plugin inventory in memory and on-disk

func NewStore Uses

func NewStore() *Store

NewStore creates a Store.

func (*Store) Add Uses

func (ps *Store) Add(p *v2.Plugin) error

Add adds a plugin to memory and plugindb. An error will be returned if there is a collision.

func (*Store) CallHandler Uses

func (ps *Store) CallHandler(p *v2.Plugin)

CallHandler calls the registered callback. It is invoked during plugin enable.

func (*Store) Get Uses

func (ps *Store) Get(name, capability string, mode int) (plugingetter.CompatPlugin, error)

Get returns an enabled plugin matching the given name and capability.

func (*Store) GetAll Uses

func (ps *Store) GetAll() map[string]*v2.Plugin

GetAll retrieves all plugins.

func (*Store) GetAllByCap Uses

func (ps *Store) GetAllByCap(capability string) ([]plugingetter.CompatPlugin, error)

GetAllByCap returns a list of enabled plugins matching the given capability.

func (*Store) GetAllManagedPluginsByCap Uses

func (ps *Store) GetAllManagedPluginsByCap(capability string) []plugingetter.CompatPlugin

GetAllManagedPluginsByCap returns a list of managed plugins matching the given capability.

func (*Store) GetV2Plugin Uses

func (ps *Store) GetV2Plugin(refOrID string) (*v2.Plugin, error)

GetV2Plugin retrieves a plugin by name, id or partial ID.

func (*Store) Handle Uses

func (ps *Store) Handle(capability string, callback func(string, *plugins.Client))

Handle sets a callback for a given capability. It is only used by network and ipam drivers during plugin registration. The callback registers the driver with the subsystem (network, ipam).

func (*Store) RegisterRuntimeOpt Uses

func (ps *Store) RegisterRuntimeOpt(cap string, opts ...SpecOpt)

RegisterRuntimeOpt stores a list of SpecOpts for the provided capability. These options are applied to the runtime spec before a plugin is started for the specified capability.

func (*Store) Remove Uses

func (ps *Store) Remove(p *v2.Plugin)

Remove removes a plugin from memory and plugindb.

func (*Store) SetAll Uses

func (ps *Store) SetAll(plugins map[string]*v2.Plugin)

SetAll initialized plugins during daemon restore.

func (*Store) SetState Uses

func (ps *Store) SetState(p *v2.Plugin, state bool)

SetState sets the active state of the plugin and updates plugindb.



Package plugin imports 56 packages (graph) and is imported by 354 packages. Updated 2020-12-24. Refresh now. Tools for package owners.