master

package
v0.0.0-...-79b0fad Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2019 License: GPL-3.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MasterForLoop

func MasterForLoop(m *Master)

func RegisterToCluster

func RegisterToCluster(m *Master)

func SlaveForLoop

func SlaveForLoop(m *Master)

Types

type Master

type Master struct {
	Node     *node.Node   `json:"node"`
	Cluster  []node.Node  `json:"cluster"`
	Schedule []PlanConfig `json:"schedule"`
	Tasks    []slave.Task `json:"tasks"`
}

func (*Master) AddNodeToCluster

func (m *Master) AddNodeToCluster(n *node.Node) error

func (*Master) AddTaskToNode

func (m *Master) AddTaskToNode(t *PlanConfig) error

func (*Master) Marshal

func (m *Master) Marshal() ([]byte, error)

Marshal returns the JSON encoding of a node info.

func (*Master) RemoveNodeFromCluster

func (m *Master) RemoveNodeFromCluster(n *node.Node) error

func (*Master) Run

func (m *Master) Run() error

func (*Master) RunAsMaster

func (m *Master) RunAsMaster() error

func (*Master) RunAsMasterSlave

func (m *Master) RunAsMasterSlave(masterCh chan node.Requset) error

func (*Master) RunAsMasterStandby

func (m *Master) RunAsMasterStandby() error

func (*Master) RunAsSlaveMaster

func (m *Master) RunAsSlaveMaster() error

func (*Master) String

func (m *Master) String() string

func (*Master) UpdateTaskInfo

func (m *Master) UpdateTaskInfo(n *node.Node, t *slave.Task) error

type PlanConfig

type PlanConfig struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	NodeID string `json:"node_id"`

	Interval int       `json:"interval"`
	CreateAt time.Time `json:"create_at"`
	UpdateAt time.Time `json:"update_at"`

	Task slave.Task `json:"task"`

	Status string `json:"status"`
}

func LoadPlanConfig

func LoadPlanConfig(cfg *config.Config) ([]PlanConfig, error)

LoadPlanConfig load node config to an existed node.

func (*PlanConfig) Marshal

func (p *PlanConfig) Marshal() ([]byte, error)

Marshal returns the JSON encoding of a node info.

func (*PlanConfig) String

func (p *PlanConfig) String() string

Jump to

Keyboard shortcuts

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