wire

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Header struct {
	Sender   PeerID
	Revision RevisionDescriptor
}

Header describes the following message.

type Hello

type Hello struct {
	PeerID   PeerID
	IsServer bool
	Requests []NamespaceRequest
}

Hello is the message exchanged between peers when connecting.

type Marshaller

type Marshaller struct {
}

Marshaller marshals and unmarshals messages.

func NewMarshaller

func NewMarshaller() Marshaller

NewMarshaller creates marshaller.

func (Marshaller) ApplyPatch

func (m Marshaller) ApplyPatch(msg any, buf []byte) (retSize uint64, retErr error)

ApplyPatch applies patch.

func (Marshaller) ID

func (m Marshaller) ID(msg any) (uint64, error)

ID returns ID of message type.

func (Marshaller) IsPatchNeeded added in v0.3.0

func (m Marshaller) IsPatchNeeded(msgDst, msgSrc any) (bool, error)

IsPatchNeeded checks if non-empty patch exists.

func (Marshaller) MakePatch

func (m Marshaller) MakePatch(msgDst, msgSrc any, buf []byte) (retID, retSize uint64, retErr error)

MakePatch creates a patch.

func (Marshaller) Marshal

func (m Marshaller) Marshal(msg any, buf []byte) (retID, retSize uint64, retErr error)

Marshal marshals message.

func (Marshaller) Messages

func (m Marshaller) Messages() []any

Messages returns list of the message types supported by marshaller.

func (Marshaller) Size

func (m Marshaller) Size(msg any) (uint64, error)

Size computes the size of marshalled message.

func (Marshaller) Unmarshal

func (m Marshaller) Unmarshal(id uint64, buf []byte) (retMsg any, retSize uint64, retErr error)

Unmarshal unmarshals message.

type MessageDescriptor

type MessageDescriptor struct {
	Namespace Namespace
	MessageID MessageID
}

MessageDescriptor uniquely identifies type of exchanged message.

type MessageID

type MessageID uint64

MessageID is the message ID returned from proton.

type Namespace

type Namespace string

Namespace defines namespace for messages.

type NamespaceRequest

type NamespaceRequest struct {
	Namespace  Namespace
	MessageIDs []MessageID
}

NamespaceRequest defines messages to receive.

type PeerID

type PeerID [32]byte

PeerID defines peer ID.

type Revision

type Revision uint64

Revision is the revision of the message used for deduplication.

type RevisionDescriptor

type RevisionDescriptor struct {
	Message MessageDescriptor
	Index   Revision
}

RevisionDescriptor uniquely identifies revision of message.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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