Movatterモバイル変換


[0]ホーム

URL:


plugin

package
v2.0.0-beta.5Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License:Apache-2.0Imports:58Imported by:0

Details

Repository

github.com/moby/moby

Links

Documentation

Index

Constants

View Source
const MediaTypePluginConfig = "application/vnd.docker.plugin.v1+json"

MediaTypePluginConfig specifies the mediaType for plugin configuration.

It is a copy of the mediaType defined inschema2.MediaTypePluginConfig.

Variables

This section is empty.

Functions

This section is empty.

Types

typeCreateOpt

type CreateOpt func(p *v2.Plugin)

CreateOpt is used to configure specific plugin details when created

funcWithEnv

func WithEnv(env []string)CreateOpt

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

funcWithSwarmService

func WithSwarmService(idstring)CreateOpt

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

typeEndpointResolver

type EndpointResolver interface {LookupPullEndpoints(hostnamestring) (endpoints []registry.APIEndpoint, errerror)}

EndpointResolver provides looking up registry endpoints for pulling.

typeEvent

type Event interface {// contains filtered or unexported methods}

Event is emitted for actions performed on the plugin manager

typeEventCreate

type EventCreate struct {Interfaces map[string]boolPluginplugin.Plugin}

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

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

typeEventDisable

type EventDisable struct {Pluginplugin.Plugin}

EventDisable is an event that is emitted when a plugin is disabledIt matches on the passed in plugin's ID only.

typeEventEnable

type EventEnable struct {Pluginplugin.Plugin}

EventEnable is an event that is emitted when a plugin is disabledIt matches on the passed in plugin's ID only.

typeEventRemove

type EventRemove struct {Pluginplugin.Plugin}

EventRemove is an event which is emitted when a plugin is removedIt matches on the passed in plugin's ID only.

typeExecutor

type Executor interface {Create(idstring, spec specs.Spec, stdout, stderrio.WriteCloser)errorIsRunning(idstring) (bool,error)Restore(idstring, stdout, stderrio.WriteCloser) (alivebool, errerror)Signal(idstring, signalsyscall.Signal)error}

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

typeExecutorCreator

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

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

typeManager

type Manager struct {// contains filtered or unexported fields}

Manager controls the plugin subsystem.

funcNewManager

func NewManager(configManagerConfig) (*Manager,error)

NewManager returns a new plugin manager.

func (*Manager)CreateFromContext

func (pm *Manager) CreateFromContext(ctxcontext.Context, tarCtxio.ReadCloser, options *backend.PluginCreateConfig) (retErrerror)

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

func (*Manager)Disable

func (pm *Manager) Disable(refOrIDstring, config *backend.PluginDisableConfig)error

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

func (*Manager)Enable

func (pm *Manager) Enable(refOrIDstring, config *backend.PluginEnableConfig)error

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

func (*Manager)GC

func (pm *Manager) GC()

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

func (*Manager)Get

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

Get looks up the requested plugin in the store.

func (*Manager)HandleExitEvent

func (pm *Manager) HandleExitEvent(idstring)error

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

func (*Manager)Inspect

func (pm *Manager) Inspect(refOrIDstring) (*plugin.Plugin,error)

Inspect examines a plugin config

func (*Manager)List

func (pm *Manager) List(pluginFiltersfilters.Args) ([]plugin.Plugin,error)

List displays the list of plugins and associated metadata.

func (*Manager)Privileges

func (pm *Manager) Privileges(ctxcontext.Context, refreference.Named, metaHeaderhttp.Header, authConfig *registry.AuthConfig) (plugin.Privileges,error)

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

func (*Manager)Pull

func (pm *Manager) Pull(ctxcontext.Context, refreference.Named, namestring, metaHeaderhttp.Header, authConfig *registry.AuthConfig, privilegesplugin.Privileges, outStreamio.Writer, opts ...CreateOpt)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

func (pm *Manager) Push(ctxcontext.Context, namestring, metaHeaderhttp.Header, authConfig *registry.AuthConfig, outStreamio.Writer)error

Push pushes a plugin to the registry.

func (*Manager)Remove

func (pm *Manager) Remove(namestring, config *backend.PluginRmConfig)error

Remove deletes plugin's root directory.

func (*Manager)Set

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

Set sets plugin args

func (*Manager)Shutdown

func (pm *Manager) Shutdown()

Shutdown stops all plugins and called during daemon shutdown.

func (*Manager)SubscribeEvents

func (pm *Manager) SubscribeEvents(bufferint, watchEvents ...Event) (eventCh <-chanany, cancel func())

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

func (*Manager)Upgrade

func (pm *Manager) Upgrade(ctxcontext.Context, refreference.Named, namestring, metaHeaderhttp.Header, authConfig *registry.AuthConfig, privilegesplugin.Privileges, outStreamio.Writer)error

Upgrade upgrades a plugin

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

typeManagerConfig

type ManagerConfig struct {Store              *Store// removeRegistryServiceEndpointResolverLiveRestoreEnabledbool// TODO: removeLogPluginEvent     eventLoggerRootstringExecRootstringCreateExecutorExecutorCreatorAuthzMiddleware    *authorization.Middleware}

ManagerConfig defines configuration needed to start new manager.

typeSpecOpt

type SpecOpt func(*specs.Spec)

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

funcWithSpecMounts

func WithSpecMounts(mounts []specs.Mount)SpecOpt

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

typeStore

type Store struct {sync.RWMutex// contains filtered or unexported fields}

Store manages the plugin inventory in memory and on-disk

funcNewStore

func NewStore() *Store

NewStore creates a Store.

func (*Store)Add

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

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

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

func (*Store)Get

func (ps *Store) Get(name, capabilitystring, modeint) (plugingetter.CompatPlugin,error)

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

func (*Store)GetAll

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

GetAll retrieves all plugins.

func (*Store)GetAllByCap

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

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

func (*Store)GetAllManagedPluginsByCap

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

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

func (*Store)GetV2Plugin

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

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

func (*Store)Handle

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

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

func (*Store)RegisterRuntimeOpt

func (ps *Store) RegisterRuntimeOpt(capabilitystring, 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

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

Remove removes a plugin from memory and plugindb.

func (*Store)SetAll

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

SetAll initialized plugins during daemon restore.

func (*Store)SetState

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

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

Source Files

View all Source files

Directories

PathSynopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp