node

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: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Role  string `json:"role"`
	Debug bool   `json:"debug"`

	Master serverConfig `json:"master"`
	Server serverConfig `json:"server"`

	Token tokenConfig `json:"token"`
}

Node represents a genernal node info

func (*Node) AddTaskRequest

func (n *Node) AddTaskRequest(message string) (string, error)

func (*Node) DelistRequest

func (n *Node) DelistRequest() (string, error)

func (*Node) KeepAliveRequest

func (n *Node) KeepAliveRequest() (string, error)

func (*Node) LoadConfig

func (n *Node) LoadConfig(cfg *config.Config) error

LoadConfig load node config to an existed node.

func (*Node) Marshal

func (n *Node) Marshal() ([]byte, error)

Marshal returns the JSON encoding of a node info.

func (*Node) RegisterRequest

func (n *Node) RegisterRequest() (string, error)

func (*Node) RegisterResponse

func (n *Node) RegisterResponse() (string, error)

func (*Node) RunHTTPServer

func (n *Node) RunHTTPServer()

func (*Node) RunTCPServer

func (n *Node) RunTCPServer(masterCh chan Requset) error

RunTCPServer runs a server to listen tcp request

func (*Node) SendRequest

func (n *Node) SendRequest(requestType string, requestMessage string) error

func (*Node) String

func (n *Node) String() string

func (*Node) UpdateRequest

func (n *Node) UpdateRequest() (string, error)

func (*Node) UpdateTaskRequest

func (n *Node) UpdateTaskRequest(message string) (string, error)

type Requset

type Requset struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"`
	Node Node   `json:"node"`

	Massage interface{} `json:"massage"`
}

func (*Requset) Marshal

func (r *Requset) Marshal() ([]byte, error)

Marshal returns the JSON encoding of a node info.

func (*Requset) String

func (r *Requset) String() string

Jump to

Keyboard shortcuts

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