1313namespace gloo {
1414namespace rendezvous {
1515
16- PrefixStore::PrefixStore (const std::string& prefix, Store& store)
17- : prefix_(prefix), store_(store) {}
16+ PrefixStore::PrefixStore (
17+ const std::string& prefix,
18+ std::shared_ptr<Store> store)
19+ : prefix_(prefix), store_(std::move(store)) {}
1820
1921std::string PrefixStore::joinKey (const std::string& key) {
2022 std::stringstream ss;
@@ -23,11 +25,11 @@ std::string PrefixStore::joinKey(const std::string& key) {
2325}
2426
2527void PrefixStore::set (const std::string& key, const std::vector<char >& data) {
26- store_. set (joinKey (key), data);
28+ store_-> set (joinKey (key), data);
2729}
2830
2931std::vector<char > PrefixStore::get (const std::string& key) {
30- return store_. get (joinKey (key));
32+ return store_-> get (joinKey (key));
3133}
3234
3335void PrefixStore::wait (
@@ -38,56 +40,56 @@ void PrefixStore::wait(
3840 for (const auto & key : keys) {
3941 joinedKeys.push_back (joinKey (key));
4042 }
41- store_. wait (joinedKeys, timeout);
43+ store_-> wait (joinedKeys, timeout);
4244}
4345
4446bool PrefixStore::has_v2_support () {
45- return store_. has_v2_support ();
47+ return store_-> has_v2_support ();
4648}
4749
4850std::vector<std::vector<char >> PrefixStore::multi_get (
4951 const std::vector<std::string>& keys) {
50- if (!store_. has_v2_support ()) {
52+ if (!store_-> has_v2_support ()) {
5153 GLOO_THROW_INVALID_OPERATION_EXCEPTION (
5254 " underlying store doesn't support multi_get" );
5355 }
5456 std::vector<std::string> prefixed_keys;
5557 for (auto & key : keys) {
5658 prefixed_keys.push_back (joinKey (key));
5759 }
58- return store_. multi_get (prefixed_keys);
60+ return store_-> multi_get (prefixed_keys);
5961}
6062
6163void PrefixStore::multi_set (
6264 const std::vector<std::string>& keys,
6365 const std::vector<std::vector<char >>& values) {
64- if (!store_. has_v2_support ()) {
66+ if (!store_-> has_v2_support ()) {
6567 GLOO_THROW_INVALID_OPERATION_EXCEPTION (
6668 " underlying store doesn't support multi_set" );
6769 }
6870 std::vector<std::string> prefixed_keys;
6971 for (auto & key : keys) {
7072 prefixed_keys.push_back (joinKey (key));
7173 }
72- return store_. multi_set (prefixed_keys, values);
74+ return store_-> multi_set (prefixed_keys, values);
7375}
7476
7577void PrefixStore::append (
7678 const std::string& key,
7779 const std::vector<char >& data) {
78- if (!store_. has_v2_support ()) {
80+ if (!store_-> has_v2_support ()) {
7981 GLOO_THROW_INVALID_OPERATION_EXCEPTION (
8082 " underlying store doesn't support append" );
8183 }
82- store_. append (joinKey (key), data);
84+ store_-> append (joinKey (key), data);
8385}
8486
8587int64_t PrefixStore::add (const std::string& key, int64_t value) {
86- if (!store_. has_v2_support ()) {
88+ if (!store_-> has_v2_support ()) {
8789 GLOO_THROW_INVALID_OPERATION_EXCEPTION (
8890 " underlying store doesn't support append" );
8991 }
90- return store_. add (joinKey (key), value);
92+ return store_-> add (joinKey (key), value);
9193}
9294
9395} // namespace rendezvous
0 commit comments