|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
IPC client implementation using shared memory. More...
#include <shm_client.hpp>
Public Member Functions | |
| ShmClient (std::string base_name) | |
| ~ShmClient () override=default | |
| ShmClient (const ShmClient &)=delete | |
| ShmClient & | operator= (const ShmClient &)=delete |
| ShmClient (ShmClient &&)=delete | |
| ShmClient & | operator= (ShmClient &&)=delete |
| bool | connect () override |
| Connect to the server. | |
| bool | send (const void *data, size_t len, uint64_t timeout_ns) override |
| Send a message to the server. | |
| std::span< const uint8_t > | receive (uint64_t timeout_ns) override |
| Receive a message from the server (zero-copy for shared memory) | |
| void | release (size_t message_size) override |
| Release the previously received message. | |
| void | close () override |
| Close the connection. | |
| void | debug_dump () const |
Public Member Functions inherited from bb::ipc::IpcClient | |
| IpcClient ()=default | |
| virtual | ~IpcClient ()=default |
| IpcClient (const IpcClient &)=delete | |
| IpcClient & | operator= (const IpcClient &)=delete |
| IpcClient (IpcClient &&)=delete | |
| IpcClient & | operator= (IpcClient &&)=delete |
Private Attributes | |
| std::string | base_name_ |
| std::optional< SpscShm > | request_ring_ |
| std::optional< SpscShm > | response_ring_ |
Additional Inherited Members | |
Static Public Member Functions inherited from bb::ipc::IpcClient | |
| static std::unique_ptr< IpcClient > | create_socket (const std::string &socket_path) |
| static std::unique_ptr< IpcClient > | create_shm (const std::string &base_name) |
IPC client implementation using shared memory.
Uses SPSC (single-producer single-consumer) for both requests and responses. Simple 1:1 client-server communication.
Definition at line 25 of file shm_client.hpp.
|
inlineexplicit |
Definition at line 27 of file shm_client.hpp.
|
overridedefault |
|
delete |
|
delete |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Connect to the server.
Implements bb::ipc::IpcClient.
Definition at line 39 of file shm_client.hpp.
|
inline |
Definition at line 92 of file shm_client.hpp.
|
inlineoverridevirtual |
Receive a message from the server (zero-copy for shared memory)
| timeout_ns | Timeout in nanoseconds |
The span remains valid until release() is called or the next recv(). For shared memory: direct view into ring buffer (true zero-copy) For sockets: view into internal buffer (eliminates one copy)
Must be followed by release() to consume the message.
Implements bb::ipc::IpcClient.
Definition at line 70 of file shm_client.hpp.
|
inlineoverridevirtual |
Release the previously received message.
| message_size | Size of the message being released (from span.size()) |
Must be called after recv() to consume the message and free resources. For shared memory: releases space in the ring buffer For sockets: no-op (message already consumed during recv)
Implements bb::ipc::IpcClient.
Definition at line 78 of file shm_client.hpp.
|
inlineoverridevirtual |
Send a message to the server.
| data | Pointer to message data |
| len | Length of message in bytes |
| timeout_ns | Timeout in nanoseconds (0 = infinite) |
Implements bb::ipc::IpcClient.
Definition at line 62 of file shm_client.hpp.
|
private |
Definition at line 103 of file shm_client.hpp.
|
private |
Definition at line 104 of file shm_client.hpp.
|
private |
Definition at line 105 of file shm_client.hpp.