Hazelcast C++ Client
Hazelcast C++ Client Library
Loading...
Searching...
No Matches
hazelcast::cp::raft_proxy_factory Class Reference

Client-side Raft-based proxy implementation of atomic reference. More...

#include <cp.h>

Public Member Functions

 raft_proxy_factory (client::spi::ClientContext &context)
template<typename T>
boost::future< std::shared_ptr< T > > create_proxy (const std::string &name)

Static Public Member Functions

static std::string without_default_group_name (const std::string &n)
static std::string object_name_for_proxy (const std::string &name)

Detailed Description

Client-side Raft-based proxy implementation of atomic reference.

Definition at line 1318 of file cp.h.

Constructor & Destructor Documentation

◆ raft_proxy_factory()

hazelcast::cp::raft_proxy_factory::raft_proxy_factory ( client::spi::ClientContext & context)

Definition at line 34 of file cp.cpp.

35 : context_(context)
36{}

Member Function Documentation

◆ create_proxy()

template<typename T>
boost::future< std::shared_ptr< T > > hazelcast::cp::raft_proxy_factory::create_proxy ( const std::string & name)
inline

Definition at line 1328 of file cp.h.

1329 {
1330 auto proxy_name = without_default_group_name(name);
1331 auto object_name = object_name_for_proxy(proxy_name);
1332 return get_group_id(proxy_name, object_name)
1333 .then([=](boost::future<raft_group_id> f) {
1334 auto group_id = f.get();
1335 return create<T>(std::move(group_id), proxy_name, object_name);
1336 });
1337 }

◆ object_name_for_proxy()

std::string hazelcast::cp::raft_proxy_factory::object_name_for_proxy ( const std::string & name)
static

Definition at line 118 of file cp.cpp.

119{
120 auto index = name.find('@');
121 if (index == std::string::npos) {
122 return name;
123 }
124
125 Preconditions::check_true(index < (name.size() - 1),
126 "Object name cannot be empty string");
127 Preconditions::check_true(
128 name.find('@', index + 1) == std::string::npos,
129 "Custom CP group name must be specified at most once");
130
131 auto object_name = name.substr(0, index);
132 boost::trim(object_name);
133 Preconditions::check_true(object_name.size() > 0,
134 "Object name cannot be empty string");
135 return object_name;
136}

◆ without_default_group_name()

std::string hazelcast::cp::raft_proxy_factory::without_default_group_name ( const std::string & n)
static

Definition at line 96 of file cp.cpp.

97{
98 std::string name = n;
99 boost::trim(name);
100 auto index = name.find('@');
101 if (index == std::string::npos) {
102 return name;
103 }
104
105 Preconditions::check_true(
106 name.find('@', index + 1) == std::string::npos,
107 "Custom group name must be specified at most once");
108
109 auto group_name = name.substr(index + 1);
110 boost::trim(group_name);
111 if (group_name == DEFAULT_GROUP_NAME) {
112 return name.substr(0, index);
113 }
114 return name;
115}

The documentation for this class was generated from the following files:
  • hazelcast/include/hazelcast/cp/cp.h
  • hazelcast/src/hazelcast/cp/cp.cpp