Config¶
Hazelcast Client Configuration module contains configuration classes and various constants required to create a ClientConfig.
-
DEFAULT_GROUP_NAME
= 'dev'¶ Default group name of the connected Hazelcast cluster
-
DEFAULT_GROUP_PASSWORD
= 'dev-pass'¶ Default password of connected Hazelcast cluster
-
PROPERTY_HEARTBEAT_INTERVAL
= 'hazelcast.client.heartbeat.interval'¶ Configuration property for heartbeat interval in milliseconds. Client will send heartbeat to server by this value of interval unless other requests send to server
-
PROPERTY_HEARTBEAT_TIMEOUT
= 'hazelcast.client.heartbeat.timeout'¶ Configuration property for heartbeat timeout in milliseconds. If client cannot see any activity on a connection for this timeout value it will shutdown the connection
-
INTEGER_TYPE
¶ alias of
hazelcast.util.Enum
-
EVICTION_POLICY
¶ alias of
hazelcast.util.Enum
-
IN_MEMORY_FORMAT
¶ alias of
hazelcast.util.Enum
-
class
ClientConfig
¶ Bases:
object
The root configuration for hazelcast python client.
>>> client_config = ClientConfig() >>> client = HazelcastClient(client_config)
-
group_config
= None¶ The group configuration
-
network_config
= None¶ The network configuration for addresses to connect, smart-routing, socket-options…
-
load_balancer
= None¶ Custom load balancer used to distribute the operations to multiple Endpoints.
-
membership_listeners
= None¶ Membership listeners, an array of tuple (member_added, member_removed, fire_for_existing)
-
lifecycle_listeners
= None¶ Lifecycle Listeners, an array of Functions of f(state)
-
near_cache_configs
= None¶ Near Cache configuration which maps “map-name : NearCacheConfig
-
serialization_config
= None¶ Hazelcast serialization configuration
-
add_membership_listener
(member_added=None, member_removed=None, fire_for_existing=False)¶ Helper method for adding membership listeners
Parameters: member_added – (Function), Function to be called when a member is added, in the form of f(member) (optional). :param member_removed: (Function), Function to be called when a member is removed, in the form of f(member) (optional). :param fire_for_existing: if True, already existing members will fire member_added event (optional). :return: self for cascading configuration
-
add_lifecycle_listener
(lifecycle_state_changed=None)¶ Helper method for adding lifecycle listeners.
Parameters: lifecycle_state_changed – (Function), Function to be called when lifecycle state is changed (optional). In the form of f(state). :return: self for cascading configuration
-
get_property_or_default
(key, default)¶ Client property accessor with fallback to default value.
Parameters: - key – (Object), property key to access.
- default – (Object), the default value for fallback.
Returns: (Object), property value if it exist or the default value otherwise.
-
add_near_cache_config
(near_cache_config)¶ Helper method to add a new NearCacheConfig.
Parameters: near_cache_config – (NearCacheConfig), the near_cache config to add. Returns: self for cascading configuration.
-
-
class
GroupConfig
¶ Bases:
object
The Group Configuration is the container class for name and password of the cluster.
-
name
= None¶ The group name of the cluster
-
password
= None¶ The password of the cluster
-
-
class
ClientNetworkConfig
¶ Bases:
object
Network related configuration parameters.
-
addresses
= None¶ The candidate address list that client will use to establish initial connection
-
connection_attempt_limit
= None¶ While client is trying to connect initially to one of the members in the addressList, all might be not available. Instead of giving up, throwing Error and stopping client, it will attempt to retry as much as defined by this parameter.
-
connection_attempt_period
= None¶ Period for the next attempt to find a member to connect
-
connection_timeout
= None¶ Socket connection timeout is a float, giving in seconds, or None. Setting a timeout of None disables the timeout feature and is equivalent to block the socket until it connects. Setting a timeout of zero is the same as disables blocking on connect.
-
socket_options
= None¶ Array of Unix socket options.
Example usage:
>>> import socket >>> client_network_config.socket_options.append(SocketOption(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)) >>> client_network_config.socket_options.append(SocketOption(socket.SOL_SOCKET, socket.SO_SNDBUF, 32768)) >>> client_network_config.socket_options.append(SocketOption(socket.SOL_SOCKET, socket.SO_RCVBUF, 32768))
Please see the Unix manual for level and option. Level and option constant are in python std lib socket module
-
redo_operation
= None¶ If true, client will redo the operations that were executing on the server and client lost the connection. This can be because of network, or simply because the member died. However it is not clear whether the application is performed or not. For idempotent operations this is harmless, but for non idempotent ones retrying can cause to undesirable effects. Note that the redo can perform on any member.
-
smart_routing
= None¶ If true, client will route the key based operations to owner of the key at the best effort. Note that it uses a cached value of partition count and doesn’t guarantee that the operation will always be executed on the owner. The cached table is updated every 10 seconds.
-
-
class
SocketOption
(level, option, value)¶ Bases:
object
Advanced configuration for fine-tune the TCP options. A Socket option represent the unix socket option, that will be passed to python socket.setoption(level,`option, value)` See the Unix manual for level and option.
-
level
= None¶ Option level. See the Unix manual for detail.
-
option
= None¶ The actual socket option. The actual socket option.
-
value
= None¶ Socket option value. The value argument can either be an integer or a string
-
-
class
SerializationConfig
¶ Bases:
object
Hazelcast Serialization Service configuration options can be set from this class.
-
portable_version
= None¶ Portable version will be used to differentiate two versions of the same class that have changes on the class, like adding/removing a field or changing a type of a field.
-
data_serializable_factories
= None¶ Dictionary of factory-id and corresponding IdentifiedDataserializable factories. A Factory is a simple dictionary with entries of class-id : class-constructor-function pairs.
Example:
>>> my_factory = {MyPersonClass.CLASS_ID : MyPersonClass, MyAddressClass.CLASS_ID : MyAddressClass} >>> serialization_config.data_serializable_factories[FACTORY_ID] = my_factory
-
portable_factories
= None¶ Dictionary of factory-id and corresponding portable factories. A Factory is a simple dictionary with entries of class-id : class-constructor-function pairs.
Example:
>>> portable_factory = {PortableClass_0.CLASS_ID : PortableClass_0, PortableClass_1.CLASS_ID : PortableClass_1} >>> serialization_config.portable_factories[FACTORY_ID] = portable_factory
-
class_definitions
= None¶ Set of all Portable class definitions.
-
check_class_def_errors
= None¶ Configured Portable Class definitions should be validated for errors or not.
-
is_big_endian
= None¶ Hazelcast Serialization is big endian or not.
-
default_integer_type
= None¶ Python has variable length int/long type. In order to match this with static fixed length Java server, this option defines the length of the int/long. One of the values of
INTEGER_TYPE
can be assigned. Please seeINTEGER_TYPE
documentation for details of the options.
-
add_data_serializable_factory
(factory_id, factory)¶ Helper method for adding IdentifiedDataSerializable factory. example:
>>> my_factory = {MyPersonClass.CLASS_ID : MyPersonClass, MyAddressClass.CLASS_ID : MyAddressClass} >>> serialization_config.add_data_serializable_factory(factory_id, my_factory)
Parameters: - factory_id – (int), factory-id to register.
- factory – (Dictionary), the factory dictionary of class-id:class-constructor-function pairs.
-
add_portable_factory
(factory_id, factory)¶ Helper method for adding Portable factory. example:
>>> portable_factory = {PortableClass_0.CLASS_ID : PortableClass_0, PortableClass_1.CLASS_ID : PortableClass_1} >>> serialization_config.portable_factories[FACTORY_ID] = portable_factory
Parameters: - factory_id – (int), factory-id to register.
- factory – (Dictionary), the factory dictionary of class-id:class-constructor-function pairs.
-
set_custom_serializer
(_type, serializer)¶ Assign a serializer for the type.
Parameters: - _type – (Type), the target type of the serializer
- serializer – (Serializer), Custom Serializer constructor function
-
custom_serializers
¶ All custom serializers.
Returns: (Dictionary), dictionary of type-custom serializer pairs.
-
global_serializer
¶ The Global serializer property for serialization service. The assigned value should be a class constructor function. It handles every object if no other serializer found.
Global serializers should extend hazelcast.serializer.api.StreamSerializer
-
-
class
NearCacheConfig
(name)¶ Bases:
object
Map Near cache configuration for a specific map by name.
-
invalidate_on_change
= None¶ Should a value is invalidated and removed in case of any map data updating operations such as replace, remove etc.
-
name
¶ Name of the map that this near cache belong. Cannot be None.
-
in_memory_format
¶ Internal representation of the stored data in near cache.
-
time_to_live_seconds
¶ The maximum number of seconds for each entry to stay in the near cache.
-
max_idle_seconds
¶ Maximum number of seconds each entry can stay in the near cache as untouched (not-read).
-
eviction_policy
¶ The eviction policy for the near cache
-
eviction_max_size
¶ The limit for number of entries until the eviction start.
-
eviction_sampling_count
¶ The entry count of the samples for the internal eviction sampling algorithm taking samples in each operation.
-
eviction_sampling_pool_size
¶ The size of the internal eviction sampling algorithm has a pool of best candidates for eviction.
-