driver

package
v0.0.0-...-dea5896 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 4 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",

		GroupVhost:       "envoy",
		GroupCertificate: "tls",
		GroupRoute:       "envoy",
		GroupExpose:      "envoy",
	}
)

Functions

func Exists

func Exists(id ID) bool

func Get

func Get(id ID) any

func GetStrict

func GetStrict(id ID) any

func GroupNames

func GroupNames() []string

GroupNames returns all supported drivergroup names

func NamesByGroup

func NamesByGroup() map[Group][]string

func Register

func Register(id ID, allocator any)

Types

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

func (t ID) IsEmpty() 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]any

func NewRegistry

func NewRegistry() Registry

func (Registry) WithGroup

func (t Registry) WithGroup(group Group) Registry

Jump to

Keyboard shortcuts

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