Documentation
¶
Overview ¶
Package rpc implements OMG DDS-RPC style request-reply over a DDS participant. A Requester sends typed requests and receives correlated replies. A Replier receives requests and sends replies. Both use two topics internally: <base>/request and <base>/reply.
Wire format: every payload is prefixed with a 16-byte CorrelationID so that the Requester can match replies to outstanding requests without any broker-level correlation support.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoReply = fmt.Errorf("rpc: no reply received")
ErrNoReply is returned by Requester.Request when the context expires before a correlated reply arrives.
Functions ¶
This section is empty.
Types ¶
type CorrelationID ¶
type CorrelationID [16]byte
CorrelationID is the 16-byte identifier embedded in every request and reply payload to match replies to outstanding requests.
type Replier ¶
type Replier[Req, Rep any] struct { // contains filtered or unexported fields }
Replier receives typed RPC requests and dispatches correlated replies. Create with NewReplier; call Close when done.
func NewReplier ¶
func NewReplier[Req, Rep any]( p dds.Participant, topic string, reqCodec dds.Codec[Req], repCodec dds.Codec[Rep], qos dds.QoS, ) (*Replier[Req, Rep], error)
NewReplier creates a Replier on the given participant. It listens on <topic>/request and replies on <topic>/reply.
type Request ¶
type Request[Req any] struct { ID CorrelationID Value Req }
Request is an inbound RPC request delivered on the Replier.Requests channel.
type Requester ¶
type Requester[Req, Rep any] struct { // contains filtered or unexported fields }
Requester sends typed RPC requests and waits for correlated replies. Create with NewRequester; call Close when done.
func NewRequester ¶
func NewRequester[Req, Rep any]( p dds.Participant, topic string, reqCodec dds.Codec[Req], repCodec dds.Codec[Rep], qos dds.QoS, ) (*Requester[Req, Rep], error)
NewRequester creates a Requester on the given participant. It publishes requests on <topic>/request and receives replies on <topic>/reply.