agentstate

package
v0.0.0-...-6371fb4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2016 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package agentstate helps us keep a mental map of all the workload that is running across different Agents. It helps us remember what Instance is running in which node so that we can perform the load distribution or workload affinitiy more easily

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Inst

type Inst map[string]int

type NElement

type NElement struct {
	NodeName string
	Count    int
}

type State

type State struct {
	Agents map[string]Inst
	Count  int
	IsSet  bool
	// contains filtered or unexported fields
}

State struct is responsible for maintaining Map of Agents, this should also have methods to let the Package Implementer know that if a particular instace can be provisioned here or not

func NewState

func NewState() *State

NewState basic constructor for the struct

func (*State) Add

func (S *State) Add(Node string, Name string, Count int) bool

Add adds an Instance to a particular node, if the entry is unavailable it tries to create it first

func (*State) Canfit

func (S *State) Canfit(Node string, Name string, DistributionValue int) bool

Canfit This will tell us if a Particualr Instnace with supplied distribution value can fit in that node or not

func (*State) Del

func (S *State) Del(Node string, Name string) bool

Del This removes an entry from the Map it returns false which means that such an entry itself is not available in the map

func (*State) InstancesRunning

func (S *State) InstancesRunning(Node string, Name string) int

InstancesRunning This will return how many workload for this instance running on this particular slave, if it returns -1 it means there is no such slave

func (*State) ListDistribution

func (S *State) ListDistribution(Name string) []NElement

ListDistribution will Retrun an array of Nodes with structure

Jump to

Keyboard shortcuts

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