nodes

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NodeTypesToKind = map[NodeType]string{
		NodeMaster:     "master",
		NodeConnector:  "connector",
		NodeGameServer: "gameserver",
	}
	NodeKindToTypes = map[string]NodeType{
		"master":     NodeMaster,
		"connector":  NodeConnector,
		"gameserver": NodeGameServer,
	}

	NodeTypesToStatus = map[NodeStatus]string{
		NodeStoped:   "stoped",
		NodeStoping:  "stoping",
		NodeStarting: "starting",
		NodeStarted:  "started",
	}
	NodeStatusToTypes = map[string]NodeStatus{
		"stoped":   NodeStoped,
		"stoping":  NodeStoping,
		"starting": NodeStarting,
		"started":  NodeStarted,
	}
)

Functions

This section is empty.

Types

type Node

type Node struct {
	Nid     string     `json:"nid"`
	Name    string     `json:"name"`
	Gsid    string     `json:"gsid"`
	Address string     `json:"address"`
	Type    NodeType   `json:"type"`
	Status  NodeStatus `json:"status"`
}

func NewNode

func NewNode(name, nid string, ntype NodeType, opts ...NodeOpts) *Node

func (*Node) SetNodeStatus

func (n *Node) SetNodeStatus(nstatus NodeStatus, opt NodeOpts)

type NodeOpts

type NodeOpts func(n *Node)

func WithNodeAddress

func WithNodeAddress(addr string) NodeOpts

func WithNodeGsid

func WithNodeGsid(gsid string) NodeOpts

func WithNodeID

func WithNodeID(nid string) NodeOpts

func WithNodeStatus

func WithNodeStatus(status NodeStatus) NodeOpts

type NodeStatus

type NodeStatus int
const (
	NodeStoped NodeStatus
	NodeStoping
	NodeStarting
	NodeStarted
)

type NodeType

type NodeType int
const (
	NodeMaster NodeType
	NodeConnector
	NodeGameServer
)

Jump to

Keyboard shortcuts

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