Documentation
¶
Index ¶
- Constants
- Variables
- func RecoverFromPanic(plugin string)
- type Binary
- type Feature
- type LocalManager
- func (m *LocalManager) Get(name string) *Plugin
- func (m *LocalManager) Getf(format string, a ...any) *Plugin
- func (m *LocalManager) Install(names []string) (chan int, chan string, chan error)
- func (m *LocalManager) IsInstalled(name string) bool
- func (m *LocalManager) List(latest bool, filter ...string) (list []Plugin, err error)
- func (m *LocalManager) Remove(names []string) (chan int, chan string, chan error)
- type Manager
- type ManagerUnimplemented
- func (m *ManagerUnimplemented) Get(_ string) *Plugin
- func (m *ManagerUnimplemented) Getf(format string, a ...any) *Plugin
- func (m *ManagerUnimplemented) Install(_ []string) (chan int, chan string, chan error)
- func (m *ManagerUnimplemented) IsInstalled(_ string) bool
- func (m *ManagerUnimplemented) List(_ ...Status) ([]Plugin, error)
- func (m *ManagerUnimplemented) Remove(_ []string) (chan int, chan string, chan error)
- type Plugin
- type PropagatorManager
- type Status
- type Type
Constants ¶
const ( BINARY_PERMS = 0o755 LIBRARY_PERMS = 0o644 DOWNLOAD_DIR_PERMS = 0o755 )
Variables ¶
var LibDir, BinDir string
var Load = sync.OnceValue(loadPlugins)
var Registry = []Plugin{ { Name: "criu", Type: EXTERNAL, Binaries: []Binary{{Name: "criu"}}, }, { Name: "cloud-hypervisor", Type: SUPPORTED, Libraries: []Binary{{Name: "libcedana-cloud-hypervisor.so"}}, }, { Name: "criu/cuda", Type: EXTERNAL, Binaries: []Binary{{Name: "cuda-checkpoint", InstallDir: "/usr/local/bin"}}, Libraries: []Binary{{Name: "cuda_plugin.so", InstallDir: "/usr/lib/criu"}}, }, { Name: "runc", Type: SUPPORTED, Libraries: []Binary{{Name: "libcedana-runc.so"}}, }, { Name: "containerd", Type: SUPPORTED, Libraries: []Binary{{Name: "libcedana-containerd.so"}}, }, { Name: "crio", Type: SUPPORTED, Libraries: []Binary{{Name: "libcedana-crio.so"}}, }, { Name: "kata", Type: SUPPORTED, Libraries: []Binary{{Name: "libcedana-kata.so"}}, }, { Name: "storage/cedana", Type: SUPPORTED, Libraries: []Binary{{Name: "libcedana-storage-cedana.so"}}, }, { Name: "storage/s3", Type: SUPPORTED, Libraries: []Binary{{Name: "libcedana-storage-s3.so"}}, }, { Name: "storage/gcs", Type: SUPPORTED, Libraries: []Binary{{Name: "libcedana-storage-gcs.so"}}, }, { Name: "gpu", Type: EXTERNAL, Libraries: []Binary{{Name: "libcedana-gpu.so"}}, Binaries: []Binary{{Name: "cedana-gpu-controller"}}, }, { Name: "gpu/tracer", Type: EXTERNAL, Libraries: []Binary{{Name: "libcedana-gpu-tracer.so"}}, }, { Name: "streamer", Type: EXTERNAL, Binaries: []Binary{{Name: "cedana-image-streamer"}}, }, { Name: "k8s", Type: SUPPORTED, Libraries: []Binary{{Name: "libcedana-k8s.so"}}, Binaries: []Binary{}, }, { Name: "containerd/runtime-runc", Type: EXTERNAL, Libraries: []Binary{}, Binaries: []Binary{{Name: "cedana-shim-runc-v2"}}, }, { Name: "slurm", Type: SUPPORTED, Libraries: []Binary{{Name: "libcedana-slurm.so"}}, Binaries: []Binary{{Name: "libslurm-cedana.so", InstallDir: "/usr/lib64/slurm"}}, }, }
Local registry of plugins that are supported by Cedana XXX: This list is needed locally so when all plugins are loaded, we only want to attempt to load the ones that are 'Supported'. GPU plugin, for example, is not 'External' and thus cannot be loaded by Go, so we shouldn't try, as it's undefined behavior.
Functions ¶
func RecoverFromPanic ¶
func RecoverFromPanic(plugin string)
RecoverFromPanic is a helper function to recover from panics in plugins and log the error. It should only be used with defer.
Types ¶
type Feature ¶
Feature is a typed symbol that a plugin can export with a description of what it does/used for.
func (Feature[T]) IfAvailable ¶
func (feature Feature[T]) IfAvailable( do func(pluginName string, sym T) error, filter ...string, ) error
IfAvailable checks if a feature is available in any of the plugins, and if it is, it calls the provided function with the plugin name and the feature. Always goes through all plugins, even if one of them fails. Later, the errors are returned together, if any. If no filter is provided, all plugins are checked.
func (Feature[T]) IsAvailable ¶
IsAvailable checks if a feature is available in any of the plugins. If no filter is provided, all plugins are checked. Also returns an error if the symbol is present but incompatible.
type LocalManager ¶
type LocalManager struct {
// contains filtered or unexported fields
}
func NewLocalManager ¶
func NewLocalManager() *LocalManager
func (*LocalManager) Get ¶
func (m *LocalManager) Get(name string) *Plugin
func (*LocalManager) Getf ¶ added in v0.9.268
func (m *LocalManager) Getf(format string, a ...any) *Plugin
func (*LocalManager) Install ¶
func (m *LocalManager) Install(names []string) (chan int, chan string, chan error)
func (*LocalManager) IsInstalled ¶
func (m *LocalManager) IsInstalled(name string) bool
type Manager ¶
type Manager interface {
// List all plugins
List(latest bool, filter ...string) ([]Plugin, error)
// Install a list of plugins
Install(names []string) (installed chan int, msgs chan string, errs chan error)
// Remove a list of plugins
Remove(names []string) (removed chan int, msgs chan string, errs chan error)
// Get a plugin by name
Get(name string) *Plugin
// Get by formatted name
Getf(format string, a ...any) *Plugin
// Check if a plugin is installed
IsInstalled(name string) bool
}
type ManagerUnimplemented ¶
type ManagerUnimplemented struct{}
func (*ManagerUnimplemented) Get ¶
func (m *ManagerUnimplemented) Get(_ string) *Plugin
func (*ManagerUnimplemented) Getf ¶ added in v0.9.268
func (m *ManagerUnimplemented) Getf(format string, a ...any) *Plugin
func (*ManagerUnimplemented) Install ¶
func (m *ManagerUnimplemented) Install(_ []string) (chan int, chan string, chan error)
func (*ManagerUnimplemented) IsInstalled ¶
func (m *ManagerUnimplemented) IsInstalled(_ string) bool
type Plugin ¶
type Plugin struct {
Name string `json:"name"`
Type Type `json:"type"`
Status Status `json:"status"`
Version string `json:"version"`
AvailableVersion string `json:"latest_version"`
Libraries []Binary `json:"libraries"`
Binaries []Binary `json:"binaries"`
Size int64 `json:"size"` // in bytes
PublishedAt time.Time `json:"published_at"`
}
Represents plugin information
func (*Plugin) BinaryPaths ¶
BinaryPaths returns the full paths of the plugin binaries
func (*Plugin) IsInstalled ¶
func (*Plugin) LibraryPaths ¶
LibraryPaths returns the full paths of the plugin libraries
func (*Plugin) SyncInstalled ¶
func (p *Plugin) SyncInstalled()
Syncs plugin information with local info, whether it is installed or not. Also fetches the local installed version.
func (*Plugin) SyncVersion ¶
func (p *Plugin) SyncVersion()
SyncVersion fetches the version of the locally installed plugin
type PropagatorManager ¶
type PropagatorManager struct {
config.Connection
*LocalManager
// contains filtered or unexported fields
}
func NewPropagatorManager ¶
func NewPropagatorManager(connection config.Connection, compatibility string) *PropagatorManager