types

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 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 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 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 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 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)

Jump to

Keyboard shortcuts

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