extensions

package
v0.0.0-...-67f9e1d Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Extensions

type Extensions []string

Extensions represents a registry of extensions.

`internal` extensions are related to MicroCluster capabilities, not capabilities of MicroCluster-backed services.

To distinguish between `internal` and `external` extensions, `internal` extensions are prefixed with a `internal:` value. e.g, `internal:runtime_extension_v1`, `internal:runtime_extension_v2`, ...

External extensions are related to capabilities of MicroCluster-backed services. e.g, `microovn_custom_encapsulation_ip`.

func NewExtensionRegistry

func NewExtensionRegistry(populateInternal bool) (Extensions, error)

NewExtensionRegistry creates a new instance of the Extensions struct, which represents a registry of extensions. We have the option to populate the internal extensions or not. Having s option becomes handy when we want to create a custom registry of extensions (see `NewExtensionRegistryFromList`).

func NewExtensionRegistryFromList

func NewExtensionRegistryFromList(extensions []string) (Extensions, error)

NewExtensionRegistryFromList creates a new instance of the Extensions struct, from a list of extensions. The passed extensions could be internal or external or just invalid. The function is typically used to create a registry from an API response in order to compare the source and the target systems' extensions for compatibility. The returned registry is always sorted with internal extensions first.

func (Extensions) HasExtension

func (e Extensions) HasExtension(ext string) bool

HasExtension reports whether the extension set supports the given extension.

func (Extensions) IsSameVersion

func (e Extensions) IsSameVersion(t Extensions) error

IsSameVersion checks if the source registry supports the target registry.

func (Extensions) MarshalJSON

func (e Extensions) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for the Extensions type.

func (Extensions) MarshalYAML

func (e Extensions) MarshalYAML() (any, error)

MarshalYAML implements yaml.Marshaler for the Extensions type.

func (*Extensions) Register

func (e *Extensions) Register(newExtensions []string) error

Register registers new external extensions to the Extensions struct.

func (*Extensions) Scan

func (e *Extensions) Scan(value any) error

Scan implements the sql.Scanner interface to deserialize the Extensions struct from database storage.

func (*Extensions) UnmarshalJSON

func (e *Extensions) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Extensions) UnmarshalYAML

func (e *Extensions) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

func (Extensions) Value

func (e Extensions) Value() (driver.Value, error)

Value implements the driver.Valuer interface to serialize the Extensions struct for database storage.

func (Extensions) Version

func (e Extensions) Version() int

Version returns the number of extensions in the set, representing its version number.

Jump to

Keyboard shortcuts

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