wire

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MaxLANListeners = 8
View Source
const MaxSnapshotBytes = 16 * protocol.MAX_FRAME_BYTES

MaxSnapshotBytes bounds what a receiver buffers for one paged snapshot or directory: 256 pages, twice the protocol's largest single payload (MAX_CHANGE_BYTES).

View Source
const NodeALPN = "sailry/node/1"
View Source
const PageBytes = protocol.MAX_FRAME_BYTES / 16
View Source
const PairALPN = "sailry/pair/1"

Variables

This section is empty.

Functions

func Read

func Read(stream io.Reader, value any, compressed bool) error

func ReadLimited

func ReadLimited(stream io.Reader, value any, maximum int) error

func Write

func Write(stream io.Writer, value any, compressed bool) error

func WriteReply

func WriteReply(reply Reply, write func(Reply) error) error

WriteReply passes the reply itself, or a header and bounded pages. A snapshot or large resource directory can outlast one frame deadline.

Types

type Assembly

type Assembly struct {
	// contains filtered or unexported fields
}

func (*Assembly) Accept

func (assembly *Assembly) Accept(reply Reply) (*Reply, error)

type Call

type Call struct {
	Kind            CallKind
	Stream          *protocol.StreamID
	Request         *protocol.Request
	Topic           *protocol.Topic
	Resource        *protocol.ResourceCall
	ScopedKnowledge *protocol.ScopedKnowledgeCall
}

func (*Call) DecodeJSON

func (call *Call) DecodeJSON(decoder *protocol.Decoder) error

func (Call) MarshalJSON

func (call Call) MarshalJSON() ([]byte, error)

func (*Call) UnmarshalJSON

func (call *Call) UnmarshalJSON(data []byte) error

type CallKind

type CallKind string
const (
	CallInspect         CallKind = "inspect"
	CallOpenStream      CallKind = "open_stream"
	CallCommand         CallKind = "command"
	CallSubscribe       CallKind = "subscribe"
	CallResource        CallKind = "resource"
	CallScopedKnowledge CallKind = "scoped_knowledge"
)

type Delivery

type Delivery string
const (
	DeliveryCompleted Delivery = "completed"
	DeliveryUpdate    Delivery = "update"
)

func (*Delivery) UnmarshalJSON

func (delivery *Delivery) UnmarshalJSON(data []byte) error

type Endpoint

type Endpoint struct {
	SoftwareVersion *string      `json:"software_version"`
	Protocol        *uint16      `json:"protocol"`
	Zstd            bool         `json:"zstd"`
	Execution       bool         `json:"execution"`
	Name            *string      `json:"name"`
	Platform        string       `json:"platform"`
	HasNode         *bool        `json:"has_node,omitempty"`
	LANListeners    lanListeners `json:"lan_listeners,omitempty"`
}

func (*Endpoint) UnmarshalJSON

func (endpoint *Endpoint) UnmarshalJSON(data []byte) error

type Envelope

type Envelope struct {
	SoftwareVersion *string
	Protocol        *uint16
	Zstd            bool
	Call            Call
	HasNode         *bool
	Target          *protocol.NodeID
	// RawData preserves a relayed business payload, including peer fields this
	// build does not know. Only transport metadata is rewritten at the next hop.
	RawData json.RawMessage
	// Undecoded is set by decoding alone: the identifier of a command request
	// whose version, identifier and target decoded and whose command did not,
	// because this build does not declare its kind or cannot read its
	// payload. Call is then a command without a Request. The receiver can
	// answer such a request on its stream; it cannot run it.
	Undecoded *protocol.RequestID
}

func (Envelope) MarshalJSON

func (envelope Envelope) MarshalJSON() ([]byte, error)

func (*Envelope) UnmarshalJSON

func (envelope *Envelope) UnmarshalJSON(data []byte) error

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

func NewReader

func NewReader(compressed bool) *Reader

func (*Reader) Raw

func (reader *Reader) Raw(stream io.Reader) (json.RawMessage, error)

Raw reads one bounded JSON frame without interpreting its business content. Relays use this to preserve unknown peer fields and snapshot page boundaries.

func (*Reader) Read

func (reader *Reader) Read(stream io.Reader, value any) error

func (*Reader) Reply

func (reader *Reader) Reply(stream io.Reader) (Reply, error)

type Reply

type Reply struct {
	Kind          ReplyKind
	Endpoint      *Endpoint
	Receipt       *protocol.Receipt
	Rejected      *protocol.Fault
	Completed     *Response
	Update        *protocol.Update
	SnapshotStart *SnapshotHeader
	SnapshotPage  *SnapshotPage
}

func (Reply) MarshalJSON

func (reply Reply) MarshalJSON() ([]byte, error)

func (*Reply) UnmarshalJSON

func (reply *Reply) UnmarshalJSON(data []byte) error

type ReplyKind

type ReplyKind string
const (
	ReplyEndpoint      ReplyKind = "endpoint"
	ReplyStreamOpened  ReplyKind = "stream_opened"
	ReplySubscribed    ReplyKind = "subscribed"
	ReplyReceipt       ReplyKind = "receipt"
	ReplyRejected      ReplyKind = "rejected"
	ReplyCompleted     ReplyKind = "completed"
	ReplyUpdate        ReplyKind = "update"
	ReplySnapshotStart ReplyKind = "snapshot_start"
	ReplySnapshotPage  ReplyKind = "snapshot_page"
)

type Response

type Response struct {
	Output *protocol.Output
	Fault  *protocol.Fault
}

func (Response) MarshalJSON

func (response Response) MarshalJSON() ([]byte, error)

func (*Response) UnmarshalJSON

func (response *Response) UnmarshalJSON(data []byte) error

type SnapshotHeader

type SnapshotHeader struct {
	Delivery Delivery        `json:"delivery"`
	Node     protocol.NodeID `json:"node"`
	Cursor   uint64          `json:"cursor"`
	Bytes    uint64          `json:"bytes"`
	Output   string          `json:"output,omitempty"`
}

func (*SnapshotHeader) UnmarshalJSON

func (header *SnapshotHeader) UnmarshalJSON(data []byte) error

type SnapshotPage

type SnapshotPage struct {
	Index uint64 `json:"index"`
	Data  string `json:"data"`
}

func (*SnapshotPage) UnmarshalJSON

func (page *SnapshotPage) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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