Hazelcast C++ Client
Hazelcast C++ Client Library
client_properties.h
1 /*
2  * Copyright (c) 2008-2021, Hazelcast, Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 #pragma once
19 
20 #include <string>
21 #include <unordered_map>
22 
23 #include "hazelcast/util/export.h"
24 #include "hazelcast/util/IOUtil.h"
25 
26 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
27 #pragma warning(push)
28 #pragma warning(disable: 4251) //for dll export
29 #endif
30 
31 namespace hazelcast {
32  namespace client {
33  class client_config;
34 
40  class HAZELCAST_API client_property {
41  public:
42  client_property(const std::string &name, const std::string &default_value);
43 
44  const std::string &get_name() const;
45 
46  const std::string &get_default_value() const;
47 
53  const char *get_system_property() const;
54 
55  private:
56  std::string name_;
57  std::string default_value_;
58  };
59 
60 
66  class HAZELCAST_API client_properties {
67  public:
68  client_properties(const std::unordered_map<std::string, std::string> &properties);
69 
70  const client_property& get_heartbeat_timeout() const;
71 
72  const client_property& get_heartbeat_interval() const;
73 
74  const client_property& get_aws_member_port() const;
75 
76  const client_property &get_invocation_retry_pause_millis() const;
77 
78  const client_property &get_invocation_timeout_seconds() const;
79 
80  const client_property &get_event_thread_count() const;
81 
82  const client_property &get_internal_executor_pool_size() const;
83 
84  const client_property &get_shuffle_member_list() const;
85 
86  const client_property &get_max_concurrent_invocations() const;
87 
88  const client_property &get_backpressure_backoff_timeout_millis() const;
89 
90  const client_property &get_statistics_enabled() const;
91 
92  const client_property &get_statistics_period_seconds() const;
93 
94  const client_property &backup_timeout_millis() const;
95 
96  const client_property &fail_on_indeterminate_state() const;
97 
98  const client_property &cloud_base_url() const;
99 
108  static const std::string PROP_HEARTBEAT_TIMEOUT;
109  static const std::string PROP_HEARTBEAT_TIMEOUT_DEFAULT;
110 
117  static const std::string PROP_HEARTBEAT_INTERVAL;
118  static const std::string PROP_HEARTBEAT_INTERVAL_DEFAULT;
119 
129  static const std::string PROP_REQUEST_RETRY_COUNT;
130  static const std::string PROP_REQUEST_RETRY_COUNT_DEFAULT;
131 
141  static const std::string PROP_REQUEST_RETRY_WAIT_TIME;
142  static const std::string PROP_REQUEST_RETRY_WAIT_TIME_DEFAULT;
143 
149  static const std::string PROP_AWS_MEMBER_PORT;
150  static const std::string PROP_AWS_MEMBER_PORT_DEFAULT;
151 
155  static const std::string INVOCATION_RETRY_PAUSE_MILLIS;
156  static const std::string INVOCATION_RETRY_PAUSE_MILLIS_DEFAULT;
157 
168  static const std::string INVOCATION_TIMEOUT_SECONDS;
169  static const std::string INVOCATION_TIMEOUT_SECONDS_DEFAULT;
170 
174  static const std::string EVENT_THREAD_COUNT;
175  static const std::string EVENT_THREAD_COUNT_DEFAULT;
176 
177 
178  static const std::string INTERNAL_EXECUTOR_POOL_SIZE;
179  static const std::string INTERNAL_EXECUTOR_POOL_SIZE_DEFAULT;
180 
186  static const std::string SHUFFLE_MEMBER_LIST;
187  static const std::string SHUFFLE_MEMBER_LIST_DEFAULT;
188 
198  static const std::string MAX_CONCURRENT_INVOCATIONS;
199  static const std::string MAX_CONCURRENT_INVOCATIONS_DEFAULT;
200 
212  static const std::string BACKPRESSURE_BACKOFF_TIMEOUT_MILLIS;
213  static const std::string BACKPRESSURE_BACKOFF_TIMEOUT_MILLIS_DEFAULT;
214 
220  static const std::string STATISTICS_ENABLED;
221  static const std::string STATISTICS_ENABLED_DEFAULT;
222 
226  static const std::string STATISTICS_PERIOD_SECONDS;
227  static const std::string STATISTICS_PERIOD_SECONDS_DEFAULT;
228 
233  static constexpr const char * OPERATION_BACKUP_TIMEOUT_MILLIS = "hazelcast.client.operation.backup.timeout.millis";
234  static constexpr const char * OPERATION_BACKUP_TIMEOUT_MILLIS_DEFAULT = "5000";
235 
242  static constexpr const char * FAIL_ON_INDETERMINATE_OPERATION_STATE = "hazelcast.client.operation.fail.on.indeterminate.state";
243  static constexpr const char * FAIL_ON_INDETERMINATE_OPERATION_STATE_DEFAULT = "false";
244 
249  static constexpr const char * CLOUD_URL_BASE = "hazelcast.client.cloud.url";
250  static constexpr const char * CLOUD_URL_BASE_DEFAULT = "coordinator.hazelcast.cloud";
251 
258  bool get_boolean(const client_property &property) const;
259 
266  int32_t get_integer(const client_property &property) const;
267 
274  int64_t get_long(const client_property &property) const;
275 
282  std::string get_string(const client_property &property) const;
283 
284  private:
285  client_property heartbeat_timeout_;
286  client_property heartbeat_interval_;
287  client_property retry_count_;
288  client_property retry_wait_time_;
289  client_property aws_member_port_;
290  client_property invocation_retry_pause_millis_;
291  client_property invocation_timeout_seconds_;
292  client_property event_thread_count_;
293  client_property internal_executor_pool_size_;
294  client_property shuffle_member_list_;
295  client_property max_concurrent_invocations_;
296  client_property backpressure_backoff_timeout_millis_;
297  client_property statistics_enabled_;
298  client_property statistics_period_seconds_;
299  client_property backup_timeout_millis_;
300  client_property fail_on_indeterminate_state_;
301  client_property cloud_base_url_;
302 
303  std::unordered_map<std::string, std::string> properties_map_;
304  };
305 
306  }
307 }
308 
309 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
310 #pragma warning(pop)
311 #endif
312 
313 
Client Properties is an internal class.
static const std::string PROP_HEARTBEAT_INTERVAL
Time interval in milliseconds between the heartbeats sent by the client to the nodes.
static const std::string PROP_REQUEST_RETRY_COUNT
Client will retry requests which either inherently retryable(idempotent client) or client_network_con...
static const std::string PROP_REQUEST_RETRY_WAIT_TIME
Client will retry requests which either inherently retryable(idempotent client) or client_network_con...
static const std::string MAX_CONCURRENT_INVOCATIONS
The maximum number of concurrent invocations allowed.
static const std::string SHUFFLE_MEMBER_LIST
Client shuffles the given member list to prevent all clients to connect to the same node when this pr...
static const std::string STATISTICS_PERIOD_SECONDS
The period in seconds the statistics sent to the cluster.
static const std::string EVENT_THREAD_COUNT
Number of the threads to handle the incoming event packets.
static const std::string STATISTICS_ENABLED
Use to enable the client statistics collection.
static const std::string INVOCATION_RETRY_PAUSE_MILLIS
Pause time between each retry cycle of an invocation in milliseconds.
static const std::string PROP_AWS_MEMBER_PORT
The discovery mechanism will discover only IP addresses.
static const std::string PROP_HEARTBEAT_TIMEOUT
Client will be sending heartbeat messages to members and this is the timeout.
static const std::string INVOCATION_TIMEOUT_SECONDS
When an invocation gets an exception because :
static const std::string BACKPRESSURE_BACKOFF_TIMEOUT_MILLIS
Control the maximum timeout in millis to wait for an invocation space to be available.
A client property is a configuration for hazelcast client.