backend.hpp
1 
6 #pragma once
7 
8 #include <cstddef>
9 #include <string>
10 
11 #include <rapidsmpf/bootstrap/types.hpp>
12 
14 
18 enum class BackendType {
27  AUTO,
28 
36  FILE,
37 
52  SLURM,
53 };
54 
55 namespace detail {
56 
64 class Backend {
65  public:
66  virtual ~Backend() = default;
67 
81  virtual void put(std::string const& key, std::string const& value) = 0;
82 
95  virtual std::string get(std::string const& key, Duration timeout) = 0;
96 
102  virtual void barrier() = 0;
103 
107  virtual void sync() = 0;
108 
109  // Non-copyable, non-movable (backends manage resources)
110  Backend(Backend const&) = delete;
111  Backend& operator=(Backend const&) = delete;
112  Backend(Backend&&) = delete;
113  Backend& operator=(Backend&&) = delete;
114 
115  protected:
116  Backend() = default;
117 };
118 
119 } // namespace detail
120 } // namespace rapidsmpf::bootstrap
Abstract interface for bootstrap coordination backends.
Definition: backend.hpp:64
virtual void put(std::string const &key, std::string const &value)=0
Store a key-value pair (rank 0 only).
virtual void barrier()=0
Perform a barrier synchronization.
virtual void sync()=0
Ensure all previous put() operations are globally visible.
virtual std::string get(std::string const &key, Duration timeout)=0
Retrieve a value, blocking until available or timeout occurs.
BackendType
Backend types for process coordination and bootstrapping.
Definition: backend.hpp:18
@ FILE
File-based coordination using a shared directory.
@ AUTO
Automatically detect the best backend based on environment.
@ SLURM
Slurm-based coordination using PMIx.
std::chrono::duration< double > Duration
Type alias for Duration type.
Definition: types.hpp:17