synerex_nodeapi

package module
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2021 License: Apache-2.0 Imports: 10 Imported by: 2

README

synerex_nodeapi

Node API for Synerex

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NodeType_name = map[int32]string{
		0: "PROVIDER",
		1: "SERVER",
		2: "GATEWAY",
	}
	NodeType_value = map[string]int32{
		"PROVIDER": 0,
		"SERVER":   1,
		"GATEWAY":  2,
	}
)

Enum value maps for NodeType.

View Source
var (
	KeepAliveCommand_name = map[int32]string{
		0: "NONE",
		1: "RECONNECT",
		2: "SERVER_CHANGE",
		3: "PROVIDER_DISCONNECT",
	}
	KeepAliveCommand_value = map[string]int32{
		"NONE":                0,
		"RECONNECT":           1,
		"SERVER_CHANGE":       2,
		"PROVIDER_DISCONNECT": 3,
	}
)

Enum value maps for KeepAliveCommand.

View Source
var File_nodeapi_proto protoreflect.FileDescriptor

Functions

func RegisterNodeServer

func RegisterNodeServer(s *grpc.Server, srv NodeServer)

Types

type KeepAliveCommand added in v0.2.1

type KeepAliveCommand int32
const (
	KeepAliveCommand_NONE                KeepAliveCommand = 0
	KeepAliveCommand_RECONNECT           KeepAliveCommand = 1 // node server is now restarted. please reconnect.
	KeepAliveCommand_SERVER_CHANGE       KeepAliveCommand = 2 // There is change in Synerex Server. Obtain server information.
	KeepAliveCommand_PROVIDER_DISCONNECT KeepAliveCommand = 3 // only for Synerex-Server. Provider is disconnected. Remove Channels
)

func (KeepAliveCommand) Descriptor added in v0.5.4

func (KeepAliveCommand) Enum added in v0.5.4

func (KeepAliveCommand) EnumDescriptor deprecated added in v0.2.1

func (KeepAliveCommand) EnumDescriptor() ([]byte, []int)

Deprecated: Use KeepAliveCommand.Descriptor instead.

func (KeepAliveCommand) Number added in v0.5.4

func (KeepAliveCommand) String added in v0.2.1

func (x KeepAliveCommand) String() string

func (KeepAliveCommand) Type added in v0.5.4

type NodeClient

type NodeClient interface {
	RegisterNode(ctx context.Context, in *NodeInfo, opts ...grpc.CallOption) (*NodeID, error)
	QueryNode(ctx context.Context, in *NodeID, opts ...grpc.CallOption) (*NodeInfo, error)
	KeepAlive(ctx context.Context, in *NodeUpdate, opts ...grpc.CallOption) (*Response, error)
	UnRegisterNode(ctx context.Context, in *NodeID, opts ...grpc.CallOption) (*Response, error)
}

NodeClient is the client API for Node service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewNodeClient

func NewNodeClient(cc grpc.ClientConnInterface) NodeClient

type NodeID

type NodeID struct {
	NodeId            int32  `protobuf:"varint,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"`                                  // unique id for each node in current node server.
	Secret            uint64 `protobuf:"fixed64,2,opt,name=secret,proto3" json:"secret,omitempty"`                                               // secret id with node_server (Not used for Query)
	ServerInfo        string `protobuf:"bytes,3,opt,name=server_info,json=serverInfo,proto3" json:"server_info,omitempty"`                       // synerex server address (only for registration of Server/Gateway)
	KeepaliveDuration int32  `protobuf:"varint,4,opt,name=keepalive_duration,json=keepaliveDuration,proto3" json:"keepalive_duration,omitempty"` // at least make keep alive less than this time.
	// contains filtered or unexported fields
}

func (*NodeID) Descriptor deprecated

func (*NodeID) Descriptor() ([]byte, []int)

Deprecated: Use NodeID.ProtoReflect.Descriptor instead.

func (*NodeID) GetKeepaliveDuration

func (x *NodeID) GetKeepaliveDuration() int32

func (*NodeID) GetNodeId

func (x *NodeID) GetNodeId() int32

func (*NodeID) GetSecret

func (x *NodeID) GetSecret() uint64

func (*NodeID) GetServerInfo added in v0.4.2

func (x *NodeID) GetServerInfo() string

func (*NodeID) ProtoMessage

func (*NodeID) ProtoMessage()

func (*NodeID) ProtoReflect added in v0.5.4

func (x *NodeID) ProtoReflect() protoreflect.Message

func (*NodeID) Reset

func (x *NodeID) Reset()

func (*NodeID) String

func (x *NodeID) String() string

type NodeInfo

type NodeInfo struct {
	NodeName         string   `protobuf:"bytes,1,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"`
	NodeType         NodeType `protobuf:"varint,2,opt,name=node_type,json=nodeType,proto3,enum=nodeapi.NodeType" json:"node_type,omitempty"`    // node is provider/server/gateway?
	ServerInfo       string   `protobuf:"bytes,3,opt,name=server_info,json=serverInfo,proto3" json:"server_info,omitempty"`                     // for synerex servers/gateways
	NodePbaseVersion string   `protobuf:"bytes,4,opt,name=node_pbase_version,json=nodePbaseVersion,proto3" json:"node_pbase_version,omitempty"` // which protocol base version
	WithNodeId       int32    `protobuf:"varint,5,opt,name=with_node_id,json=withNodeId,proto3" json:"with_node_id,omitempty"`                  // for reconnection with previous node_id (usually -1)
	ClusterId        int32    `protobuf:"varint,6,opt,name=cluster_id,json=clusterId,proto3" json:"cluster_id,omitempty"`                       //
	AreaId           string   `protobuf:"bytes,7,opt,name=area_id,json=areaId,proto3" json:"area_id,omitempty"`                                 // for area definition
	ChannelTypes     []uint32 `protobuf:"varint,8,rep,packed,name=channelTypes,proto3" json:"channelTypes,omitempty"`                           // used channel list
	GwInfo           string   `protobuf:"bytes,9,opt,name=gw_info,json=gwInfo,proto3" json:"gw_info,omitempty"`                                 // for gateway information
	// for information for controller
	BinVersion    string                 `protobuf:"bytes,10,opt,name=bin_version,json=binVersion,proto3" json:"bin_version,omitempty"` // version of binary
	Count         int32                  `protobuf:"varint,11,opt,name=count,proto3" json:"count,omitempty"`                            // keepalive update count
	LastAliveTime *timestamppb.Timestamp `protobuf:"bytes,12,opt,name=last_alive_time,json=lastAliveTime,proto3" json:"last_alive_time,omitempty"`
	KeepaliveArg  string                 `protobuf:"bytes,13,opt,name=keepalive_arg,json=keepaliveArg,proto3" json:"keepalive_arg,omitempty"` // keepalive argument
	// contains filtered or unexported fields
}

information for synerex servers and providers, gateways (nodes)

func (*NodeInfo) Descriptor deprecated

func (*NodeInfo) Descriptor() ([]byte, []int)

Deprecated: Use NodeInfo.ProtoReflect.Descriptor instead.

func (*NodeInfo) GetAreaId added in v0.3.1

func (x *NodeInfo) GetAreaId() string

func (*NodeInfo) GetBinVersion added in v0.5.3

func (x *NodeInfo) GetBinVersion() string

func (*NodeInfo) GetChannelTypes added in v0.3.1

func (x *NodeInfo) GetChannelTypes() []uint32

func (*NodeInfo) GetClusterId added in v0.3.1

func (x *NodeInfo) GetClusterId() int32

func (*NodeInfo) GetCount added in v0.5.3

func (x *NodeInfo) GetCount() int32

func (*NodeInfo) GetGwInfo added in v0.4.4

func (x *NodeInfo) GetGwInfo() string

func (*NodeInfo) GetKeepaliveArg added in v0.5.3

func (x *NodeInfo) GetKeepaliveArg() string

func (*NodeInfo) GetLastAliveTime added in v0.5.3

func (x *NodeInfo) GetLastAliveTime() *timestamppb.Timestamp

func (*NodeInfo) GetNodeName

func (x *NodeInfo) GetNodeName() string

func (*NodeInfo) GetNodePbaseVersion added in v0.1.1

func (x *NodeInfo) GetNodePbaseVersion() string

func (*NodeInfo) GetNodeType added in v0.4.1

func (x *NodeInfo) GetNodeType() NodeType

func (*NodeInfo) GetServerInfo added in v0.4.3

func (x *NodeInfo) GetServerInfo() string

func (*NodeInfo) GetWithNodeId added in v0.3.1

func (x *NodeInfo) GetWithNodeId() int32

func (*NodeInfo) ProtoMessage

func (*NodeInfo) ProtoMessage()

func (*NodeInfo) ProtoReflect added in v0.5.4

func (x *NodeInfo) ProtoReflect() protoreflect.Message

func (*NodeInfo) Reset

func (x *NodeInfo) Reset()

func (*NodeInfo) String

func (x *NodeInfo) String() string

type NodeServer

type NodeServer interface {
	RegisterNode(context.Context, *NodeInfo) (*NodeID, error)
	QueryNode(context.Context, *NodeID) (*NodeInfo, error)
	KeepAlive(context.Context, *NodeUpdate) (*Response, error)
	UnRegisterNode(context.Context, *NodeID) (*Response, error)
}

NodeServer is the server API for Node service.

type NodeType added in v0.4.1

type NodeType int32
const (
	NodeType_PROVIDER NodeType = 0 // most of node is normal provider
	NodeType_SERVER   NodeType = 1 // node is synerex server.
	NodeType_GATEWAY  NodeType = 2 // node is synerex gateway. (for inter synerex/outer synerex)
)

func (NodeType) Descriptor added in v0.5.4

func (NodeType) Descriptor() protoreflect.EnumDescriptor

func (NodeType) Enum added in v0.5.4

func (x NodeType) Enum() *NodeType

func (NodeType) EnumDescriptor deprecated added in v0.4.1

func (NodeType) EnumDescriptor() ([]byte, []int)

Deprecated: Use NodeType.Descriptor instead.

func (NodeType) Number added in v0.5.4

func (x NodeType) Number() protoreflect.EnumNumber

func (NodeType) String added in v0.4.1

func (x NodeType) String() string

func (NodeType) Type added in v0.5.4

type NodeUpdate

type NodeUpdate struct {
	NodeId      int32         `protobuf:"varint,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"`                // unique id for each node in current node server.
	Secret      uint64        `protobuf:"fixed64,2,opt,name=secret,proto3" json:"secret,omitempty"`                             // secret number for each provider (for auth)
	UpdateCount int32         `protobuf:"varint,3,opt,name=update_count,json=updateCount,proto3" json:"update_count,omitempty"` // sequential counter for nodes
	NodeStatus  int32         `protobuf:"varint,4,opt,name=node_status,json=nodeStatus,proto3" json:"node_status,omitempty"`    // running state (health check)
	NodeArg     string        `protobuf:"bytes,5,opt,name=node_arg,json=nodeArg,proto3" json:"node_arg,omitempty"`
	Status      *ServerStatus `protobuf:"bytes,6,opt,name=status,proto3" json:"status,omitempty"` // server status (load average)
	// contains filtered or unexported fields
}

func (*NodeUpdate) Descriptor deprecated

func (*NodeUpdate) Descriptor() ([]byte, []int)

Deprecated: Use NodeUpdate.ProtoReflect.Descriptor instead.

func (*NodeUpdate) GetNodeArg

func (x *NodeUpdate) GetNodeArg() string

func (*NodeUpdate) GetNodeId

func (x *NodeUpdate) GetNodeId() int32

func (*NodeUpdate) GetNodeStatus

func (x *NodeUpdate) GetNodeStatus() int32

func (*NodeUpdate) GetSecret

func (x *NodeUpdate) GetSecret() uint64

func (*NodeUpdate) GetStatus added in v0.4.4

func (x *NodeUpdate) GetStatus() *ServerStatus

func (*NodeUpdate) GetUpdateCount

func (x *NodeUpdate) GetUpdateCount() int32

func (*NodeUpdate) ProtoMessage

func (*NodeUpdate) ProtoMessage()

func (*NodeUpdate) ProtoReflect added in v0.5.4

func (x *NodeUpdate) ProtoReflect() protoreflect.Message

func (*NodeUpdate) Reset

func (x *NodeUpdate) Reset()

func (*NodeUpdate) String

func (x *NodeUpdate) String() string

type Response

type Response struct {
	Ok      bool             `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"`
	Command KeepAliveCommand `protobuf:"varint,2,opt,name=command,proto3,enum=nodeapi.KeepAliveCommand" json:"command,omitempty"`
	Err     string           `protobuf:"bytes,3,opt,name=err,proto3" json:"err,omitempty"`
	// contains filtered or unexported fields
}

func (*Response) Descriptor deprecated

func (*Response) Descriptor() ([]byte, []int)

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetCommand added in v0.2.1

func (x *Response) GetCommand() KeepAliveCommand

func (*Response) GetErr

func (x *Response) GetErr() string

func (*Response) GetOk

func (x *Response) GetOk() bool

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect added in v0.5.4

func (x *Response) ProtoReflect() protoreflect.Message

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

type ServerStatus added in v0.4.4

type ServerStatus struct {
	Cpu      float64 `protobuf:"fixed64,1,opt,name=cpu,proto3" json:"cpu,omitempty"`                          // cpu load average
	Memory   float64 `protobuf:"fixed64,2,opt,name=memory,proto3" json:"memory,omitempty"`                    // memory usage rate
	MsgCount uint64  `protobuf:"varint,3,opt,name=msg_count,json=msgCount,proto3" json:"msg_count,omitempty"` // message count
	// contains filtered or unexported fields
}

func (*ServerStatus) Descriptor deprecated added in v0.4.4

func (*ServerStatus) Descriptor() ([]byte, []int)

Deprecated: Use ServerStatus.ProtoReflect.Descriptor instead.

func (*ServerStatus) GetCpu added in v0.4.6

func (x *ServerStatus) GetCpu() float64

func (*ServerStatus) GetMemory added in v0.4.4

func (x *ServerStatus) GetMemory() float64

func (*ServerStatus) GetMsgCount added in v0.4.4

func (x *ServerStatus) GetMsgCount() uint64

func (*ServerStatus) ProtoMessage added in v0.4.4

func (*ServerStatus) ProtoMessage()

func (*ServerStatus) ProtoReflect added in v0.5.4

func (x *ServerStatus) ProtoReflect() protoreflect.Message

func (*ServerStatus) Reset added in v0.4.4

func (x *ServerStatus) Reset()

func (*ServerStatus) String added in v0.4.4

func (x *ServerStatus) String() string

type UnimplementedNodeServer added in v0.4.5

type UnimplementedNodeServer struct {
}

UnimplementedNodeServer can be embedded to have forward compatible implementations.

func (*UnimplementedNodeServer) KeepAlive added in v0.4.5

func (*UnimplementedNodeServer) QueryNode added in v0.4.5

func (*UnimplementedNodeServer) RegisterNode added in v0.4.5

func (*UnimplementedNodeServer) UnRegisterNode added in v0.4.5

Jump to

Keyboard shortcuts

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