entity

package
v0.0.0-...-e2f5efa Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: BSD-3-Clause Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	IPv4Len     uint   = 32
	ReservedIPs uint32 = 2 //5
)

Variables

View Source
var (
	ErrNoMoreGlobalNetworks = errors.New("no more global networks")
	ErrNoMoreLocalNetworks  = errors.New("no more local networks")
)
View Source
var (
	ErrSizeLimitExceeded = errors.New("size limit exceeded")
	ErrSegmentTooLarge   = errors.New("segment size too large")
	ErrSegmentNotFound   = errors.New("segment not found")
)

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	BucketResources //The real size it occupies
	// contains filtered or unexported fields
}

func NewBucket

func NewBucket(conf *config.Bucket, settings schema.Settings, log logrus.Ext1FieldLogger) *Bucket

func (Bucket) CalculateInstanceExtras

func (b Bucket) CalculateInstanceExtras() (disks []biome.SourceDisk, cmds [][]string)

func (Bucket) Clone

func (b Bucket) Clone() (out Bucket)

func (Bucket) FindByName

func (b Bucket) FindByName(name string) int

func (Bucket) GetSegments

func (b Bucket) GetSegments() []Segment

func (Bucket) ListContentName

func (b Bucket) ListContentName() []string

type BucketResources

type BucketResources struct {
	Resource
	DataSources map[string]*DataSource //destination
}

func (BucketResources) AddSources

func (res BucketResources) AddSources(sources []DataSource) BucketResources

type CPUPool

type CPUPool struct {
	// contains filtered or unexported fields
}

func NewCPUPool

func NewCPUPool(size int) *CPUPool

func (*CPUPool) ReleaseCores

func (cp *CPUPool) ReleaseCores(cores []int)

func (*CPUPool) RequestCores

func (cp *CPUPool) RequestCores(cores int) ([]int, bool)

func (*CPUPool) Resize

func (cp *CPUPool) Resize(size int) bool

func (*CPUPool) UsedCores

func (cp *CPUPool) UsedCores() []int

type DataSource

type DataSource struct {
	Name         string         `json:"name,omitempty"`
	Source       string         `json:"source,omitempty"`
	Destinations []string       `json:"destinations"`
	Type         DataSourceType `json:"type,omitempty"`
}

func (DataSource) Clone

func (ds DataSource) Clone() (out DataSource)

type DataSourceType

type DataSourceType string
const (
	GCSSource       DataSourceType = "gcs"
	CloudDiskSource DataSourceType = "cloud-disk"
)

type ImageStore

type ImageStore struct {
	// contains filtered or unexported fields
}

func (*ImageStore) ForEach

func (is *ImageStore) ForEach(fn func(instance, image string, meta map[string]string) error) error

func (*ImageStore) Insert

func (is *ImageStore) Insert(instance, image string, meta map[string]string)

type Network

type Network interface {
	Subnet() string
	Gateway() string
	Next() *neta.IPv4
	GetIPs() []string
}

func NewNetwork

func NewNetwork(net *neta.IPv4Net) Network

type NetworkState

type NetworkState interface {
	GetNextGlobal() (Network, error)
	GetNextLocal(instance int) (Network, error)
}

func NewNetworkState

func NewNetworkState(globalCIDR string, localCIDR string, maxNodes int) (NetworkState, error)

type PhaseDist

type PhaseDist []Bucket

func (PhaseDist) FindBucket

func (pd PhaseDist) FindBucket(name string) int

func (PhaseDist) FindSegment

func (pd PhaseDist) FindSegment(name string) (int, *Segment)

func (PhaseDist) ShowSimpleDist

func (pd PhaseDist) ShowSimpleDist() [][]string

type Resource

type Resource struct {
	CPUs        int64
	Memory      int64 // Memory MB
	Storage     int64 // Storage MB
	TCPPorts    map[int]bool
	UDPPorts    map[int]bool
	DataSources []DataSource
}

func (Resource) Add

func (res Resource) Add(r Resource) (out Resource)

func (Resource) GetPorts

func (res Resource) GetPorts() (tcp []int, udp []int)

func (Resource) GetTCPPorts

func (res Resource) GetTCPPorts() (tcp []int)

func (Resource) GetUDPPorts

func (res Resource) GetUDPPorts() (udp []int)

func (Resource) HasTCPPort

func (res Resource) HasTCPPort(port int) bool

func (Resource) HasUDPPort

func (res Resource) HasUDPPort(port int) bool

func (*Resource) InsertTCPPorts

func (res *Resource) InsertTCPPorts(ports ...int)

func (*Resource) InsertUDPPorts

func (res *Resource) InsertUDPPorts(ports ...int)

func (Resource) NoTCPPortConflicts

func (res Resource) NoTCPPortConflicts(ports ...int) bool

func (Resource) NoUDPPortConflicts

func (res Resource) NoUDPPortConflicts(ports ...int) bool

func (*Resource) RemoveTCPPort

func (res *Resource) RemoveTCPPort(port int)

func (*Resource) RemoveTCPPorts

func (res *Resource) RemoveTCPPorts(ports ...int)

func (*Resource) RemoveUDPPort

func (res *Resource) RemoveUDPPort(port int)

func (*Resource) RemoveUDPPorts

func (res *Resource) RemoveUDPPorts(ports ...int)

func (*Resource) UpdateResources

func (res *Resource) UpdateResources(newRes Resource)

type ResourceBuckets

type ResourceBuckets interface {
	Add(segments []Segment) error
	Remove(segments []Segment) error
	Resources() []Bucket
}

func NewResourceBuckets

func NewResourceBuckets(conf config.Bucket, settings schema.Settings, log logrus.Ext1FieldLogger) ResourceBuckets

type ResourceDist

type ResourceDist []PhaseDist

func (*ResourceDist) Add

func (rd *ResourceDist) Add(buckets []Bucket)

func (ResourceDist) GetPhase

func (rd ResourceDist) GetPhase(index int) (PhaseDist, error)

func (ResourceDist) ResourceUsage

func (rd ResourceDist) ResourceUsage() Resource

func (ResourceDist) Size

func (rd ResourceDist) Size() int

func (ResourceDist) ToBiomeCommand

func (rd ResourceDist) ToBiomeCommand(provider biome.CloudProvider, labels map[string]string,
	defID string, orgID string, testID string, domain string) biome.CreateBiome

type Segment

type Segment struct {
	Name string
	Resource
	CPUBindings []int
}

type Service

type Service struct {
	Name            string
	Index           int
	Bucket          int64
	SquashedService schema.Service
	Networks        []schema.Network
	Sidecars        []schema.Sidecar
	Labels          map[string]string
	TCPPorts        map[int]int
	UDPPorts        map[int]int

	Timeout        command.Timeout
	IsTask         bool
	IgnoreExitCode bool
	HostMounts     map[string]string
}

func GetDefaultService

func GetDefaultService(def defaults.Defaults) Service

func (Service) CalculateDiff

func (serv Service) CalculateDiff(serv2 Service) ServiceDiff

func (Service) Equal

func (serv Service) Equal(serv2 Service) bool

type ServiceDiff

type ServiceDiff struct {
	Name           string
	AddNetworks    []schema.Network
	UpdateNetworks []schema.Network
	DetachNetworks []schema.Network
	AddSidecars    []schema.Sidecar
	RemoveSidecars []schema.Sidecar

	Parent *Service
}

type State

type State struct {
	Tasks       []Service
	SystemState map[string]schema.SystemComponent
	Subnets     map[string]Network
	Network     NetworkState
	IPs         map[string]string
}

func NewState

func NewState(net NetworkState) *State

type StatePack

type StatePack struct {
	State
	Buckets   ResourceBuckets
	PrevTasks []Segment
	Spec      schema.RootSchema
}

func NewStatePack

func NewStatePack(spec schema.RootSchema, conf config.Bucket, settings schema.Settings, logger logrus.Ext1FieldLogger) *StatePack

type SystemDiff

type SystemDiff struct {
	Modified        []ServiceDiff
	AddedNetworks   []schema.Network
	RemovedNetworks []schema.Network
	Added           []Service
	Removed         []Service
}

func (*SystemDiff) Append

func (diff *SystemDiff) Append(sys *SystemDiff)

type TestCommands

type TestCommands [][]command.Command

func (TestCommands) Append

func (cmds TestCommands) Append(commands [][]command.Command) TestCommands

func (TestCommands) MetaInject

func (cmds TestCommands) MetaInject(kv ...string)

Jump to

Keyboard shortcuts

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