driver

package
v3.0.0-beta10 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package driver is the package serving the driver registry. A driver is identified by group and name, via the ID type.

Index

Constants

This section is empty.

Variables

View Source
var (
	All = NewRegistry()
)
View Source
var (
	DefaultDriver = map[Group]string{
		GroupApp:       "forking",
		GroupContainer: "oci",
		GroupIP:        "host",
		GroupTask:      "host",
		GroupVolume:    "",
		GroupSync:      "rsync",
	}
)

Functions

func Exists

func Exists(id ID) bool

func GroupNames

func GroupNames() []string

GroupNames returns all supported drivergroup names

func LoadBundle

func LoadBundle(pluginPath string) error

func NamesByGroup

func NamesByGroup() map[Group][]string

func Register

func Register(id ID, allocator any)

func RegisterFromPlugin

func RegisterFromPlugin(id ID, allocator any, plugin string)

Types

type Driver

type Driver struct {
	Allocator any
	Plugin    string
}

func Get

func Get(id ID) (Driver, bool)

func GetStrict

func GetStrict(id ID) (Driver, bool)

type Dumper

type Dumper interface {
	Dump() map[ID]any
}

type Group

type Group int

Group groups drivers sharing some properties. A resourceset is a collection of resources having the same drivergroup and subset.

const (
	GroupUnknown Group = 1 << iota
	GroupIP
	GroupVolume
	GroupDisk
	GroupFS
	GroupShare
	GroupContainer
	GroupApp
	GroupSync
	GroupTask
	GroupCertificate
	GroupExpose
	GroupRoute
	GroupVhost
	GroupPool
	GroupNetwork
	GroupHeartbeat
	GroupArray
	GroupSwitch
	GroupStonith
	GroupBackup
)

func NewGroup

func NewGroup(s string) Group

NewGroup allocates a Group from its string representation.

func (Group) IsValid

func (t Group) IsValid() bool

IsValid returns true if not GroupUnknown

func (Group) MarshalText

func (t Group) MarshalText() ([]byte, error)

MarshalText marshals the enum as a quoted json string

func (Group) String

func (t Group) String() string

String implements the Stringer interface

func (*Group) UnmarshalText

func (t *Group) UnmarshalText(b []byte) error

UnmarshalText unmashals a quoted json string to the enum value

type ID

type ID struct {
	Group Group  `json:"group"`
	Name  string `json:"name"`
}

ID is the driver main struct. It identifies a driver by Group and name.

func NewID

func NewID(group Group, name string) ID

func Parse

func Parse(s string) ID

func (ID) Cap

func (t ID) Cap() string

func (ID) IsZero

func (t ID) IsZero() bool

func (ID) NewGenericID

func (t ID) NewGenericID() ID

func (ID) String

func (t ID) String() string

func (ID) Unstructured

func (t ID) Unstructured() map[string]any

type IDs

type IDs []ID

func List

func List() IDs

func (IDs) Len

func (t IDs) Len() int

func (IDs) Less

func (t IDs) Less(i, j int) bool

func (IDs) Render

func (t IDs) Render() string

Render is a human rendered representation of the driver list

func (IDs) Swap

func (t IDs) Swap(i, j int)

type Registry

type Registry map[ID]Driver

func NewRegistry

func NewRegistry() Registry

func (Registry) WithGroup

func (t Registry) WithGroup(group Group) Registry

func (Registry) WithID

func (t Registry) WithID(group Group, section string) Registry

Jump to

Keyboard shortcuts

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