types

package
v0.0.0-...-10b4495 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Types package includes all the structures shared between the caravela's server/daemon and its clients.

Index

Constants

View Source
const (
	SpreadGroupPolicyStr     = "spread"
	CoLocationGroupPolicyStr = "co-location"
)
View Source
const (
	LowCPUClassStr  = "low"
	HighCPUClassStr = "high"
)

Variables

View Source
var (
	RequestIDKey       = requestCtxKey("ID")
	NodeGUIDKey        = requestCtxKey("GUID")
	PartitionsStateKey = requestCtxKey("PartitionsState")
)

Functions

func NodeGUID

func NodeGUID(ctx context.Context) string

NodeGUID retrieves the node's GUID key from a context.

func RequestID

func RequestID(ctx context.Context) string

RequestID retrieves the request ID key from a context.

Types

type AvailableOffer

type AvailableOffer struct {
	Offer      `json:"O"`
	SupplierIP string `json:"SIp"`
	Weight     int    `json:"-"` // Used locally only by the scheduler.
}

type CPUClass

type CPUClass uint
const (
	LowCPUPClass CPUClass = iota
	HighCPUClass
)

func (CPUClass) String

func (cp CPUClass) String() string

func (*CPUClass) ValueOf

func (cp *CPUClass) ValueOf(arg string) error

type ContainerConfig

type ContainerConfig struct {
	Name         string        `json:"N"`
	ImageKey     string        `json:"IK"`
	Args         []string      `json:"A"`
	PortMappings []PortMapping `json:"PM"`
	Resources    Resources     `json:"FR"`
	GroupPolicy  GroupPolicy   `json:"GP"`
}

type ContainerStatus

type ContainerStatus struct {
	ContainerConfig `json:"CC"`
	SupplierIP      string `json:"SIp"`
	ContainerID     string `json:"CId"`
	Status          string `json:"S"`
}

type GroupPolicy

type GroupPolicy uint
const (
	SpreadGroupPolicy GroupPolicy = iota
	CoLocationGroupPolicy
)

func (GroupPolicy) String

func (gp GroupPolicy) String() string

func (*GroupPolicy) ValueOf

func (gp *GroupPolicy) ValueOf(arg string) error

type Node

type Node struct {
	IP   string `json:"IP"`
	GUID string `json:"GUID"`
}

type Offer

type Offer struct {
	ID                int64     `json:"ID"`
	Amount            int       `json:"A"`
	FreeResources     Resources `json:"FR"`
	UsedResources     Resources `json:"UR"`
	ContainersRunning int       `json:"CR"`
}

type PartitionState

type PartitionState struct {
	PartitionResources Resources `json:"PR"`
	Hits               int       `json:"H"`
}

func SysPartitionsState

func SysPartitionsState(ctx context.Context) []PartitionState

SysPartitionsState retrieves the partitions state from a context.

type PortMapping

type PortMapping struct {
	HostPort      int    `json:"HP"`
	ContainerPort int    `json:"CP"`
	Protocol      string `json:"P"`
}

type Resources

type Resources struct {
	CPUClass CPUClass `json:"CC"`
	CPUs     int      `json:"CPUs"`
	Memory   int      `json:"RAM"`
}

Jump to

Keyboard shortcuts

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