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 ¶
- type AddNodeRequest
- type AddNodeResponse
- type AttachPeerRequest
- type AttachPeerResponse
- type AttachedPeerInfo
- type ChainInfo
- type ClusterInfo
- type Decoder
- type Encoder
- type HealthRequest
- type HealthResponse
- type NodeInfo
- type PauseNodeRequest
- type PauseNodeResponse
- type PingRequest
- type PingResponse
- type RPCVersionRequest
- type RPCVersionResponse
- type RemoveNodeRequest
- type RemoveNodeResponse
- type RestartNodeRequest
- type RestartNodeResponse
- type ResumeNodeRequest
- type ResumeNodeResponse
- type SendOutboundMessageRequest
- type SendOutboundMessageResponse
- type StatusRequest
- type StatusResponse
- type StopRequest
- type StopResponse
- type URIsRequest
- type URIsResponse
- type WaitForHealthyRequest
- type WaitForHealthyResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddNodeRequest ¶ added in v1.17.0
type AddNodeRequest struct {
Name string
ExecPath string
NodeConfig string // optional: present iff NodeConfigSet is true
NodeConfigSet bool
ChainConfigs map[string]string
UpgradeConfigs map[string]string
ChainConfigFiles map[string]string
PluginDir string
}
AddNodeRequest matches rpcpb.AddNodeRequest field-for-field.
func (*AddNodeRequest) Decode ¶ added in v1.17.0
func (a *AddNodeRequest) Decode(r *zap.Reader) error
func (*AddNodeRequest) Encode ¶ added in v1.17.0
func (a *AddNodeRequest) Encode(b *zap.Buffer)
type AddNodeResponse ¶ added in v1.17.0
type AddNodeResponse struct {
ClusterInfo *ClusterInfo
}
AddNodeResponse carries the post-add cluster snapshot.
func (*AddNodeResponse) Decode ¶ added in v1.17.0
func (a *AddNodeResponse) Decode(r *zap.Reader) error
func (*AddNodeResponse) Encode ¶ added in v1.17.0
func (a *AddNodeResponse) Encode(b *zap.Buffer)
type AttachPeerRequest ¶ added in v1.17.0
type AttachPeerRequest struct {
NodeName string
}
AttachPeerRequest matches rpcpb.AttachPeerRequest.
func (*AttachPeerRequest) Decode ¶ added in v1.17.0
func (a *AttachPeerRequest) Decode(rd *zap.Reader) error
func (*AttachPeerRequest) Encode ¶ added in v1.17.0
func (a *AttachPeerRequest) Encode(b *zap.Buffer)
type AttachPeerResponse ¶ added in v1.17.0
type AttachPeerResponse struct {
ClusterInfo *ClusterInfo
AttachedPeerInfo *AttachedPeerInfo
}
AttachPeerResponse carries the post-attach cluster snapshot plus the new peer's identity.
func (*AttachPeerResponse) Decode ¶ added in v1.17.0
func (a *AttachPeerResponse) Decode(rd *zap.Reader) error
func (*AttachPeerResponse) Encode ¶ added in v1.17.0
func (a *AttachPeerResponse) Encode(b *zap.Buffer)
type AttachedPeerInfo ¶ added in v1.17.0
type AttachedPeerInfo struct {
ID string
}
AttachedPeerInfo matches rpcpb.AttachedPeerInfo.
func (*AttachedPeerInfo) Decode ¶ added in v1.17.0
func (a *AttachedPeerInfo) Decode(rd *zap.Reader) error
func (*AttachedPeerInfo) Encode ¶ added in v1.17.0
func (a *AttachedPeerInfo) Encode(b *zap.Buffer)
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 PauseNodeRequest ¶ added in v1.17.0
type PauseNodeRequest struct {
Name string
}
PauseNodeRequest matches rpcpb.PauseNodeRequest.
func (*PauseNodeRequest) Decode ¶ added in v1.17.0
func (p *PauseNodeRequest) Decode(rd *zap.Reader) error
func (*PauseNodeRequest) Encode ¶ added in v1.17.0
func (p *PauseNodeRequest) Encode(b *zap.Buffer)
type PauseNodeResponse ¶ added in v1.17.0
type PauseNodeResponse struct {
ClusterInfo *ClusterInfo
}
PauseNodeResponse carries the post-pause cluster snapshot.
func (*PauseNodeResponse) Decode ¶ added in v1.17.0
func (p *PauseNodeResponse) Decode(rd *zap.Reader) error
func (*PauseNodeResponse) Encode ¶ added in v1.17.0
func (p *PauseNodeResponse) Encode(b *zap.Buffer)
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 RemoveNodeRequest ¶ added in v1.17.0
type RemoveNodeRequest struct {
Name string
}
RemoveNodeRequest matches rpcpb.RemoveNodeRequest.
func (*RemoveNodeRequest) Decode ¶ added in v1.17.0
func (r *RemoveNodeRequest) Decode(rd *zap.Reader) error
func (*RemoveNodeRequest) Encode ¶ added in v1.17.0
func (r *RemoveNodeRequest) Encode(b *zap.Buffer)
type RemoveNodeResponse ¶ added in v1.17.0
type RemoveNodeResponse struct {
ClusterInfo *ClusterInfo
}
RemoveNodeResponse carries the post-remove cluster snapshot.
func (*RemoveNodeResponse) Decode ¶ added in v1.17.0
func (r *RemoveNodeResponse) Decode(rd *zap.Reader) error
func (*RemoveNodeResponse) Encode ¶ added in v1.17.0
func (r *RemoveNodeResponse) Encode(b *zap.Buffer)
type RestartNodeRequest ¶ added in v1.17.0
type RestartNodeRequest struct {
Name string
ExecPath string // optional
ExecPathSet bool
WhitelistedChains string // optional (legacy field)
WhitelistedChainsSet bool
ChainConfigs map[string]string
UpgradeConfigs map[string]string
ChainConfigFiles map[string]string
PluginDir string
}
RestartNodeRequest matches rpcpb.RestartNodeRequest.
func (*RestartNodeRequest) Decode ¶ added in v1.17.0
func (r *RestartNodeRequest) Decode(rd *zap.Reader) error
func (*RestartNodeRequest) Encode ¶ added in v1.17.0
func (r *RestartNodeRequest) Encode(b *zap.Buffer)
type RestartNodeResponse ¶ added in v1.17.0
type RestartNodeResponse struct {
ClusterInfo *ClusterInfo
}
RestartNodeResponse carries the post-restart cluster snapshot.
func (*RestartNodeResponse) Decode ¶ added in v1.17.0
func (r *RestartNodeResponse) Decode(rd *zap.Reader) error
func (*RestartNodeResponse) Encode ¶ added in v1.17.0
func (r *RestartNodeResponse) Encode(b *zap.Buffer)
type ResumeNodeRequest ¶ added in v1.17.0
type ResumeNodeRequest struct {
Name string
}
ResumeNodeRequest matches rpcpb.ResumeNodeRequest.
func (*ResumeNodeRequest) Decode ¶ added in v1.17.0
func (p *ResumeNodeRequest) Decode(rd *zap.Reader) error
func (*ResumeNodeRequest) Encode ¶ added in v1.17.0
func (p *ResumeNodeRequest) Encode(b *zap.Buffer)
type ResumeNodeResponse ¶ added in v1.17.0
type ResumeNodeResponse struct {
ClusterInfo *ClusterInfo
}
ResumeNodeResponse carries the post-resume cluster snapshot.
func (*ResumeNodeResponse) Decode ¶ added in v1.17.0
func (p *ResumeNodeResponse) Decode(rd *zap.Reader) error
func (*ResumeNodeResponse) Encode ¶ added in v1.17.0
func (p *ResumeNodeResponse) Encode(b *zap.Buffer)
type SendOutboundMessageRequest ¶ added in v1.17.0
SendOutboundMessageRequest matches rpcpb.SendOutboundMessageRequest. The proto field is named `bytes` (the AVM/p2p message body); we use MsgBody to avoid collision with the Go builtin.
func (*SendOutboundMessageRequest) Decode ¶ added in v1.17.0
func (s *SendOutboundMessageRequest) Decode(rd *zap.Reader) error
func (*SendOutboundMessageRequest) Encode ¶ added in v1.17.0
func (s *SendOutboundMessageRequest) Encode(b *zap.Buffer)
type SendOutboundMessageResponse ¶ added in v1.17.0
type SendOutboundMessageResponse struct {
Sent bool
}
SendOutboundMessageResponse matches rpcpb.SendOutboundMessageResponse.
func (*SendOutboundMessageResponse) Decode ¶ added in v1.17.0
func (s *SendOutboundMessageResponse) Decode(rd *zap.Reader) error
func (*SendOutboundMessageResponse) Encode ¶ added in v1.17.0
func (s *SendOutboundMessageResponse) 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 StopRequest ¶ added in v1.17.0
type StopRequest struct{}
StopRequest is empty.
func (*StopRequest) Encode ¶ added in v1.17.0
func (*StopRequest) Encode(b *zap.Buffer)
type StopResponse ¶ added in v1.17.0
type StopResponse struct {
ClusterInfo *ClusterInfo
}
StopResponse carries the final cluster snapshot before shutdown.
func (*StopResponse) Encode ¶ added in v1.17.0
func (s *StopResponse) 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)
type WaitForHealthyRequest ¶ added in v1.17.0
type WaitForHealthyRequest struct{}
WaitForHealthyRequest is empty (proto has an optional network_name field used only by the multi-network REST gateway shim; the native control protocol always operates on the single in-process network, so this field is omitted).
func (*WaitForHealthyRequest) Decode ¶ added in v1.17.0
func (*WaitForHealthyRequest) Decode(r *zap.Reader) error
func (*WaitForHealthyRequest) Encode ¶ added in v1.17.0
func (*WaitForHealthyRequest) Encode(b *zap.Buffer)
type WaitForHealthyResponse ¶ added in v1.17.0
type WaitForHealthyResponse struct {
ClusterInfo *ClusterInfo
}
WaitForHealthyResponse carries the cluster snapshot once all nodes report Healthy = true.
func (*WaitForHealthyResponse) Decode ¶ added in v1.17.0
func (w *WaitForHealthyResponse) Decode(r *zap.Reader) error
func (*WaitForHealthyResponse) Encode ¶ added in v1.17.0
func (w *WaitForHealthyResponse) Encode(b *zap.Buffer)