Documentation
¶
Overview ¶
Package types defines the netrunner control RPC message types as hand-written Go structs. These replace the legacy rpcpb (protobuf- generated) types — there is no .proto, no codegen, no protobuf dependency. Each type owns its own ZAP encode/decode pair.
Style: every struct has no embedded interfaces, no pointers to primitives unless null-distinct semantics matter, and every field is JSON-serialisable so test fixtures can be written by hand.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainInfo ¶
type ChainInfo struct {
ChainName string
VMID string
VMName string
ChainID string
SubnetID string // P-Chain validator-set identifier — distinct from ChainID
Genesis []byte
}
ChainInfo is the per-chain payload inside ClusterInfo.
type ClusterInfo ¶
type ClusterInfo struct {
NodeNames []string
NodeInfos map[string]*NodeInfo // keyed by node name
PID int32
RootDataDir string
Healthy bool
CustomChains map[string]*ChainInfo // keyed by chain ID
Subnets []string // P-Chain validator sets
NetworkID uint32
}
ClusterInfo is the top-level cluster snapshot returned by Health, Status, and StreamStatus.
func (*ClusterInfo) Encode ¶
func (c *ClusterInfo) Encode(b *zap.Buffer)
type Decoder ¶
Decoder is implemented by every netrunner control message that comes off the wire. Decode reads the message from the reader and populates the receiver. The reader is positioned past the request ID and any sub-opcode byte before Decode is called.
type Encoder ¶
Encoder is implemented by every netrunner control message that goes over the wire. Encode appends the message bytes to the provided buffer. The 4-byte request ID is written by the transport layer before Encode is called; do not write it from inside Encode.
type HealthRequest ¶
type HealthRequest struct{}
HealthRequest is empty.
func (*HealthRequest) Encode ¶
func (*HealthRequest) Encode(b *zap.Buffer)
type HealthResponse ¶
type HealthResponse struct {
ClusterInfo *ClusterInfo // nil if no cluster yet
}
HealthResponse carries a snapshot of the cluster's health.
func (*HealthResponse) Encode ¶
func (h *HealthResponse) Encode(b *zap.Buffer)
type NodeInfo ¶
type NodeInfo struct {
Name string
ExecPath string
URI string
ID string
LogDir string
DBDir string
Config []byte
PluginDir string
WhitelistedSubnets string // legacy field name preserved for migration; rename pending
Paused bool
}
NodeInfo is the per-node payload inside ClusterInfo.
type PingRequest ¶
type PingRequest struct{}
PingRequest is empty; the wire payload is just the request ID.
func (*PingRequest) Encode ¶
func (*PingRequest) Encode(b *zap.Buffer)
type PingResponse ¶
type PingResponse struct {
PID int32
}
PingResponse carries the netrunner server's PID, used by clients to detect server identity changes (e.g. the daemon was restarted).
func (*PingResponse) Encode ¶
func (p *PingResponse) Encode(b *zap.Buffer)
type RPCVersionRequest ¶
type RPCVersionRequest struct{}
RPCVersionRequest is empty.
func (*RPCVersionRequest) Encode ¶
func (*RPCVersionRequest) Encode(b *zap.Buffer)
type RPCVersionResponse ¶
type RPCVersionResponse struct {
Version uint32
}
RPCVersionResponse carries the wire-protocol version. Bumped on breaking changes to the netrunner ZAP control protocol.
func (*RPCVersionResponse) Encode ¶
func (r *RPCVersionResponse) Encode(b *zap.Buffer)
type StatusRequest ¶
type StatusRequest struct{}
StatusRequest is empty.
func (*StatusRequest) Encode ¶
func (*StatusRequest) Encode(b *zap.Buffer)
type StatusResponse ¶
type StatusResponse struct {
ClusterInfo *ClusterInfo
}
StatusResponse carries the full cluster snapshot.
func (*StatusResponse) Encode ¶
func (s *StatusResponse) Encode(b *zap.Buffer)
type URIsRequest ¶
type URIsRequest struct{}
URIsRequest is empty.
func (*URIsRequest) Encode ¶
func (*URIsRequest) Encode(b *zap.Buffer)
type URIsResponse ¶
type URIsResponse struct {
URIs []string
}
URIsResponse carries the public RPC endpoints of every node in the running cluster.
func (*URIsResponse) Encode ¶
func (u *URIsResponse) Encode(b *zap.Buffer)