domain

package
v0.0.0-...-31facf1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CompResEq = iota
	CompResNeq
	CompResGt
	CompResLt
)

Variables

View Source
var (
	ErrNodeClaimed = errors.New("node has been already claimed and is not in the node pool anymore")
	ErrServerSide  = errors.New("an unexpected server-side error occurred")
	ErrForbidden   = errors.New("you are not authorized to perform this operation")
	ErrNotFound    = func(entity string) error {
		return fmt.Errorf("%s not found", entity)
	}
	ErrFieldRequired = errors.New("required filed missing")
)

Functions

This section is empty.

Types

type ClaimOwnershipReq

type ClaimOwnershipReq struct {
	Query Query
	Org   string
}

type ClaimOwnershipResp

type ClaimOwnershipResp struct {
	Nodes []Node
}

type ComparisonResult

type ComparisonResult int8

func NewCompResultFromString

func NewCompResultFromString(value string) (ComparisonResult, error)

func (ComparisonResult) String

func (c ComparisonResult) String() string

type DeleteLabelReq

type DeleteLabelReq struct {
	NodeId   NodeId
	Org      string
	LabelKey string
}

type DeleteLabelResp

type DeleteLabelResp struct {
	Node Node
}

type GetFromNodePoolReq

type GetFromNodePoolReq struct {
	Id NodeId
}

type GetFromNodePoolResp

type GetFromNodePoolResp struct {
	Node Node
}

type GetFromOrgReq

type GetFromOrgReq struct {
	Id  NodeId
	Org string
}

type GetFromOrgResp

type GetFromOrgResp struct {
	Node Node
}

type Label

type Label interface {
	Key() string
	Value() interface{}
	StringValue() string
	Compare(value string) ([]ComparisonResult, error)
}

func NewBoolLabel

func NewBoolLabel(key string, value bool) Label

func NewFloat64Label

func NewFloat64Label(key string, value float64) Label

func NewStringLabel

func NewStringLabel(key string, value string) Label

type LabelMarshaller

type LabelMarshaller interface {
	Marshal(label Label) ([]byte, error)
	Unmarshal(labelMarshalled []byte) (Label, error)
}

type ListNodePoolReq

type ListNodePoolReq struct {
}

type ListNodePoolResp

type ListNodePoolResp struct {
	Nodes []Node
}

type ListOrgOwnedNodesReq

type ListOrgOwnedNodesReq struct {
	Org string
}

type ListOrgOwnedNodesResp

type ListOrgOwnedNodesResp struct {
	Nodes []Node
}

type Node

type Node struct {
	Id          NodeId
	Org         string
	Labels      []Label
	Resources   map[string]float64
	BindAddress string
}

func (Node) Claimed

func (n Node) Claimed() bool

type NodeId

type NodeId struct {
	Value string
}

type NodeMarshaller

type NodeMarshaller interface {
	Marshal(node Node) ([]byte, error)
	Unmarshal(nodeMarshalled []byte) (*Node, error)
}

type NodeRepo

type NodeRepo interface {
	Put(node Node) error
	Get(nodeId NodeId, org string) (*Node, error)
	Delete(node Node) error
	ListNodePool() ([]Node, error)
	ListOrgOwnedNodes(org string) ([]Node, error)
	QueryNodePool(query Query) ([]Node, error)
	QueryOrgOwnedNodes(query Query, org string) ([]Node, error)
	PutLabel(node Node, label Label) (*Node, error)
	DeleteLabel(node Node, labelKey string) (*Node, error)
	ListAllNodes() ([]Node, error)
}

type PutLabelReq

type PutLabelReq struct {
	NodeId NodeId
	Org    string
	Label  Label
}

type PutLabelResp

type PutLabelResp struct {
	Node Node
}

type Query

type Query []Selector

type QueryNodePoolReq

type QueryNodePoolReq struct {
	Query Query
}

type QueryNodePoolResp

type QueryNodePoolResp struct {
	Nodes []Node
}

type QueryOrgOwnedNodesReq

type QueryOrgOwnedNodesReq struct {
	Query Query
	Org   string
}

type QueryOrgOwnedNodesResp

type QueryOrgOwnedNodesResp struct {
	Nodes []Node
}

type RegistrationReq

type RegistrationReq struct {
	Labels      []Label
	Resources   map[string]float64
	BindAddress string
}

type RegistrationResp

type RegistrationResp struct {
	NodeId string
}

type Selector

type Selector struct {
	LabelKey string
	ShouldBe ComparisonResult
	Value    string
}

Jump to

Keyboard shortcuts

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