Documentation ¶
Index ¶
- type Cleanup
- type Config
- type GPUProvider
- type NetworkProvider
- type OverlayConfig
- type Provider
- type Repository
- func (r *Repository) ApplyHardwareInfo(hw *hardware.Hardware)
- func (r *Repository) Close() error
- func (r *Repository) GetCleanup(ctx context.Context, provider Provider) (Cleanup, error)
- func (r *Repository) GetNetworkCleaner(ctx context.Context, provider NetworkProvider) (Cleanup, error)
- func (r *Repository) GetVolumeCleaner(ctx context.Context, provider VolumeProvider) (Cleanup, error)
- func (r *Repository) HasGPU() bool
- func (r *Repository) JoinNetwork(ID string) (*structs.NetworkSpec, error)
- func (r *Repository) PostCreationTune(ctx context.Context, provider Provider, cleanup Cleanup, ID string) (Cleanup, error)
- func (r *Repository) Tune(ctx context.Context, provider Provider, hostCfg *container.HostConfig, ...) (Cleanup, error)
- func (r *Repository) TuneGPU(provider GPUProvider, cfg *container.HostConfig) error
- func (r *Repository) TuneNetworks(ctx context.Context, provider NetworkProvider, hostCfg *container.HostConfig, ...) (Cleanup, error)
- func (r *Repository) TuneStorageQuota(ctx context.Context, provider StorageQuotaProvider, ID string) (Cleanup, error)
- func (r *Repository) TuneVolumes(ctx context.Context, provider VolumeProvider, cfg *container.HostConfig) (Cleanup, error)
- type StorageQuotaProvider
- type VolumeProvider
- type VolumesConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cleanup ¶
type Cleanup interface { // Close performs cleanup handling for the resource acquired. Close() error }
Cleanup describes an interface for resource freeing.
The behavior of Close after the first call is undefined.
type Config ¶
type Config struct { SocketDir string `yaml:"socket_dir" default:"/run/docker/plugins"` Volumes VolumesConfig `yaml:"volume"` Overlay OverlayConfig `yaml:"overlay"` GPUs map[string]map[string]string }
type GPUProvider ¶
GPUProvider describes an interface for applying GPU settings to the container.
type NetworkProvider ¶
type NetworkProvider interface {
Networks() []*structs.NetworkSpec
}
type OverlayConfig ¶
type OverlayConfig struct { Drivers struct { Tinc *network.TincNetworkConfig `yaml:"tinc"` L2TP *network.L2TPConfig `yaml:"l2tp"` } }
type Provider ¶
type Provider interface { GPUProvider VolumeProvider NetworkProvider StorageQuotaProvider }
Provider unifies all possible providers for tuning.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository describes a place where all SONM plugins for Docker live.
func EmptyRepository ¶
func EmptyRepository() *Repository
EmptyRepository constructs an empty repository. Used primarily in tests.
func NewRepository ¶
func NewRepository(ctx context.Context, cfg Config) (*Repository, error)
NewRepository constructs a new repository for SONM plugins from the specified config.
Plugins will be attempted to run inside the given wait group immediately during the call of this function. Any error that can be recovered at the initialization stage will be returned. Other errors will interrupt the wait group, forcing making the entire plugin system to halt.
func (*Repository) ApplyHardwareInfo ¶
func (r *Repository) ApplyHardwareInfo(hw *hardware.Hardware)
ApplyHardwareInfo exposing info about hardware units controlled by various plugins.
func (*Repository) Close ¶
func (r *Repository) Close() error
func (*Repository) GetCleanup ¶ added in v0.4.6
func (*Repository) GetNetworkCleaner ¶ added in v0.4.6
func (r *Repository) GetNetworkCleaner(ctx context.Context, provider NetworkProvider) (Cleanup, error)
func (*Repository) GetVolumeCleaner ¶ added in v0.4.6
func (r *Repository) GetVolumeCleaner(ctx context.Context, provider VolumeProvider) (Cleanup, error)
func (*Repository) HasGPU ¶
func (r *Repository) HasGPU() bool
HasGPU returns true if the Repository has at least one GPU plugin loaded
func (*Repository) JoinNetwork ¶
func (r *Repository) JoinNetwork(ID string) (*structs.NetworkSpec, error)
func (*Repository) PostCreationTune ¶ added in v0.4.12
func (*Repository) Tune ¶
func (r *Repository) Tune(ctx context.Context, provider Provider, hostCfg *container.HostConfig, netCfg *network.NetworkingConfig) (Cleanup, error)
Tune creates all plugin bound required for the given provider with further host config tuning.
func (*Repository) TuneGPU ¶
func (r *Repository) TuneGPU(provider GPUProvider, cfg *container.HostConfig) error
TuneGPU creates GPU bound required for the given provider with further host config tuning.
func (*Repository) TuneNetworks ¶
func (r *Repository) TuneNetworks(ctx context.Context, provider NetworkProvider, hostCfg *container.HostConfig, netCfg *network.NetworkingConfig) (Cleanup, error)
func (*Repository) TuneStorageQuota ¶ added in v0.4.12
func (r *Repository) TuneStorageQuota(ctx context.Context, provider StorageQuotaProvider, ID string) (Cleanup, error)
func (*Repository) TuneVolumes ¶
func (r *Repository) TuneVolumes(ctx context.Context, provider VolumeProvider, cfg *container.HostConfig) (Cleanup, error)
TuneVolumes creates volumes required for the given provider with further host config tuning with mount settings.
type StorageQuotaProvider ¶ added in v0.4.12
type VolumeProvider ¶
type VolumeProvider interface { // ID returns a unique identifier that will be used as a new volume name. ID() string // Volumes returns volumes specified for configuring. Volumes() map[string]*sonm.Volume // Mounts returns all mounts whose source equals to the volume name // provided. Mounts(source string) []volume.Mount // DealID provides the deal ID for the volume is planned to be executed. DealID() string // Network provides an optional network name and ID indicating under which // network the volume plugin should be executed. Network() (string, string) }
VolumeProvider describes an interface for applying volumes to the container.