scheduler

package
v0.0.0-...-e07aaa2 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IDTimestampSeparator = "_"
)

Variables

View Source
var ErrRecordNotFound = errors.New("could not find an available function")

Functions

This section is empty.

Types

type LambdoService

type LambdoService struct {
	Host      string
	Port      int
	BucketURL string
}

func (*LambdoService) DeleteVM

func (service *LambdoService) DeleteVM(VMID string) (err error)

func (*LambdoService) SpawnVM

func (service *LambdoService) SpawnVM(function database.Function) (data LambdoSpawnResponse, err error)

type LambdoSpawnRequest

type LambdoSpawnRequest struct {
	// URL to the rootfs of the function
	Rootfs RootFSInfo `json:"rootfs"`
	// Ports that the virtual machine needs to be exposed
	// right now we only support one port
	RequestedPorts []uint16 `json:"requestedPorts"`
}

type LambdoSpawnResponse

type LambdoSpawnResponse struct {
	ID string `json:"id"`
	// Ports mapped by lambdo, leading to the requested ports
	// this a tuple under the form [host_port, vm_port]
	// for now we only support one port
	Ports [][2]uint16 `json:"port_mapping"`
}

type RootFSInfo

type RootFSInfo struct {
	ID       string `json:"id"`
	Location string `json:"location"`
}

type Scheduler

type Scheduler struct {
	Redis   *redis.Client
	Context *context.Context
	Lambdo  *LambdoService
}

func (*Scheduler) FindAndDestroyUnsused

func (s *Scheduler) FindAndDestroyUnsused(hoursTimeout float64)

goes through the whole redis instance and remove that have not been used within the last {hoursTimeout} Hours

func (*Scheduler) GetStateByID

func (s *Scheduler) GetStateByID(id string) (fnState database.FunctionState, err error)

Get all keys of a state by its ID

func (*Scheduler) LookForReadyInstance

func (s *Scheduler) LookForReadyInstance(functionId uuid.UUID, cursor uint64) (fnState database.FunctionState, returnedCursor uint64, err error)

Uses SCAN to look for the first instance marked as ready (https://redis.io/docs/latest/commands/scan/)

func (*Scheduler) SetStatus

func (s *Scheduler) SetStatus(id string, status database.FnStatusCode) error

func (*Scheduler) SpawnVM

func (s *Scheduler) SpawnVM(function database.Function) (fnState database.FunctionState, err error)

Jump to

Keyboard shortcuts

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