node

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 36 Imported by: 0

README

Node Management

A node can be seen as a physical device running an operating system.

A node agent registers itself to a node server, and manages all services running on that node.

A node server manages all agents and services running on all nodes.

A service may not necessarily be managed to an agent, however, it always contains a messager to allow itself register quickly whenever it wants. That means messaging is mandatory while registration is on-demand.

s1 interface

The interface between a node server and an agent.

1.generate protobuf files

protoc --go_out=plugins=grpc:. s1.proto

TODO

  • cluster mode support
    • raft based cluster
    • sqlite-based persistent

Documentation

Index

Constants

View Source
const (
	// DES algorithm
	DES uint32 = 1

	// AES algorithm
	AES uint32 = 2

	// GM4 Guo Mi 4 algorithm
	GM4 uint32 = 3
)

Variables

View Source
var ErrorCode_name = map[int32]string{
	0:   "Success",
	1:   "IntegrityError",
	2:   "FormatError",
	3:   "NotFound",
	4:   "UnSupported",
	5:   "Expired",
	6:   "IllegalState",
	14:  "Busy",
	254: "InternalError",
	255: "Unknown",
}
View Source
var ErrorCode_value = map[string]int32{
	"Success":        0,
	"IntegrityError": 1,
	"FormatError":    2,
	"NotFound":       3,
	"UnSupported":    4,
	"Expired":        5,
	"IllegalState":   6,
	"Busy":           14,
	"InternalError":  254,
	"Unknown":        255,
}
View Source
var Procedure_name = map[int32]string{
	0:   "Initiate",
	128: "NotifyUpgrade",
}
View Source
var Procedure_value = map[string]int32{
	"Initiate":      0,
	"NotifyUpgrade": 128,
}

Functions

func RegisterS1ServiceServer

func RegisterS1ServiceServer(s *grpc.Server, srv S1ServiceServer)

Types

type Agent

type Agent struct {
	*meta.StateMachine[string]
	// contains filtered or unexported fields
}

Agent models node of the terminal side.

func NewAgent

func NewAgent(endpoint string, opts ...AgentOption) *Agent

NewAgent creates an agent with the given endpoint address of the server and options.

func (*Agent) HandleConn

func (a *Agent) HandleConn(ctx context.Context, connStats stats.ConnStats)

HandleConn the hook, which handles state migration according to the underlying connection state change.

func (*Agent) HandleRPC

func (a *Agent) HandleRPC(ctx context.Context, rpcStats stats.RPCStats)

HandleRPC not used yet

func (*Agent) Start

func (a *Agent) Start() error

Start starts the agent by connecting, creating a service client, establishing the client side protocol stack and moving to starting state. Returns err if failed.

func (*Agent) Stop

func (a *Agent) Stop()

Stop stops the agent.

func (*Agent) TagConn

func (a *Agent) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context

TagConn not used yet

func (*Agent) TagRPC

func (a *Agent) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context

TagRPC not used yet

type AgentConfManager

type AgentConfManager interface {
	GetConf() *Conf
	SaveConf(c *Conf) error
	NeedProvision() bool
	UpdateProvision(id string, expire uint64) bool
}

AgentConfManager defines config operations for agent side.

func NewAgentConfManager

func NewAgentConfManager(path string) AgentConfManager

NewAgentConfManager creates a AgentConfManager using the given path as the conf.db file

type AgentOption

type AgentOption func(agent *Agent)

AgentOption func-closure pattern

func WithCallbacks

func WithCallbacks(cbs AgentSideHooks) AgentOption

WithCallbacks provides agent side hooks.

func WithClientID

func WithClientID(id string) AgentOption

WithClientID sets agent identity to id.

func WithStatusReportInterval

func WithStatusReportInterval(interval uint32) AgentOption

WithStatusReportInterval sets status report interval to the given value, in milliseconds.

func WithThreshold

func WithThreshold(t uint32) AgentOption

WithThreshold provides a retry threshold, which will result to rebuild underlying connection if the number of internal failures exceeds it.

type AgentProto

type AgentProto struct {
	// contains filtered or unexported fields
}

AgentProto defines protocol stack entity of agent side.

func NewAgentProto

func NewAgentProto(upper *Agent, lower S1ServiceClient) *AgentProto

NewAgentProto creates a protocol stack impl of agent side.

type AgentSideCallback

type AgentSideCallback func()

AgentSideCallback the callback of hooks.

type AgentSideHooks

type AgentSideHooks struct {
	//called after initialized
	OnInitialized AgentSideCallback

	//called after successfully authed
	OnAuthenticated AgentSideCallback

	//called when preparing or re-preparing finished
	OnMaintained AgentSideCallback

	//called when stream message received
	OnServerNasMsg func(*StreamMessage)

	//called after stopped
	OnStopped AgentSideCallback
}

AgentSideHooks defines callbacks agent exposed

type AppendReq

type AppendReq struct {
	Term         uint64        //leader’s term
	LeaderID     string        //leader id so follower can redirect clients
	PrevLogIndex uint64        //index of log entry immediately preceding new ones
	PrevLogTerm  uint64        //term of prevLogIndex entry
	Entries      []interface{} //log entries to store (empty for heartbeat; may send more than one for efficiency)
	LeaderCommit uint64        // leader’s commitIndex
}

AppendReq defines request of raft AppendEntries Method, and is invoked by leader to replicate logs & to piggyback heartbeat.

type AppendRsp

type AppendRsp struct {
	Term    uint64 //currentTerm, for leader to update itself
	Success bool   //true if follower contained entry matching prevLogIndex and prevLogTerm
}

AppendRsp defines response of raft AppendEntries Method.

type CheckUpgradeReq

type CheckUpgradeReq struct {
	VersionInfo          *VersionInfo `protobuf:"bytes,1,opt,name=versionInfo,proto3" json:"versionInfo,omitempty"`
	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
	XXX_unrecognized     []byte       `json:"-"`
	XXX_sizecache        int32        `json:"-"`
}

func (*CheckUpgradeReq) Descriptor

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

func (*CheckUpgradeReq) GetVersionInfo

func (m *CheckUpgradeReq) GetVersionInfo() *VersionInfo

func (*CheckUpgradeReq) ProtoMessage

func (*CheckUpgradeReq) ProtoMessage()

func (*CheckUpgradeReq) Reset

func (m *CheckUpgradeReq) Reset()

func (*CheckUpgradeReq) String

func (m *CheckUpgradeReq) String() string

func (*CheckUpgradeReq) XXX_DiscardUnknown

func (m *CheckUpgradeReq) XXX_DiscardUnknown()

func (*CheckUpgradeReq) XXX_Marshal

func (m *CheckUpgradeReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CheckUpgradeReq) XXX_Merge

func (m *CheckUpgradeReq) XXX_Merge(src proto.Message)

func (*CheckUpgradeReq) XXX_Size

func (m *CheckUpgradeReq) XXX_Size() int

func (*CheckUpgradeReq) XXX_Unmarshal

func (m *CheckUpgradeReq) XXX_Unmarshal(b []byte) error

type CheckUpgradeRsp

type CheckUpgradeRsp struct {
	UpgradeInfo          *UpgradeInfo `protobuf:"bytes,1,opt,name=upgradeInfo,proto3" json:"upgradeInfo,omitempty"`
	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
	XXX_unrecognized     []byte       `json:"-"`
	XXX_sizecache        int32        `json:"-"`
}

func (*CheckUpgradeRsp) Descriptor

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

func (*CheckUpgradeRsp) GetUpgradeInfo

func (m *CheckUpgradeRsp) GetUpgradeInfo() *UpgradeInfo

func (*CheckUpgradeRsp) ProtoMessage

func (*CheckUpgradeRsp) ProtoMessage()

func (*CheckUpgradeRsp) Reset

func (m *CheckUpgradeRsp) Reset()

func (*CheckUpgradeRsp) String

func (m *CheckUpgradeRsp) String() string

func (*CheckUpgradeRsp) XXX_DiscardUnknown

func (m *CheckUpgradeRsp) XXX_DiscardUnknown()

func (*CheckUpgradeRsp) XXX_Marshal

func (m *CheckUpgradeRsp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CheckUpgradeRsp) XXX_Merge

func (m *CheckUpgradeRsp) XXX_Merge(src proto.Message)

func (*CheckUpgradeRsp) XXX_Size

func (m *CheckUpgradeRsp) XXX_Size() int

func (*CheckUpgradeRsp) XXX_Unmarshal

func (m *CheckUpgradeRsp) XXX_Unmarshal(b []byte) error

type ClusterNode

type ClusterNode struct {
	// contains filtered or unexported fields
}

ClusterNode as a cluster node

type Conf

type Conf struct {
	Identity       string `json:"identity"`       //identity of current agent
	ExpirationTime int64  `json:"expirationTime"` //current provision expiration time
	ProvisionTime  int64  `json:"provisionTime"`  //initial provision timestamp
	LastUpdateTime int64  `json:"lastUpdateTime"` //timestamp when recent update of provision info
	RepeatTimes    uint32 `json:"repeatTimes"`    // number of times re-provisioned
}

Conf defines agent config, static & semi-static & dynamic.

type DeviceInfo

type DeviceInfo struct {
	Type                 uint32   `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"`
	Vendor               string   `protobuf:"bytes,2,opt,name=vendor,proto3" json:"vendor,omitempty"`
	Model                string   `protobuf:"bytes,3,opt,name=model,proto3" json:"model,omitempty"`
	Version              string   `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"`
	CpuInfo              string   `protobuf:"bytes,7,opt,name=cpuInfo,proto3" json:"cpuInfo,omitempty"`
	MemInfo              uint64   `protobuf:"varint,8,opt,name=memInfo,proto3" json:"memInfo,omitempty"`
	Storage              uint64   `protobuf:"varint,9,opt,name=storage,proto3" json:"storage,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*DeviceInfo) Descriptor

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

func (*DeviceInfo) GetCpuInfo

func (m *DeviceInfo) GetCpuInfo() string

func (*DeviceInfo) GetMemInfo

func (m *DeviceInfo) GetMemInfo() uint64

func (*DeviceInfo) GetModel

func (m *DeviceInfo) GetModel() string

func (*DeviceInfo) GetStorage

func (m *DeviceInfo) GetStorage() uint64

func (*DeviceInfo) GetType

func (m *DeviceInfo) GetType() uint32

func (*DeviceInfo) GetVendor

func (m *DeviceInfo) GetVendor() string

func (*DeviceInfo) GetVersion

func (m *DeviceInfo) GetVersion() string

func (*DeviceInfo) ProtoMessage

func (*DeviceInfo) ProtoMessage()

func (*DeviceInfo) Reset

func (m *DeviceInfo) Reset()

func (*DeviceInfo) String

func (m *DeviceInfo) String() string

func (*DeviceInfo) XXX_DiscardUnknown

func (m *DeviceInfo) XXX_DiscardUnknown()

func (*DeviceInfo) XXX_Marshal

func (m *DeviceInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DeviceInfo) XXX_Merge

func (m *DeviceInfo) XXX_Merge(src proto.Message)

func (*DeviceInfo) XXX_Size

func (m *DeviceInfo) XXX_Size() int

func (*DeviceInfo) XXX_Unmarshal

func (m *DeviceInfo) XXX_Unmarshal(b []byte) error

type ElectionService

type ElectionService interface {
	RequestVote(req *VoteReq, rsp *VoteRsp) error
	IncrementTerm()
	VoteForMySelf()
	BroadcastVote()
	WinTheElection() bool
}

ElectionService defines leader-election-related operations.

type ErrorCode

type ErrorCode int32
const (
	ErrorCode_Success        ErrorCode = 0
	ErrorCode_IntegrityError ErrorCode = 1
	ErrorCode_FormatError    ErrorCode = 2
	ErrorCode_NotFound       ErrorCode = 3
	ErrorCode_UnSupported    ErrorCode = 4
	ErrorCode_Expired        ErrorCode = 5
	ErrorCode_IllegalState   ErrorCode = 6
	ErrorCode_Busy           ErrorCode = 14
	ErrorCode_InternalError  ErrorCode = 254
	ErrorCode_Unknown        ErrorCode = 255
)

func (ErrorCode) EnumDescriptor

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

func (ErrorCode) String

func (x ErrorCode) String() string

type GetConfigReq

type GetConfigReq struct {
	ParameterInfo        *ParameterInfo `protobuf:"bytes,1,opt,name=parameterInfo,proto3" json:"parameterInfo,omitempty"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

func (*GetConfigReq) Descriptor

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

func (*GetConfigReq) GetParameterInfo

func (m *GetConfigReq) GetParameterInfo() *ParameterInfo

func (*GetConfigReq) ProtoMessage

func (*GetConfigReq) ProtoMessage()

func (*GetConfigReq) Reset

func (m *GetConfigReq) Reset()

func (*GetConfigReq) String

func (m *GetConfigReq) String() string

func (*GetConfigReq) XXX_DiscardUnknown

func (m *GetConfigReq) XXX_DiscardUnknown()

func (*GetConfigReq) XXX_Marshal

func (m *GetConfigReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetConfigReq) XXX_Merge

func (m *GetConfigReq) XXX_Merge(src proto.Message)

func (*GetConfigReq) XXX_Size

func (m *GetConfigReq) XXX_Size() int

func (*GetConfigReq) XXX_Unmarshal

func (m *GetConfigReq) XXX_Unmarshal(b []byte) error

type GetConfigRsp

type GetConfigRsp struct {
	ParameterInfo        *ParameterInfo `protobuf:"bytes,1,opt,name=parameterInfo,proto3" json:"parameterInfo,omitempty"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

func (*GetConfigRsp) Descriptor

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

func (*GetConfigRsp) GetParameterInfo

func (m *GetConfigRsp) GetParameterInfo() *ParameterInfo

func (*GetConfigRsp) ProtoMessage

func (*GetConfigRsp) ProtoMessage()

func (*GetConfigRsp) Reset

func (m *GetConfigRsp) Reset()

func (*GetConfigRsp) String

func (m *GetConfigRsp) String() string

func (*GetConfigRsp) XXX_DiscardUnknown

func (m *GetConfigRsp) XXX_DiscardUnknown()

func (*GetConfigRsp) XXX_Marshal

func (m *GetConfigRsp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetConfigRsp) XXX_Merge

func (m *GetConfigRsp) XXX_Merge(src proto.Message)

func (*GetConfigRsp) XXX_Size

func (m *GetConfigRsp) XXX_Size() int

func (*GetConfigRsp) XXX_Unmarshal

func (m *GetConfigRsp) XXX_Unmarshal(b []byte) error

type Node

type Node struct {
	Identity   string `json:"identity"`   //identity of a node
	Status     uint32 `json:"status"`     //node status
	Endpoint   string `json:"endpoint"`   //current endpoint address
	ExpireTime uint64 `json:"expireTime"` //identity expiration time, in seconds
	SignUpTime uint64 `json:"signUpTime"` //sign up timestamp, in seconds
	SignInTime uint64 `json:"signInTime"` //sign in timestamp, in seconds
	UpdateTime uint64 `json:"updateTime"` //timestamp when recent update of provision info
}

Node defines node info.

type ParameterInfo

type ParameterInfo struct {
	// parameter name - value
	Parameters           map[string]*ParameterInfo_Parameter `` /* 161-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}                            `json:"-"`
	XXX_unrecognized     []byte                              `json:"-"`
	XXX_sizecache        int32                               `json:"-"`
}

func (*ParameterInfo) Descriptor

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

func (*ParameterInfo) GetParameters

func (m *ParameterInfo) GetParameters() map[string]*ParameterInfo_Parameter

func (*ParameterInfo) ProtoMessage

func (*ParameterInfo) ProtoMessage()

func (*ParameterInfo) Reset

func (m *ParameterInfo) Reset()

func (*ParameterInfo) String

func (m *ParameterInfo) String() string

func (*ParameterInfo) XXX_DiscardUnknown

func (m *ParameterInfo) XXX_DiscardUnknown()

func (*ParameterInfo) XXX_Marshal

func (m *ParameterInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ParameterInfo) XXX_Merge

func (m *ParameterInfo) XXX_Merge(src proto.Message)

func (*ParameterInfo) XXX_Size

func (m *ParameterInfo) XXX_Size() int

func (*ParameterInfo) XXX_Unmarshal

func (m *ParameterInfo) XXX_Unmarshal(b []byte) error

type ParameterInfo_Parameter

type ParameterInfo_Parameter struct {
	Type                 string   `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	Value                string   `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ParameterInfo_Parameter) Descriptor

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

func (*ParameterInfo_Parameter) GetType

func (m *ParameterInfo_Parameter) GetType() string

func (*ParameterInfo_Parameter) GetValue

func (m *ParameterInfo_Parameter) GetValue() string

func (*ParameterInfo_Parameter) ProtoMessage

func (*ParameterInfo_Parameter) ProtoMessage()

func (*ParameterInfo_Parameter) Reset

func (m *ParameterInfo_Parameter) Reset()

func (*ParameterInfo_Parameter) String

func (m *ParameterInfo_Parameter) String() string

func (*ParameterInfo_Parameter) XXX_DiscardUnknown

func (m *ParameterInfo_Parameter) XXX_DiscardUnknown()

func (*ParameterInfo_Parameter) XXX_Marshal

func (m *ParameterInfo_Parameter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ParameterInfo_Parameter) XXX_Merge

func (m *ParameterInfo_Parameter) XXX_Merge(src proto.Message)

func (*ParameterInfo_Parameter) XXX_Size

func (m *ParameterInfo_Parameter) XXX_Size() int

func (*ParameterInfo_Parameter) XXX_Unmarshal

func (m *ParameterInfo_Parameter) XXX_Unmarshal(b []byte) error

type Peer

type Peer struct {
	// contains filtered or unexported fields
}

Peer defines the maintained meta info of other nodes by a cluster node.

type Procedure

type Procedure int32

streamed procedures

const (
	//ul part
	Procedure_Initiate Procedure = 0
	//dl part
	Procedure_NotifyUpgrade Procedure = 128
)

func (Procedure) EnumDescriptor

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

func (Procedure) String

func (x Procedure) String() string

type RaftRole

type RaftRole string

RaftRole defines role type of raft.

const (
	// RaftRoleLeader the raft leader role.
	RaftRoleLeader RaftRole = "leader"

	// RaftRoleCandidate the raft candidate role.
	RaftRoleCandidate RaftRole = "candidate"

	// RaftRoleFollower the raft follower role.
	RaftRoleFollower RaftRole = "follower"
)

type RaftService

type RaftService interface {
	ReplicationService
	ElectionService
}

RaftService defines services a raft-based cluster should expose

type ReplicationService

type ReplicationService interface {
	AppendEntries(req *AppendReq, rsp *AppendRsp) error
}

ReplicationService defines log-replication-related operations.

type ReportStatusReq

type ReportStatusReq struct {
	SoftwareVersion      string         `protobuf:"bytes,1,opt,name=softwareVersion,proto3" json:"softwareVersion,omitempty"`
	ProtocolVersion      string         `protobuf:"bytes,2,opt,name=protocolVersion,proto3" json:"protocolVersion,omitempty"`
	Ipv4Address          string         `protobuf:"bytes,3,opt,name=ipv4Address,proto3" json:"ipv4Address,omitempty"`
	DeviceInfo           *DeviceInfo    `protobuf:"bytes,11,opt,name=deviceInfo,proto3" json:"deviceInfo,omitempty"`
	Utilization          *Utilization   `protobuf:"bytes,12,opt,name=utilization,proto3" json:"utilization,omitempty"`
	VersionInfo          *VersionInfo   `protobuf:"bytes,13,opt,name=versionInfo,proto3" json:"versionInfo,omitempty"`
	ParameterInfo        *ParameterInfo `protobuf:"bytes,14,opt,name=parameterInfo,proto3" json:"parameterInfo,omitempty"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

func (*ReportStatusReq) Descriptor

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

func (*ReportStatusReq) GetDeviceInfo

func (m *ReportStatusReq) GetDeviceInfo() *DeviceInfo

func (*ReportStatusReq) GetIpv4Address

func (m *ReportStatusReq) GetIpv4Address() string

func (*ReportStatusReq) GetParameterInfo

func (m *ReportStatusReq) GetParameterInfo() *ParameterInfo

func (*ReportStatusReq) GetProtocolVersion

func (m *ReportStatusReq) GetProtocolVersion() string

func (*ReportStatusReq) GetSoftwareVersion

func (m *ReportStatusReq) GetSoftwareVersion() string

func (*ReportStatusReq) GetUtilization

func (m *ReportStatusReq) GetUtilization() *Utilization

func (*ReportStatusReq) GetVersionInfo

func (m *ReportStatusReq) GetVersionInfo() *VersionInfo

func (*ReportStatusReq) ProtoMessage

func (*ReportStatusReq) ProtoMessage()

func (*ReportStatusReq) Reset

func (m *ReportStatusReq) Reset()

func (*ReportStatusReq) String

func (m *ReportStatusReq) String() string

func (*ReportStatusReq) XXX_DiscardUnknown

func (m *ReportStatusReq) XXX_DiscardUnknown()

func (*ReportStatusReq) XXX_Marshal

func (m *ReportStatusReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ReportStatusReq) XXX_Merge

func (m *ReportStatusReq) XXX_Merge(src proto.Message)

func (*ReportStatusReq) XXX_Size

func (m *ReportStatusReq) XXX_Size() int

func (*ReportStatusReq) XXX_Unmarshal

func (m *ReportStatusReq) XXX_Unmarshal(b []byte) error

type S1ServiceClient

type S1ServiceClient interface {
	// agent-initiated unidirectional services
	SignUp(ctx context.Context, in *SignUpReq, opts ...grpc.CallOption) (*SignUpRsp, error)
	SignIn(ctx context.Context, in *SignInReq, opts ...grpc.CallOption) (*SignInRsp, error)
	SignOut(ctx context.Context, in *SignOutReq, opts ...grpc.CallOption) (*SignOutRsp, error)
	Report(ctx context.Context, in *ReportStatusReq, opts ...grpc.CallOption) (*empty.Empty, error)
	Config(ctx context.Context, in *GetConfigReq, opts ...grpc.CallOption) (*GetConfigRsp, error)
	// agent-initiated bidirectional service
	StreamTransfer(ctx context.Context, opts ...grpc.CallOption) (S1Service_StreamTransferClient, error)
}

S1ServiceClient is the client API for S1Service service.

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

func NewS1ServiceClient

func NewS1ServiceClient(cc grpc.ClientConnInterface) S1ServiceClient

type S1ServiceServer

type S1ServiceServer interface {
	// agent-initiated unidirectional services
	SignUp(context.Context, *SignUpReq) (*SignUpRsp, error)
	SignIn(context.Context, *SignInReq) (*SignInRsp, error)
	SignOut(context.Context, *SignOutReq) (*SignOutRsp, error)
	Report(context.Context, *ReportStatusReq) (*empty.Empty, error)
	Config(context.Context, *GetConfigReq) (*GetConfigRsp, error)
	// agent-initiated bidirectional service
	StreamTransfer(S1Service_StreamTransferServer) error
}

S1ServiceServer is the server API for S1Service service.

type S1Service_StreamTransferClient

type S1Service_StreamTransferClient interface {
	Send(*StreamMessage) error
	Recv() (*StreamMessage, error)
	grpc.ClientStream
}

type S1Service_StreamTransferServer

type S1Service_StreamTransferServer interface {
	Send(*StreamMessage) error
	Recv() (*StreamMessage, error)
	grpc.ServerStream
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server models node of the server side. Based on grpc and protocol buffer v3, we define the s1 interface procedures.

func NewServer

func NewServer(endpoint string, opts ...ServerOption) *Server

NewServer creates a node server with the given endpoint and other options.

func (*Server) HandleConn

func (s *Server) HandleConn(ctx context.Context, connStats stats.ConnStats)

HandleConn handles creation and deletion of connection sessions (phase I), using the session key prepared by TagConn callback.

func (*Server) HandleRPC

func (s *Server) HandleRPC(ctx context.Context, stats stats.RPCStats)

HandleRPC processes the RPC stats.

func (*Server) Notify

func (s *Server) Notify(join string, data []byte) error

func (*Server) Start

func (s *Server) Start() error

Start starts the node server and blocks till stopped.

func (*Server) Stop

func (s *Server) Stop(graceful bool)

Stop stops the server, and blocks until all the pending RPCs are finished if graceful is true, otherwise stops immediately by cancelling the pending RPCs.

func (*Server) TagConn

func (s *Server) TagConn(ctx context.Context, connTag *stats.ConnTagInfo) context.Context

TagConn prepares a key, using the underlying *stats.ConnTagInfo, for a new session.

func (*Server) TagRPC

func (s *Server) TagRPC(ctx context.Context, tag *stats.RPCTagInfo) context.Context

TagRPC can attach some information to the given context. The context used for the rest lifetime of the RPC will be derived from the returned context.

type ServerConfManager

type ServerConfManager interface {
	GetNode(id string) *Node
	SaveNode(n *Node) error
}

ServerConfManager defines config operations for node on server side.

func NewServerConfManager

func NewServerConfManager(path string) ServerConfManager

NewServerConfManager creates a ServerConfManager using the given path as the conf.db file

type ServerOption

type ServerOption func(agent *Server)

ServerOption func-closure pattern

func WithClusterMode

func WithClusterMode(ep string, peers []string) ServerOption

WithClusterMode enables a server to be in cluster mode using ep as the raft protocol listen address, and the given peers containing addresses of the initial raft seed nodes.

func WithServerHooks

func WithServerHooks(cbs ServerSideHooks) ServerOption

WithServerHooks defines server side hooks of a client.

type ServerProto

type ServerProto struct {
	// contains filtered or unexported fields
}

ServerProto defines the process and function entity of server side of the S1 interface.

func NewServerProto

func NewServerProto(upper *Server) *ServerProto

NewServerProto creates server protocol impl.

func (*ServerProto) Config

func (s *ServerProto) Config(ctx context.Context, req *GetConfigReq) (*GetConfigRsp, error)

Config provides a configuration request rpc method

func (*ServerProto) Report

func (s *ServerProto) Report(ctx context.Context, req *ReportStatusReq) (*empty.Empty, error)

Report provides a report status request rpc method

func (*ServerProto) SignIn

func (s *ServerProto) SignIn(ctx context.Context, req *SignInReq) (*SignInRsp, error)

SignIn handles node signing in.

func (*ServerProto) SignOut

func (s *ServerProto) SignOut(ctx context.Context, req *SignOutReq) (*SignOutRsp, error)

SignOut if session exists, otherwise do nothing and assume success

func (*ServerProto) SignUp

func (s *ServerProto) SignUp(ctx context.Context, req *SignUpReq) (*SignUpRsp, error)

SignUp assigns new id to the client if not exists yet.

func (*ServerProto) StreamTransfer

func (s *ServerProto) StreamTransfer(server S1Service_StreamTransferServer) error

StreamTransfer runs in a poll pattern to recv from stream

and handles agent-initiated bidirectional service.

type ServerSideCallback

type ServerSideCallback func(*Node)

ServerSideCallback defines the callback used by hooks.

type ServerSideHooks

type ServerSideHooks struct {
	//called when a certain node is successfully authed
	OnNodeJoin ServerSideCallback

	//called when stream message received
	OnNodeNasMsg func(*StreamMessage)

	//called when a certain node checked out
	OnNodeLeave ServerSideCallback
}

ServerSideHooks defines callbacks exposed on server side.

type SignInReq

type SignInReq struct {
	SoftwareVersion      string         `protobuf:"bytes,1,opt,name=softwareVersion,proto3" json:"softwareVersion,omitempty"`
	ProtocolVersion      string         `protobuf:"bytes,2,opt,name=protocolVersion,proto3" json:"protocolVersion,omitempty"`
	Ipv4Address          string         `protobuf:"bytes,3,opt,name=ipv4Address,proto3" json:"ipv4Address,omitempty"`
	DeviceInfo           *DeviceInfo    `protobuf:"bytes,11,opt,name=deviceInfo,proto3" json:"deviceInfo,omitempty"`
	Utilization          *Utilization   `protobuf:"bytes,12,opt,name=utilization,proto3" json:"utilization,omitempty"`
	VersionInfo          *VersionInfo   `protobuf:"bytes,13,opt,name=versionInfo,proto3" json:"versionInfo,omitempty"`
	ParameterInfo        *ParameterInfo `protobuf:"bytes,14,opt,name=parameterInfo,proto3" json:"parameterInfo,omitempty"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

pdu for sign in

func (*SignInReq) Descriptor

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

func (*SignInReq) GetDeviceInfo

func (m *SignInReq) GetDeviceInfo() *DeviceInfo

func (*SignInReq) GetIpv4Address

func (m *SignInReq) GetIpv4Address() string

func (*SignInReq) GetParameterInfo

func (m *SignInReq) GetParameterInfo() *ParameterInfo

func (*SignInReq) GetProtocolVersion

func (m *SignInReq) GetProtocolVersion() string

func (*SignInReq) GetSoftwareVersion

func (m *SignInReq) GetSoftwareVersion() string

func (*SignInReq) GetUtilization

func (m *SignInReq) GetUtilization() *Utilization

func (*SignInReq) GetVersionInfo

func (m *SignInReq) GetVersionInfo() *VersionInfo

func (*SignInReq) ProtoMessage

func (*SignInReq) ProtoMessage()

func (*SignInReq) Reset

func (m *SignInReq) Reset()

func (*SignInReq) String

func (m *SignInReq) String() string

func (*SignInReq) XXX_DiscardUnknown

func (m *SignInReq) XXX_DiscardUnknown()

func (*SignInReq) XXX_Marshal

func (m *SignInReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SignInReq) XXX_Merge

func (m *SignInReq) XXX_Merge(src proto.Message)

func (*SignInReq) XXX_Size

func (m *SignInReq) XXX_Size() int

func (*SignInReq) XXX_Unmarshal

func (m *SignInReq) XXX_Unmarshal(b []byte) error

type SignInRsp

type SignInRsp struct {
	ParameterInfo        *ParameterInfo `protobuf:"bytes,1,opt,name=parameterInfo,proto3" json:"parameterInfo,omitempty"`
	UpgradeInfo          *UpgradeInfo   `protobuf:"bytes,2,opt,name=upgradeInfo,proto3" json:"upgradeInfo,omitempty"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

func (*SignInRsp) Descriptor

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

func (*SignInRsp) GetParameterInfo

func (m *SignInRsp) GetParameterInfo() *ParameterInfo

func (*SignInRsp) GetUpgradeInfo

func (m *SignInRsp) GetUpgradeInfo() *UpgradeInfo

func (*SignInRsp) ProtoMessage

func (*SignInRsp) ProtoMessage()

func (*SignInRsp) Reset

func (m *SignInRsp) Reset()

func (*SignInRsp) String

func (m *SignInRsp) String() string

func (*SignInRsp) XXX_DiscardUnknown

func (m *SignInRsp) XXX_DiscardUnknown()

func (*SignInRsp) XXX_Marshal

func (m *SignInRsp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SignInRsp) XXX_Merge

func (m *SignInRsp) XXX_Merge(src proto.Message)

func (*SignInRsp) XXX_Size

func (m *SignInRsp) XXX_Size() int

func (*SignInRsp) XXX_Unmarshal

func (m *SignInRsp) XXX_Unmarshal(b []byte) error

type SignOutReq

type SignOutReq struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SignOutReq) Descriptor

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

func (*SignOutReq) ProtoMessage

func (*SignOutReq) ProtoMessage()

func (*SignOutReq) Reset

func (m *SignOutReq) Reset()

func (*SignOutReq) String

func (m *SignOutReq) String() string

func (*SignOutReq) XXX_DiscardUnknown

func (m *SignOutReq) XXX_DiscardUnknown()

func (*SignOutReq) XXX_Marshal

func (m *SignOutReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SignOutReq) XXX_Merge

func (m *SignOutReq) XXX_Merge(src proto.Message)

func (*SignOutReq) XXX_Size

func (m *SignOutReq) XXX_Size() int

func (*SignOutReq) XXX_Unmarshal

func (m *SignOutReq) XXX_Unmarshal(b []byte) error

type SignOutRsp

type SignOutRsp struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SignOutRsp) Descriptor

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

func (*SignOutRsp) ProtoMessage

func (*SignOutRsp) ProtoMessage()

func (*SignOutRsp) Reset

func (m *SignOutRsp) Reset()

func (*SignOutRsp) String

func (m *SignOutRsp) String() string

func (*SignOutRsp) XXX_DiscardUnknown

func (m *SignOutRsp) XXX_DiscardUnknown()

func (*SignOutRsp) XXX_Marshal

func (m *SignOutRsp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SignOutRsp) XXX_Merge

func (m *SignOutRsp) XXX_Merge(src proto.Message)

func (*SignOutRsp) XXX_Size

func (m *SignOutRsp) XXX_Size() int

func (*SignOutRsp) XXX_Unmarshal

func (m *SignOutRsp) XXX_Unmarshal(b []byte) error

type SignUpReq

type SignUpReq struct {
	Alg                  uint32   `protobuf:"varint,1,opt,name=alg,proto3" json:"alg,omitempty"`
	Hid                  string   `protobuf:"bytes,2,opt,name=hid,proto3" json:"hid,omitempty"`
	Key                  string   `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
	Timestamp            uint64   `protobuf:"fixed64,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SignUpReq) Descriptor

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

func (*SignUpReq) GetAlg

func (m *SignUpReq) GetAlg() uint32

func (*SignUpReq) GetHid

func (m *SignUpReq) GetHid() string

func (*SignUpReq) GetKey

func (m *SignUpReq) GetKey() string

func (*SignUpReq) GetTimestamp

func (m *SignUpReq) GetTimestamp() uint64

func (*SignUpReq) ProtoMessage

func (*SignUpReq) ProtoMessage()

func (*SignUpReq) Reset

func (m *SignUpReq) Reset()

func (*SignUpReq) String

func (m *SignUpReq) String() string

func (*SignUpReq) XXX_DiscardUnknown

func (m *SignUpReq) XXX_DiscardUnknown()

func (*SignUpReq) XXX_Marshal

func (m *SignUpReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SignUpReq) XXX_Merge

func (m *SignUpReq) XXX_Merge(src proto.Message)

func (*SignUpReq) XXX_Size

func (m *SignUpReq) XXX_Size() int

func (*SignUpReq) XXX_Unmarshal

func (m *SignUpReq) XXX_Unmarshal(b []byte) error

type SignUpRsp

type SignUpRsp struct {
	Alg                  uint32   `protobuf:"varint,1,opt,name=alg,proto3" json:"alg,omitempty"`
	Id                   string   `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	Key                  string   `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
	Expire               uint64   `protobuf:"fixed64,4,opt,name=expire,proto3" json:"expire,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SignUpRsp) Descriptor

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

func (*SignUpRsp) GetAlg

func (m *SignUpRsp) GetAlg() uint32

func (*SignUpRsp) GetExpire

func (m *SignUpRsp) GetExpire() uint64

func (*SignUpRsp) GetId

func (m *SignUpRsp) GetId() string

func (*SignUpRsp) GetKey

func (m *SignUpRsp) GetKey() string

func (*SignUpRsp) ProtoMessage

func (*SignUpRsp) ProtoMessage()

func (*SignUpRsp) Reset

func (m *SignUpRsp) Reset()

func (*SignUpRsp) String

func (m *SignUpRsp) String() string

func (*SignUpRsp) XXX_DiscardUnknown

func (m *SignUpRsp) XXX_DiscardUnknown()

func (*SignUpRsp) XXX_Marshal

func (m *SignUpRsp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SignUpRsp) XXX_Merge

func (m *SignUpRsp) XXX_Merge(src proto.Message)

func (*SignUpRsp) XXX_Size

func (m *SignUpRsp) XXX_Size() int

func (*SignUpRsp) XXX_Unmarshal

func (m *SignUpRsp) XXX_Unmarshal(b []byte) error

type State

type State struct {
	//latest term server has seen (initialized to 0
	//on first boot, increases monotonically)
	CurrentTerm uint64 `json:"currentTerm"`

	//candidateId that received vote in current
	//term (or null if none)
	VotedFor string `json:"votedFor"`

	//log entries; each entry contains command
	//for state machine, and term when entry
	//was received by leader (first index is 1)
	Log []interface{} `json:"log"`

	//index of highest log entry known to be
	//committed (initialized to 0, increases monotonically)
	CommitIndex uint64 `json:"commitIndex"`

	//index of highest log entry applied to state
	//machine (initialized to 0, increases monotonically)
	LastApplied uint64 `json:"lastApplied"`

	//for each server, index of the next log entry
	//to send to that server (initialized to leader last log index + 1)
	NextIndex []uint64 `json:"nextIndex"`

	//for each server, index of highest log entry
	//	known to be replicated on server
	//(initialized to 0, increases monotonically)
	MatchIndex []uint64 `json:"matchIndex"`
}

State includes:

persistent state on all servers,
volatile state on all servers, and
volatile state on leaders (which will be reinitialized after election).

type StreamMessage

type StreamMessage struct {
	Proc                 Procedure `protobuf:"varint,1,opt,name=proc,proto3,enum=node.Procedure" json:"proc,omitempty"`
	Code                 ErrorCode `protobuf:"varint,2,opt,name=code,proto3,enum=node.ErrorCode" json:"code,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

func (*StreamMessage) Descriptor

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

func (*StreamMessage) GetCode

func (m *StreamMessage) GetCode() ErrorCode

func (*StreamMessage) GetProc

func (m *StreamMessage) GetProc() Procedure

func (*StreamMessage) ProtoMessage

func (*StreamMessage) ProtoMessage()

func (*StreamMessage) Reset

func (m *StreamMessage) Reset()

func (*StreamMessage) String

func (m *StreamMessage) String() string

func (*StreamMessage) XXX_DiscardUnknown

func (m *StreamMessage) XXX_DiscardUnknown()

func (*StreamMessage) XXX_Marshal

func (m *StreamMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StreamMessage) XXX_Merge

func (m *StreamMessage) XXX_Merge(src proto.Message)

func (*StreamMessage) XXX_Size

func (m *StreamMessage) XXX_Size() int

func (*StreamMessage) XXX_Unmarshal

func (m *StreamMessage) XXX_Unmarshal(b []byte) error

type UnimplementedS1ServiceServer

type UnimplementedS1ServiceServer struct {
}

UnimplementedS1ServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedS1ServiceServer) Config

func (*UnimplementedS1ServiceServer) Report

func (*UnimplementedS1ServiceServer) SignIn

func (*UnimplementedS1ServiceServer) SignOut

func (*UnimplementedS1ServiceServer) SignUp

func (*UnimplementedS1ServiceServer) StreamTransfer

type UpgradeInfo

type UpgradeInfo struct {
	// module name - url/endpoint
	Endpoints            map[string]string `` /* 159-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

func (*UpgradeInfo) Descriptor

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

func (*UpgradeInfo) GetEndpoints

func (m *UpgradeInfo) GetEndpoints() map[string]string

func (*UpgradeInfo) ProtoMessage

func (*UpgradeInfo) ProtoMessage()

func (*UpgradeInfo) Reset

func (m *UpgradeInfo) Reset()

func (*UpgradeInfo) String

func (m *UpgradeInfo) String() string

func (*UpgradeInfo) XXX_DiscardUnknown

func (m *UpgradeInfo) XXX_DiscardUnknown()

func (*UpgradeInfo) XXX_Marshal

func (m *UpgradeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UpgradeInfo) XXX_Merge

func (m *UpgradeInfo) XXX_Merge(src proto.Message)

func (*UpgradeInfo) XXX_Size

func (m *UpgradeInfo) XXX_Size() int

func (*UpgradeInfo) XXX_Unmarshal

func (m *UpgradeInfo) XXX_Unmarshal(b []byte) error

type UpgradeNotice

type UpgradeNotice struct {
	ParameterInfo        *ParameterInfo `protobuf:"bytes,1,opt,name=parameterInfo,proto3" json:"parameterInfo,omitempty"`
	UpgradeInfo          *UpgradeInfo   `protobuf:"bytes,2,opt,name=upgradeInfo,proto3" json:"upgradeInfo,omitempty"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

func (*UpgradeNotice) Descriptor

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

func (*UpgradeNotice) GetParameterInfo

func (m *UpgradeNotice) GetParameterInfo() *ParameterInfo

func (*UpgradeNotice) GetUpgradeInfo

func (m *UpgradeNotice) GetUpgradeInfo() *UpgradeInfo

func (*UpgradeNotice) ProtoMessage

func (*UpgradeNotice) ProtoMessage()

func (*UpgradeNotice) Reset

func (m *UpgradeNotice) Reset()

func (*UpgradeNotice) String

func (m *UpgradeNotice) String() string

func (*UpgradeNotice) XXX_DiscardUnknown

func (m *UpgradeNotice) XXX_DiscardUnknown()

func (*UpgradeNotice) XXX_Marshal

func (m *UpgradeNotice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UpgradeNotice) XXX_Merge

func (m *UpgradeNotice) XXX_Merge(src proto.Message)

func (*UpgradeNotice) XXX_Size

func (m *UpgradeNotice) XXX_Size() int

func (*UpgradeNotice) XXX_Unmarshal

func (m *UpgradeNotice) XXX_Unmarshal(b []byte) error

type Utilization

type Utilization struct {
	CpuRate              uint32   `protobuf:"varint,1,opt,name=cpuRate,proto3" json:"cpuRate,omitempty"`
	MemRate              uint32   `protobuf:"varint,2,opt,name=memRate,proto3" json:"memRate,omitempty"`
	StorageRate          uint32   `protobuf:"varint,3,opt,name=storageRate,proto3" json:"storageRate,omitempty"`
	DiskReadRate         float32  `protobuf:"fixed32,4,opt,name=diskReadRate,proto3" json:"diskReadRate,omitempty"`
	DiskWrtnRate         float32  `protobuf:"fixed32,5,opt,name=diskWrtnRate,proto3" json:"diskWrtnRate,omitempty"`
	NetReadRate          float32  `protobuf:"fixed32,6,opt,name=netReadRate,proto3" json:"netReadRate,omitempty"`
	NetWrtnRate          float32  `protobuf:"fixed32,7,opt,name=netWrtnRate,proto3" json:"netWrtnRate,omitempty"`
	NetworkDelay         uint32   `protobuf:"varint,8,opt,name=networkDelay,proto3" json:"networkDelay,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Utilization) Descriptor

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

func (*Utilization) GetCpuRate

func (m *Utilization) GetCpuRate() uint32

func (*Utilization) GetDiskReadRate

func (m *Utilization) GetDiskReadRate() float32

func (*Utilization) GetDiskWrtnRate

func (m *Utilization) GetDiskWrtnRate() float32

func (*Utilization) GetMemRate

func (m *Utilization) GetMemRate() uint32

func (*Utilization) GetNetReadRate

func (m *Utilization) GetNetReadRate() float32

func (*Utilization) GetNetWrtnRate

func (m *Utilization) GetNetWrtnRate() float32

func (*Utilization) GetNetworkDelay

func (m *Utilization) GetNetworkDelay() uint32

func (*Utilization) GetStorageRate

func (m *Utilization) GetStorageRate() uint32

func (*Utilization) ProtoMessage

func (*Utilization) ProtoMessage()

func (*Utilization) Reset

func (m *Utilization) Reset()

func (*Utilization) String

func (m *Utilization) String() string

func (*Utilization) XXX_DiscardUnknown

func (m *Utilization) XXX_DiscardUnknown()

func (*Utilization) XXX_Marshal

func (m *Utilization) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Utilization) XXX_Merge

func (m *Utilization) XXX_Merge(src proto.Message)

func (*Utilization) XXX_Size

func (m *Utilization) XXX_Size() int

func (*Utilization) XXX_Unmarshal

func (m *Utilization) XXX_Unmarshal(b []byte) error

type VersionInfo

type VersionInfo struct {
	// module name - version
	Versions             map[string]string `` /* 157-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

func (*VersionInfo) Descriptor

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

func (*VersionInfo) GetVersions

func (m *VersionInfo) GetVersions() map[string]string

func (*VersionInfo) ProtoMessage

func (*VersionInfo) ProtoMessage()

func (*VersionInfo) Reset

func (m *VersionInfo) Reset()

func (*VersionInfo) String

func (m *VersionInfo) String() string

func (*VersionInfo) XXX_DiscardUnknown

func (m *VersionInfo) XXX_DiscardUnknown()

func (*VersionInfo) XXX_Marshal

func (m *VersionInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*VersionInfo) XXX_Merge

func (m *VersionInfo) XXX_Merge(src proto.Message)

func (*VersionInfo) XXX_Size

func (m *VersionInfo) XXX_Size() int

func (*VersionInfo) XXX_Unmarshal

func (m *VersionInfo) XXX_Unmarshal(b []byte) error

type VoteReq

type VoteReq struct {
	Term         uint64 `json:"term"`         //candidate’s term
	CandidateID  string `json:"candidateId"`  //candidate id requesting vote
	LastLogIndex uint64 `json:"lastLogIndex"` //index of candidate’s last log entry (§5.4)
	LastLogTerm  uint64 `json:"lastLogTerm"`  //term of candidate’s last log entry (§5.4)
}

VoteReq defines request of raft AppendEntries Method, and is invoked by candidates to gather votes (§5.2).

type VoteRsp

type VoteRsp struct {
	Term        uint64 `json:"term"`        //currentTerm, for candidate to update itself
	VoteGranted bool   `json:"voteGranted"` //true means candidate received vote
}

VoteRsp defines response of raft RequestVote Method.

Jump to

Keyboard shortcuts

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