ShmemExchange Class Reference
|
Space-ng SDK
|
#include <sol3/core/shmem_exchange.h>
Public Types | |
| using | Endpoint = IBufferExchange::Endpoint |
| using | EndpointPort = sol3::core::EndpointPort |
| using | PortIdx = sol3::core::PortIdx |
Public Types inherited from sol3::core::IBufferExchange | |
| using | Endpoint = boost::asio::local::datagram_protocol::endpoint |
| using | EndpointPort = sol3::core::EndpointPort |
| using | PortIdx = sol3::core::PortIdx |
Public Member Functions | |
| ShmemExchange (Endpoint const &local_endpoint) | |
| ShmemExchange (Endpoint const &local_endpoint, msg::ExchangeConfigT exchange_config) | |
| ~ShmemExchange () override | |
| Stops and releases socket/IO resources. More... | |
| ShmemExchange (ShmemExchange const &)=delete | |
| ShmemExchange & | operator= (ShmemExchange const &)=delete |
| ShmemExchange (ShmemExchange &&)=delete | |
| ShmemExchange & | operator= (ShmemExchange &&)=delete |
| void | start () override |
| Start running in a background thread. More... | |
| void | stop () override |
| Request the event loop to stop. More... | |
| bool | stopped () const override |
| True if the exchange has been stopped. More... | |
| void | addPeer (Endpoint const &peer_endpoint) override |
| void | mapLocalToPeer (uint32_t local_port, Endpoint peer_endpoint, uint32_t peer_port=0) override |
| void | configure (msg::ExchangeConfigT const &config) override |
| void | registerBuffer (IBufferMutable const &buffer) override |
| void | unregisterBuffer (IBufferMutable const &buffer) override |
| Unregister a previously shared mutable buffer. More... | |
| Endpoint const & | localEndpoint () const override |
| Local endpoint used by this exchange. More... | |
| std::shared_ptr< IBufferConst > | get (uint32_t port, uint32_t idx) const override |
| std::shared_ptr< IBufferConst > | get (Endpoint const &ep, uint32_t port, uint32_t idx) const override |
| void | dispose (std::shared_ptr< IBufferConst > &&buffer) override |
| Release resources associated with a previously retrieved buffer. More... | |
| void | listPorts (std::vector< EndpointPort > &ports) const override |
| List all ports this exchange has received from peers or shared locally. More... | |
| void | listMappings (std::map< uint32_t, std::vector< std::pair< Endpoint, uint32_t >>> &mappings) const override |
| void | listResolvedBuffers (std::map< PortIdx, std::shared_ptr< IBufferConst >> &buffers) const override |
Public Member Functions inherited from sol3::core::IBufferExchange | |
| virtual | ~IBufferExchange ()=default |
Additional Inherited Members | |
Static Public Member Functions inherited from sol3::core::IBufferExchange | |
| static std::shared_ptr< IBufferExchange > | makeProcessLocal () |
Detailed Description
UNIX-domain-socket-based buffer exchange for registering and discovering shared-memory buffers across peer processes.
Member Typedef Documentation
◆ Endpoint
◆ EndpointPort
◆ PortIdx
Constructor & Destructor Documentation
◆ ShmemExchange() [1/4]
| sol3::core::ShmemExchange::ShmemExchange | ( | Endpoint const & | local_endpoint | ) |
Create an exchange bound to the given local UNIX domain socket endpoint. Creates an exchange with an empty routing config.
◆ ShmemExchange() [2/4]
| sol3::core::ShmemExchange::ShmemExchange | ( | Endpoint const & | local_endpoint, |
| msg::ExchangeConfigT | exchange_config | ||
| ) |
Create an exchange bound to the given local UNIX domain socket endpoint. Always applies exchange_config.
◆ ~ShmemExchange()
|
override |
Stops and releases socket/IO resources.
◆ ShmemExchange() [3/4]
|
delete |
◆ ShmemExchange() [4/4]
|
delete |
Member Function Documentation
◆ addPeer()
|
overridevirtual |
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.
Implements sol3::core::IBufferExchange.
◆ configure()
|
overridevirtual |
Apply configuration to this exchange.
Replaces previously configured mappings.
Wildcard fallback behavior is expressed using mappings with local_port == 0 and peer_port == 0.
Implements sol3::core::IBufferExchange.
◆ dispose()
|
overridevirtual |
Release resources associated with a previously retrieved buffer.
Implements sol3::core::IBufferExchange.
◆ get() [1/2]
|
overridevirtual |
Retrieve a shared buffer from a specific endpoint only.
This direct endpoint lookup does not apply resolution rules.
Implements sol3::core::IBufferExchange.
◆ get() [2/2]
|
overridevirtual |
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.
Implements sol3::core::IBufferExchange.
◆ listMappings()
|
overridevirtual |
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.
Implements sol3::core::IBufferExchange.
◆ listPorts()
|
overridevirtual |
List all ports this exchange has received from peers or shared locally.
Implements sol3::core::IBufferExchange.
◆ listResolvedBuffers()
|
overridevirtual |
Returns resolved buffers, keyed by PortIdx.
Each buffer carries its source endpoint() and info().id().
Implements sol3::core::IBufferExchange.
◆ localEndpoint()
|
inlineoverridevirtual |
Local endpoint used by this exchange.
Implements sol3::core::IBufferExchange.
◆ mapLocalToPeer()
|
overridevirtual |
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).
Implements sol3::core::IBufferExchange.
◆ operator=() [1/2]
|
delete |
◆ operator=() [2/2]
|
delete |
◆ registerBuffer()
|
overridevirtual |
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.
Implements sol3::core::IBufferExchange.
◆ start()
|
overridevirtual |
Start running in a background thread.
Implements sol3::core::IBufferExchange.
◆ stop()
|
overridevirtual |
Request the event loop to stop.
Implements sol3::core::IBufferExchange.
◆ stopped()
|
overridevirtual |
True if the exchange has been stopped.
Implements sol3::core::IBufferExchange.
◆ unregisterBuffer()
|
overridevirtual |
Unregister a previously shared mutable buffer.
Implements sol3::core::IBufferExchange.
The documentation for this class was generated from the following file:
- /workspaces/astro/sol3-sdk/cpp/sol3/core/shmem_exchange.h
Generated by
Public Types inherited from