discovery

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: MIT Imports: 1 Imported by: 26

Documentation

Index

Constants

View Source
const (
	// NodeUp node starting up
	NodeUp NodeState = 0
	// NodeDown node shutdown
	NodeDown NodeState = 1
	// NodeKeepalive node keepalive
	NodeKeepalive NodeState = 2

	DefaultPublishPrefix   = "node.publish"
	DefaultDiscoveryPrefix = "node.discovery"

	DefaultLivecycle = 2 * time.Second
	DefaultExpire    = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action added in v0.2.0

type Action string
const (
	Save   Action = "save"
	Update Action = "update"
	Delete Action = "delete"
	Get    Action = "get"
)

type GetResponse

type GetResponse struct {
	Nodes []Node
}

type Node

type Node struct {
	DC        string
	Service   string
	NID       string
	RPC       RPC
	ExtraInfo map[string]interface{}
}

Node represents a node info

func (*Node) ID

func (n *Node) ID() string

ID return the node id with scheme prefix

type NodeState

type NodeState int32

NodeState define the node state type

type Protocol

type Protocol string
const (
	GRPC    Protocol = "grpc"
	NGRPC   Protocol = "nats-grpc"
	JSONRPC Protocol = "json-rpc"
)

type RPC

type RPC struct {
	Protocol Protocol
	Addr     string
	Params   map[string]string
}

type Request added in v0.2.0

type Request struct {
	Action  Action
	Node    Node
	Service string
	Params  map[string]interface{}
}

type Response added in v0.2.0

type Response struct {
	Success bool
	Reason  string
}

Jump to

Keyboard shortcuts

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