Documentation
¶
Overview ¶
The node package contains data structures useful for representing information about nodes in a distributed system, as well as some utility functions for getting information about them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCurrentNodeId ¶
func GetCurrentNodeId(config NodesConfig) string
Determine which node ID we are
Types ¶
type Node ¶
type Node struct {
Id string `json:"id"`
Host string `json:"host"`
RestPort int32 `json:"rest_port"`
GrpcPort int32 `json:"grpc_port"`
HashId uint32
GrpcClient pb.CacheServiceClient
}
Node struct contains all info we need about a server node, as well as a gRPC client to interact with it
func GetRandomNode ¶
Get random node from a given list of nodes
func (*Node) SetGrpcClient ¶
func (n *Node) SetGrpcClient(c pb.CacheServiceClient)
type NodesConfig ¶
type NodesConfig struct {
Nodes map[string]*Node `json:"nodes"`
EnableClientAuth bool `json:"enable_client_auth"`
EnableHttps bool `json:"enable_https"`
ServerLogfile string `json:"server_logfile"`
ServerErrfile string `json:"server_errfile"`
ClientLogfile string `json:"client_logfile"`
ClientErrfile string `json:"client_errfile"`
}
NodesConfig struct holds info about all server nodes in the network
Click to show internal directories.
Click to hide internal directories.