12 #include <string_view>
16 #include <rapidsmpf/bootstrap/backend.hpp>
17 #include <rapidsmpf/bootstrap/bootstrap.hpp>
58 [[nodiscard]] std::string
const&
address() const noexcept {
67 [[nodiscard]] std::string
const&
token() const noexcept {
78 std::shared_ptr<State> state_;
80 std::array<int, 2> wakeup_pipe_{-1, -1};
83 std::thread accept_thread_;
84 std::mutex handler_mutex_;
85 std::vector<std::thread> handler_threads_;
88 void handle_connection(
int client_fd);
113 void put(std::string
const& key, std::string_view value)
override;
116 std::string
get(std::string
const& key,
Duration timeout)
override;
128 void send_line(std::string
const& line);
129 std::string recv_line();
130 void send_bytes(
void const* data, std::size_t n);
131 void recv_bytes(
void* data, std::size_t n);
Abstract interface for bootstrap coordination backends.
Socket-based coordination backend (client side, runs in each rank).
void sync() override
Ensure all previous put() operations are globally visible.
void barrier() override
Perform a barrier synchronization.
void put(std::string const &key, std::string_view value) override
Store a key-value pair (rank 0 only).
std::string get(std::string const &key, Duration timeout) override
Retrieve a value, blocking until available or timeout occurs.
SocketBackend(Context ctx)
Construct a file backend.
In-process TCP coordination server, intended to run inside rrun.
SocketServer(int nranks)
Start the server.
~SocketServer()
Shut down the server and join all threads.
std::string const & address() const noexcept
Returns the server address as "127.0.0.1:<port>".
std::string const & token() const noexcept
Returns the 64-character hex-encoded 256-bit authentication token.
std::chrono::duration< double > Duration
Type alias for Duration type.
Context information for the current process/rank.