File indexing completed on 2025-01-30 10:10:12
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
0016 namespace gloo {
0017 namespace rendezvous {
0018
0019 class FileStore : public Store {
0020 public:
0021 explicit FileStore(const std::string& path);
0022 virtual ~FileStore() {}
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 std::vector<std::string> getAllKeyFilePaths();
0038
0039 protected:
0040 std::string basePath_;
0041
0042 std::string realPath(const std::string& path);
0043
0044 std::string tmpPath(const std::string& name);
0045
0046 std::string objectPath(const std::string& name);
0047
0048 bool check(const std::vector<std::string>& keys);
0049
0050 std::vector<std::string> keyFilePaths_;
0051 };
0052
0053 }
0054 }