Record Class Envelope
java.lang.Object
java.lang.Record
ai.badmonkey.agentspaces.peering.wire.Envelope
- Record Components:
ver- protocol version;WireCodec.WIRE_VERSION(2) is the only version receivers accept (spec §9)group- the group the frame belongs to; receivers ignore frames for groups they are not members ofkind- the frame kindfrom- the sending peerto- the intended recipient, ornullwhen unaddressedstamp- the sender's HLC stamp; receivers merge it into their clocksbody- kind-specific CBOR payload
public record Envelope(int ver, GroupId group, Envelope.Kind kind, PeerId from, PeerId to, HlcTimestamp stamp, byte[] body)
extends Record
The wire envelope (spec §9): every frame between peers is a CBOR-encoded,
signed envelope. The body is an opaque CBOR payload whose shape depends on the
Envelope.Kind.
The to field binds an addressed frame to its intended recipient (a
signed component, ASF-010): a receiver drops a frame whose to is set
and is not this peer, so a captured frame cannot be redirected to, or replayed
at, a peer it was never sent to. to is null on a genuinely
unaddressed frame — the bootstrap self-introduction to a seed whose PeerID is
not yet known — and such frames get no destination protection (they carry only
a signed, idempotent self-advertisement).
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionEnvelope(int ver, GroupId group, Envelope.Kind kind, PeerId from, PeerId to, HlcTimestamp stamp, byte[] body) Creates an instance of aEnveloperecord class. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]body()Returns the value of thebodyrecord component.final booleanIndicates whether some other object is "equal to" this one.from()Returns the value of thefromrecord component.group()Returns the value of thegrouprecord component.final inthashCode()Returns a hash code value for this object.kind()Returns the value of thekindrecord component.stamp()Returns the value of thestamprecord component.to()Returns the value of thetorecord component.final StringtoString()Returns a string representation of this record class.intver()Returns the value of theverrecord component.
-
Constructor Details
-
Envelope
public Envelope(int ver, GroupId group, Envelope.Kind kind, PeerId from, PeerId to, HlcTimestamp stamp, byte[] body) Creates an instance of aEnveloperecord class.- Parameters:
ver- the value for theverrecord componentgroup- the value for thegrouprecord componentkind- the value for thekindrecord componentfrom- the value for thefromrecord componentto- the value for thetorecord componentstamp- the value for thestamprecord componentbody- the value for thebodyrecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
ver
-
group
-
kind
-
from
-
to
-
stamp
-
body
-