Documentation
¶
Index ¶
Constants ¶
const ( // VersionMajor is for an API incompatible changes VersionMajor = 0 // VersionMinor is for functionality in a backwards-compatible manner VersionMinor = 1 // VersionPatch is for backwards-compatible bug fixes VersionPatch = 1 // VersionDraft indicates development branch. Releases will be empty string. VersionDraft = "-draft" )
Variables ¶
var ( // cluster == containment == nodes DefaultDominantSubsystem = "cluster" ContainsRelation = "contains" )
var Version = fmt.Sprintf("%d.%d.%d%s", VersionMajor, VersionMinor, VersionPatch, VersionDraft)
Version is the specification version that the package types support.
Functions ¶
This section is empty.
Types ¶
type ClusterState ¶
type ClusterState map[string]interface{}
A Cluster state is a key value interface. The algorithms are required to know what they are looking for
type Edge ¶
type Edge struct {
Weight int `json:"weight"`
Vertex *Vertex `json:"vertex"`
Relation string `json:"relation"`
Subsystem string `json:"subsystem"`
}
An edge in the graph has a source vertex (where it's defined from) and a destination (the Vertex field below)
type MatchAlgorithmNeeds ¶
- a slot, in which case we use the Found/Needed fields, and lookups buy many types.
- A single resource type, in which case we define Type and ignore Found/Needed
subsystem -> attribute -> isSatisfied
type Resource ¶
type Resource struct {
Size int32
Type string
Unit string
// The request coming in can know about the type
Metadata metadata.Metadata
}
A Resource is a collection of attributes we load from a node intending to put into the graph, and associated functions
func NewResource ¶
Generate a new resource from a JGF node A resource is associated with a dominant subsystem resource
func NewSubsystemResource ¶
New SubsystemResource creates a resource, but also adds arbitrary metadata
type ResourceNeeds ¶
type ResourceNeeds struct {
SubsystemSatisfied bool
ResourceSatisfied bool
// Lookup by vertex type
// type -> subsystem -> attribute -> isSatisfied
Subsystems map[string]MatchAlgorithmNeeds
Resources map[string]int32
// Needed vs found
Found int32
Needed int32
// Only needed of the ResourceNeeds is for a single type of resource
Type string
// Caches to use for reset
SubsystemsOriginal map[string]MatchAlgorithmNeeds
ResourcesOriginal map[string]int32
}
Serialize slot resource needs into a struct that is easier to parse
func (*ResourceNeeds) AllSatisfied ¶
func (s *ResourceNeeds) AllSatisfied() bool
func (*ResourceNeeds) AreResourcesSatisfied ¶
func (s *ResourceNeeds) AreResourcesSatisfied() bool
func (*ResourceNeeds) AreSubsystemsSatisfied ¶
func (s *ResourceNeeds) AreSubsystemsSatisfied() bool
func (*ResourceNeeds) Reset ¶
func (s *ResourceNeeds) Reset()
func (*ResourceNeeds) Satisfied ¶
func (s *ResourceNeeds) Satisfied() bool
func (*ResourceNeeds) SummarizeRemaining ¶
func (s *ResourceNeeds) SummarizeRemaining() string
type Vertex ¶
type Vertex struct {
Identifier int `json:"identifier"`
Edges map[int]*Edge `json:"edges"`
Size int32 `json:"size"`
Unit string `json:"unit"`
Type string `json:"type"`
// Link to another subsystem vertex
Subsystems map[string]map[int]*Edge `json:"subsystems"`
// Less commonly accessed (and standardized) metadaa
Metadata metadata.Metadata
}
A vertex is defined by an identifier. We use an int instead of a string because it's faster. Edges are other vertices (and their identifiers) it's connected to.