types

package
v1.18.4 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: BSD-3-Clause Imports: 1 Imported by: 0

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 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.

func (*ChainInfo) Decode

func (c *ChainInfo) Decode(r *zap.Reader) error

func (*ChainInfo) Encode

func (c *ChainInfo) Encode(b *zap.Buffer)

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) Decode

func (c *ClusterInfo) Decode(r *zap.Reader) error

func (*ClusterInfo) Encode

func (c *ClusterInfo) Encode(b *zap.Buffer)

type Decoder

type Decoder interface {
	Decode(r *zap.Reader) error
}

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

type Encoder interface {
	Encode(b *zap.Buffer)
}

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) Decode

func (*HealthRequest) Decode(r *zap.Reader) error

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) Decode

func (h *HealthResponse) Decode(r *zap.Reader) error

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.

func (*NodeInfo) Decode

func (n *NodeInfo) Decode(r *zap.Reader) error

func (*NodeInfo) Encode

func (n *NodeInfo) Encode(b *zap.Buffer)

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) Decode

func (*PingRequest) Decode(r *zap.Reader) error

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) Decode

func (p *PingResponse) Decode(r *zap.Reader) error

func (*PingResponse) Encode

func (p *PingResponse) Encode(b *zap.Buffer)

type RPCVersionRequest

type RPCVersionRequest struct{}

RPCVersionRequest is empty.

func (*RPCVersionRequest) Decode

func (*RPCVersionRequest) Decode(r *zap.Reader) error

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) Decode

func (r *RPCVersionResponse) Decode(rd *zap.Reader) error

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

type SendOutboundMessageRequest struct {
	NodeName string
	PeerID   string
	Op       uint32
	MsgBody  []byte
}

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 (*SendOutboundMessageResponse) Encode added in v1.17.0

func (s *SendOutboundMessageResponse) Encode(b *zap.Buffer)

type StatusRequest

type StatusRequest struct{}

StatusRequest is empty.

func (*StatusRequest) Decode

func (*StatusRequest) Decode(r *zap.Reader) error

func (*StatusRequest) Encode

func (*StatusRequest) Encode(b *zap.Buffer)

type StatusResponse

type StatusResponse struct {
	ClusterInfo *ClusterInfo
}

StatusResponse carries the full cluster snapshot.

func (*StatusResponse) Decode

func (s *StatusResponse) Decode(r *zap.Reader) error

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) Decode added in v1.17.0

func (*StopRequest) Decode(r *zap.Reader) error

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) Decode added in v1.17.0

func (s *StopResponse) Decode(r *zap.Reader) error

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) Decode

func (*URIsRequest) Decode(r *zap.Reader) error

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) Decode

func (u *URIsResponse) Decode(r *zap.Reader) error

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)

Jump to

Keyboard shortcuts

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