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) HasGPU() bool
- func (r *Repository) JoinNetwork(ID string) (structs.Network, 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) TuneVolumes(ctx context.Context, provider VolumeProvider, cfg *container.HostConfig) (Cleanup, error)
- 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 OverlayConfig ¶
type OverlayConfig struct { Drivers struct { Tinc *network.TincNetworkConfig `yaml:"tinc"` L2TP *network.L2TPConfig `yaml:"l2tp"` } }
type Provider ¶
type Provider interface { GPUProvider VolumeProvider NetworkProvider }
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) 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.Network, error)
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) 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 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 }
VolumeProvider describes an interface for applying volumes to the container.