IBufferExchange Class Reference
|
Space-ng SDK
|
Interface for registering, discovering, and disposing shared buffers. More...
#include <sol3/core/shmem_buffer.h>
Public Types | |
| using | Endpoint = boost::asio::local::datagram_protocol::endpoint |
| using | EndpointPort = sol3::core::EndpointPort |
| using | PortIdx = sol3::core::PortIdx |
Public Member Functions | |
| virtual | ~IBufferExchange ()=default |
| virtual void | start ()=0 |
| Start running in a background thread. More... | |
| virtual void | stop ()=0 |
| Request the event loop to stop. More... | |
| virtual bool | stopped () const =0 |
| True if the exchange has been stopped. More... | |
| virtual Endpoint const & | localEndpoint () const =0 |
| Local endpoint used by this exchange. More... | |
| virtual void | addPeer (Endpoint const &peer_endpoint)=0 |
| virtual void | mapLocalToPeer (uint32_t local_port, Endpoint peer_endpoint, uint32_t peer_port=0)=0 |
| virtual void | configure (msg::ExchangeConfigT const &config)=0 |
| virtual void | listPorts (std::vector< EndpointPort > &ports) const =0 |
| List all ports this exchange has received from peers or shared locally. More... | |
| virtual void | registerBuffer (IBufferMutable const &buffer)=0 |
| virtual void | unregisterBuffer (IBufferMutable const &buffer)=0 |
| Unregister a previously shared mutable buffer. More... | |
| virtual std::shared_ptr< IBufferConst > | get (uint32_t id, uint32_t idx) const =0 |
| virtual std::shared_ptr< IBufferConst > | get (Endpoint const &ep, uint32_t id, uint32_t idx) const =0 |
| virtual void | dispose (std::shared_ptr< IBufferConst > &&buffer)=0 |
| Release resources associated with a previously retrieved buffer. More... | |
| virtual void | listMappings (std::map< uint32_t, std::vector< std::pair< Endpoint, uint32_t >>> &mappings) const =0 |
| virtual void | listResolvedBuffers (std::map< PortIdx, std::shared_ptr< IBufferConst >> &buffers) const =0 |
Static Public Member Functions | |
| static std::shared_ptr< IBufferExchange > | makeProcessLocal () |
Detailed Description
Interface for registering, discovering, and disposing shared buffers.
Member Typedef Documentation
◆ Endpoint
| using sol3::core::IBufferExchange::Endpoint = boost::asio::local::datagram_protocol::endpoint |
◆ EndpointPort
◆ PortIdx
Constructor & Destructor Documentation
◆ ~IBufferExchange()
|
virtualdefault |
Member Function Documentation
◆ addPeer()
|
pure virtual |
Add a peer endpoint to poll for its shared buffers.
The endpoint is expected to be the path on disk of the peer's UNIX domain socket.
Implemented in sol3::core::ShmemExchange.
◆ configure()
|
pure virtual |
Apply configuration to this exchange.
Replaces previously configured mappings.
Wildcard fallback behavior is expressed using mappings with local_port == 0 and peer_port == 0.
Implemented in sol3::core::ShmemExchange.
◆ dispose()
|
pure virtual |
Release resources associated with a previously retrieved buffer.
Implemented in sol3::core::ShmemExchange.
◆ get() [1/2]
|
pure virtual |
Retrieve a shared buffer from a specific endpoint only.
This direct endpoint lookup does not apply resolution rules.
Implemented in sol3::core::ShmemExchange.
◆ get() [2/2]
|
pure virtual |
Retrieve a shared buffer by port according to resolution rules.
Resolution order when one or more mappings exist: 1) explicit local-to-peer mappings, in registration order 2) wildcard fallback mappings (local_port_to_peer_ports[0]), in registration order 3) this exchange's local endpoint:port
idx is the index of the shared buffer associated with the port. For MessageInput/MessageOutput buffers, this is typically 0.
Implemented in sol3::core::ShmemExchange.
◆ listMappings()
|
pure virtual |
Returns the current local-port-to-peer routing table.
Keyed by local port (0 = wildcard fallback). Each entry is an ordered list of (peer_endpoint, peer_port) pairs applied in registration order.
Implemented in sol3::core::ShmemExchange.
◆ listPorts()
|
pure virtual |
List all ports this exchange has received from peers or shared locally.
Implemented in sol3::core::ShmemExchange.
◆ listResolvedBuffers()
|
pure virtual |
Returns resolved buffers, keyed by PortIdx.
Each buffer carries its source endpoint() and info().id().
Implemented in sol3::core::ShmemExchange.
◆ localEndpoint()
|
pure virtual |
Local endpoint used by this exchange.
Implemented in sol3::core::ShmemExchange.
◆ makeProcessLocal()
|
static |
Constructs a local only buffer exchange, that does not share file descriptors over a unix domain socket.
◆ mapLocalToPeer()
|
pure virtual |
Add a resolution rule from a local logical buffer port to a peer endpoint/port tuple.
You can add more than one mapping per local_port; mappings are applied in registration order.
local_port and peer_port are typically computed by MessagePort::encoded().
Wildcard mappings:
- local_port == 0 matches any requested local port.
- peer_port == 0 means "use the requested local port". This is useful for fallback routing like (0 -> peer, 0).
Implemented in sol3::core::ShmemExchange.
◆ registerBuffer()
|
pure virtual |
Registers a mutable buffer to be shared with requesting peers.
The buffer is only shared in response to requests from other peers, and is not automatically shared with peers that this exchange polls.
The underlying shared-memory storage is kept alive for this exchange, and for any peer exchange that has received it.
Implemented in sol3::core::ShmemExchange.
◆ start()
|
pure virtual |
Start running in a background thread.
Implemented in sol3::core::ShmemExchange.
◆ stop()
|
pure virtual |
Request the event loop to stop.
Implemented in sol3::core::ShmemExchange.
◆ stopped()
|
pure virtual |
True if the exchange has been stopped.
Implemented in sol3::core::ShmemExchange.
◆ unregisterBuffer()
|
pure virtual |
Unregister a previously shared mutable buffer.
Implemented in sol3::core::ShmemExchange.
The documentation for this class was generated from the following file:
- /workspaces/astro/sol3-sdk/cpp/sol3/core/shmem_buffer.h
Generated by