File indexing completed on 2025-01-18 10:00:10
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "gloo/rendezvous/store.h"
0012
0013 #include <condition_variable>
0014 #include <mutex>
0015 #include <unordered_map>
0016
0017 namespace gloo {
0018 namespace rendezvous {
0019
0020 class HashStore : public Store {
0021 public:
0022 virtual ~HashStore() {}
0023
0024 virtual void set(const std::string& key, const std::vector<char>& data)
0025 override;
0026
0027 virtual std::vector<char> get(const std::string& key) override;
0028
0029 virtual void wait(const std::vector<std::string>& keys) override {
0030 wait(keys, Store::kDefaultTimeout);
0031 }
0032
0033 virtual void wait(
0034 const std::vector<std::string>& keys,
0035 const std::chrono::milliseconds& timeout) override;
0036
0037 protected:
0038 std::unordered_map<std::string, std::vector<char>> map_;
0039 std::mutex m_;
0040 std::condition_variable cv_;
0041 };
0042
0043 }
0044 }