platform

package
v0.6.4-212-g9257c1c Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: BSD-3-Clause Imports: 18 Imported by: 1

Documentation

Overview

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

Index

Constants

View Source
const (
	SystemUnknown = SystemMode("unknown")
	SystemGuest   = SystemMode("guest")
	SystemHost    = SystemMode("host")
)
View Source
const (
	PlatformUnknown     = Platform("unknown")
	PlatformFirecracker = Platform("fc")
	PlatformQEMU        = Platform("qemu")
	PlatformKVM         = PlatformQEMU
	PlatformXen         = Platform("xen")
)

Variables

This section is empty.

Functions

func Detect

func Detect(ctx context.Context) (Platform, SystemMode, error)

Detect returns the hypervisor and system mode in the context to the determined hypervisor or an error if not detectable.

func DriverNames

func DriverNames() []string

DriverNames returns the list of registered platform driver implementation names.

func NewMachineV1alpha1ServiceIterator

func NewMachineV1alpha1ServiceIterator(ctx context.Context) (machinev1alpha1.MachineService, error)

NewMachineV1alpha1ServiceIterator returns a machinev1alpha1.MachineService-compatible implementation which iterates over each supported host platform and calls the representing method. This is useful in circumstances where the platform is not supplied. The first platform strategy to succeed is returned in all circumstances.

func PlatformAliases added in v0.6.4

func PlatformAliases() map[Platform][]string

PlatformAliases returns all the name alises for a given platform.

func PlatformsByName added in v0.6.4

func PlatformsByName() map[string]Platform

PlatformsByName returns the list of known platforms and their name alises.

func Strategies

func Strategies() map[Platform]*Strategy

Strategies returns the list of registered platform implementations.

Types

type NewStrategyConstructor

type NewStrategyConstructor[T any] func(context.Context, ...any) (T, error)

NewStrategyConstructor is a prototype for the instantiation function of a platform driver implementation.

type Platform

type Platform string

func PlatformByName added in v0.6.5

func PlatformByName(name string) Platform

PlatformByName returns the platform for a given name. If the name is not known, it returns it unchanged.

func Platforms

func Platforms() []Platform

Platforms returns all the unique platforms.

func (Platform) String

func (ht Platform) String() string

String implements fmt.Stringer

type Strategy

type Strategy struct {
	Name               string
	Platform           Platform
	NewMachineV1alpha1 NewStrategyConstructor[machinev1alpha1.MachineService]
}

Strategy represents canonical reference of a machine driver and their platform.

type SystemMode

type SystemMode string

Jump to

Keyboard shortcuts

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