provider

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package implements interface for each ApplicationResource provider

Index

Constants

View Source
const (
	StatusNone      = "NONE"
	StatusAllocated = "ALLOCATED"
)

Status of the driver returned by Status()

Variables

View Source
var FactoryList []DriverFactory

FactoryList is a list of available drivers factories

Functions

This section is empty.

Types

type Driver

type Driver interface {
	// Name of the driver
	Name() string

	// SetName of the gate
	SetName(name string)

	// If the driver uses local node resources or a cloud or remote resources
	// it is used to calculate the slots available for the local drivers
	IsRemote() bool

	// Give driver configs and check if it's ok
	// -> config - driver configuration in json format
	Prepare(config []byte) error

	// Make sure the allocate definition is appropriate for the driver
	// -> def - describes the driver options to allocate the required resource
	ValidateDefinition(def typesv2.LabelDefinition) error

	// Check if the described definition can be running on the current node
	// -> node_usage - how much of node resources was used by all the drivers. Usually should not be used by the cloud drivers
	// -> req - definition describes requirements for the resource
	// <- capacity - the number of such definitions the driver could run, if -1 - error happened
	AvailableCapacity(nodeUsage typesv2.Resources, req typesv2.LabelDefinition) (capacity int64)

	// Allocate the resource by definition and returns hw address
	// -> def - describes the driver options to allocate the required resource
	// -> metadata - user metadata to use during resource allocation
	// <- res - initial resource information to store driver instance state
	Allocate(def typesv2.LabelDefinition, metadata map[string]any) (res *typesv2.ApplicationResource, err error)

	// Get the status of the resource with given hw address
	// -> res - resource information with stored driver instance state
	// <- status - current status of the resource
	Status(res typesv2.ApplicationResource) (status string, err error)

	// Get task struct with implementation to execute it later
	// -> task - identifier of the task operation
	// -> options - additional config options for the task
	GetTask(task, options string) DriverTask

	// Deallocate resource with provided hw addr
	// -> res - resource information with stored driver instance state
	Deallocate(res typesv2.ApplicationResource) error
}

Driver interface of the functions that connects Fish to each driver

type DriverFactory

type DriverFactory interface {
	// Name of the driver
	Name() string

	// Generates new provider driver
	New() Driver
}

DriverFactory allows to generate new instances of the drivers

type DriverTask

type DriverTask interface {
	// Name of the task
	Name() string

	// Copy the existing task structure
	// Will return new not related to the original task structure
	Clone() DriverTask

	// Fish provides the task information about the operated items
	SetInfo(task *typesv2.ApplicationTask, def *typesv2.LabelDefinition, res *typesv2.ApplicationResource)

	// Run the task operation
	// <- result - json data with results of operation
	Execute() (result []byte, err error)
}

DriverTask is interface for driver tasks execution

Directories

Path Synopsis
Package aws implements driver
Package aws implements driver
Package docker implements driver
Package docker implements driver
Package native implements driver
Package native implements driver
Package test implements mock driver
Package test implements mock driver
Package vmx implements driver
Package vmx implements driver

Jump to

Keyboard shortcuts

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