store

package
v0.0.0-...-c7aab3e Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrAmbiguous

type ErrAmbiguous string

ErrAmbiguous indicates that a plugin was not found locally.

func (ErrAmbiguous) Error

func (name ErrAmbiguous) Error() string

type ErrNotFound

type ErrNotFound string

ErrNotFound indicates that a plugin was not found locally.

func (ErrNotFound) Error

func (name ErrNotFound) Error() string

type Store

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

Store manages the plugin inventory in memory and on-disk

func NewStore

func NewStore(libRoot string) *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, capability string, mode int) (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 retreives all plugins.

func (*Store) GetAllByCap

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

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

func (*Store) GetByID

func (ps *Store) GetByID(id string) (*v2.Plugin, error)

GetByID retreives a plugin by ID.

func (*Store) GetByName

func (ps *Store) GetByName(name string) (*v2.Plugin, error)

GetByName retreives a plugin by name.

func (*Store) Handle

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) Remove

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

Remove removes a plugin from memory and plugindb.

func (*Store) Search

func (ps *Store) Search(partialID string) (*v2.Plugin, error)

Search retreives a plugin by ID Prefix If no plugin is found, then ErrNotFound is returned If multiple plugins are found, then ErrAmbiguous is returned

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, state bool)

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

func (*Store) Update

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

Update updates a plugin to memory and plugindb.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL