backend.hpp
1 
6 #pragma once
7 
8 #include <cstddef>
9 #include <string>
10 #include <string_view>
11 
12 #include <rapidsmpf/bootstrap/types.hpp>
13 
15 
19 enum class BackendType {
28  AUTO,
29 
37  FILE,
38 
53  SLURM,
54 };
55 
56 namespace detail {
57 
65 class Backend {
66  public:
67  virtual ~Backend() = default;
68 
82  virtual void put(std::string const& key, std::string_view value) = 0;
83 
96  virtual std::string get(std::string const& key, Duration timeout) = 0;
97 
103  virtual void barrier() = 0;
104 
108  virtual void sync() = 0;
109 
110  // Non-copyable, non-movable (backends manage resources)
111  Backend(Backend const&) = delete;
112  Backend& operator=(Backend const&) = delete;
113  Backend(Backend&&) = delete;
114  Backend& operator=(Backend&&) = delete;
115 
116  protected:
117  Backend() = default;
118 };
119 
120 } // namespace detail
121 } // namespace rapidsmpf::bootstrap
Abstract interface for bootstrap coordination backends.
Definition: backend.hpp:65
virtual void put(std::string const &key, std::string_view 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:19
@ 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