INSTRUCTION
stringlengths
1
46.3k
RESPONSE
stringlengths
75
80.2k
Calculates the request payload size
def calculate_size(name, reduction): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += INT_SIZE_IN_BYTES return data_size
Calculates the request payload size
def calculate_size(timeout, durability, transaction_type, thread_id): """ Calculates the request payload size""" data_size = 0 data_size += LONG_SIZE_IN_BYTES data_size += INT_SIZE_IN_BYTES data_size += INT_SIZE_IN_BYTES data_size += LONG_SIZE_IN_BYTES return data_size
Encode request into client_message
def encode_request(timeout, durability, transaction_type, thread_id): """ Encode request into client_message""" client_message = ClientMessage(payload_size=calculate_size(timeout, durability, transaction_type, thread_id)) client_message.set_message_type(REQUEST_TYPE) client_message.set_retryable(RETRYAB...
This method does nothing and will simply tell if the next ID will be larger than the given ID. You don't need to call this method on cluster restart - uniqueness is preserved thanks to the timestamp component of the ID. This method exists to make :class:`~hazelcast.proxy.FlakeIdGenerator...
def init(self, id): """ This method does nothing and will simply tell if the next ID will be larger than the given ID. You don't need to call this method on cluster restart - uniqueness is preserved thanks to the timestamp component of the ID. This method exists to make :...
Try to initialize this IdGenerator instance with the given id. The first generated id will be 1 greater than id. :param initial: (long), the given id. :return: (bool), ``true`` if initialization succeeded, ``false`` if id is less than 0.
def init(self, initial): """ Try to initialize this IdGenerator instance with the given id. The first generated id will be 1 greater than id. :param initial: (long), the given id. :return: (bool), ``true`` if initialization succeeded, ``false`` if id is less than 0. """ ...
Generates and returns a cluster-wide unique id. Generated ids are guaranteed to be unique for the entire cluster as long as the cluster is live. If the cluster restarts, then id generation will start from 0. :return: (long), cluster-wide new unique id.
def new_id(self): """ Generates and returns a cluster-wide unique id. Generated ids are guaranteed to be unique for the entire cluster as long as the cluster is live. If the cluster restarts, then id generation will start from 0. :return: (long), cluster-wide new unique id. """ ...
Calculates the request payload size
def calculate_size(name, id): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += calculate_size_str(id) return data_size
Transactional implementation of :func:`Queue.offer(item, timeout) <hazelcast.proxy.queue.Queue.offer>` :param item: (object), the item to be added. :param timeout: (long), maximum time in seconds to wait for addition (optional). :return: (bool), ``true`` if the element was added to this queue, ...
def offer(self, item, timeout=0): """ Transactional implementation of :func:`Queue.offer(item, timeout) <hazelcast.proxy.queue.Queue.offer>` :param item: (object), the item to be added. :param timeout: (long), maximum time in seconds to wait for addition (optional). :return: (bo...
Calculates the request payload size
def calculate_size(name, service_name, target): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += calculate_size_str(service_name) data_size += calculate_size_address(target) return data_size
Calculates the request payload size
def calculate_size(name, entry_processor): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += calculate_size_data(entry_processor) return data_size
Transactional implementation of :func:`MultiMap.put(key, value) <hazelcast.proxy.multi_map.MultiMap.put>` :param key: (object), the key to be stored. :param value: (object), the value to be stored. :return: (bool), ``true`` if the size of the multimap is increased, ``false`` if the multimap alr...
def put(self, key, value): """ Transactional implementation of :func:`MultiMap.put(key, value) <hazelcast.proxy.multi_map.MultiMap.put>` :param key: (object), the key to be stored. :param value: (object), the value to be stored. :return: (bool), ``true`` if the size of the multi...
Transactional implementation of :func:`MultiMap.get(key) <hazelcast.proxy.multi_map.MultiMap.get>` :param key: (object), the key whose associated values are returned. :return: (Sequence), the collection of the values associated with the key.
def get(self, key): """ Transactional implementation of :func:`MultiMap.get(key) <hazelcast.proxy.multi_map.MultiMap.get>` :param key: (object), the key whose associated values are returned. :return: (Sequence), the collection of the values associated with the key. """ c...
Transactional implementation of :func:`MultiMap.remove(key, value) <hazelcast.proxy.multi_map.MultiMap.remove>` :param key: (object), the key of the entry to remove. :param value: (object), the value of the entry to remove. :return:
def remove(self, key, value): """ Transactional implementation of :func:`MultiMap.remove(key, value) <hazelcast.proxy.multi_map.MultiMap.remove>` :param key: (object), the key of the entry to remove. :param value: (object), the value of the entry to remove. :return: ...
Transactional implementation of :func:`MultiMap.remove_all(key) <hazelcast.proxy.multi_map.MultiMap.remove_all>` :param key: (object), the key of the entries to remove. :return: (list), the collection of the values associated with the key.
def remove_all(self, key): """ Transactional implementation of :func:`MultiMap.remove_all(key) <hazelcast.proxy.multi_map.MultiMap.remove_all>` :param key: (object), the key of the entries to remove. :return: (list), the collection of the values associated with the key. ...
Transactional implementation of :func:`MultiMap.value_count(key) <hazelcast.proxy.multi_map.MultiMap.value_count>` :param key: (object), the key whose number of values is to be returned. :return: (int), the number of values matching the given key in the multimap.
def value_count(self, key): """ Transactional implementation of :func:`MultiMap.value_count(key) <hazelcast.proxy.multi_map.MultiMap.value_count>` :param key: (object), the key whose number of values is to be returned. :return: (int), the number of values matching the given key ...
Calculates the request payload size
def calculate_size(name, batch_size): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += INT_SIZE_IN_BYTES return data_size
Decode response from client message
def decode_response(client_message, to_object=None): """ Decode response from client message""" parameters = dict(base=None, increment=None, batch_size=None) parameters['base'] = client_message.read_long() parameters['increment'] = client_message.read_long() parameters['batch_size'] = client_message...
Calculates the request payload size
def calculate_size(name, expected, updated): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += BOOLEAN_SIZE_IN_BYTES if expected is not None: data_size += calculate_size_data(expected) data_size += BOOLEAN_SIZE_IN_BYTES if upd...
Encode request into client_message
def encode_request(name, expected, updated): """ Encode request into client_message""" client_message = ClientMessage(payload_size=calculate_size(name, expected, updated)) client_message.set_message_type(REQUEST_TYPE) client_message.set_retryable(RETRYABLE) client_message.append_str(name) client...
Calculates the request payload size
def calculate_size(name, max_size): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += INT_SIZE_IN_BYTES return data_size
Executes a task on the owner of the specified key. :param key: (object), the specified key. :param task: (Task), a task executed on the owner of the specified key. :return: (:class:`~hazelcast.future.Future`), future representing pending completion of the task.
def execute_on_key_owner(self, key, task): """ Executes a task on the owner of the specified key. :param key: (object), the specified key. :param task: (Task), a task executed on the owner of the specified key. :return: (:class:`~hazelcast.future.Future`), future representing pe...
Encode request into client_message
def encode_request(name, max_size): """ Encode request into client_message""" client_message = ClientMessage(payload_size=calculate_size(name, max_size)) client_message.set_message_type(REQUEST_TYPE) client_message.set_retryable(RETRYABLE) client_message.append_str(name) client_message.append_in...
Executes a task on the specified member. :param member: (Member), the specified member. :param task: (Task), the task executed on the specified member. :return: (:class:`~hazelcast.future.Future`), Future representing pending completion of the task.
def execute_on_member(self, member, task): """ Executes a task on the specified member. :param member: (Member), the specified member. :param task: (Task), the task executed on the specified member. :return: (:class:`~hazelcast.future.Future`), Future representing pending comple...
Executes a task on each of the specified members. :param members: (Collection), the specified members. :param task: (Task), the task executed on the specified members. :return: (Map), :class:`~hazelcast.future.Future` tuples representing pending completion of the task on each member.
def execute_on_members(self, members, task): """ Executes a task on each of the specified members. :param members: (Collection), the specified members. :param task: (Task), the task executed on the specified members. :return: (Map), :class:`~hazelcast.future.Future` tuples repre...
Executes a task on all of the known cluster members. :param task: (Task), the task executed on the all of the members. :return: (Map), :class:`~hazelcast.future.Future` tuples representing pending completion of the task on each member.
def execute_on_all_members(self, task): """ Executes a task on all of the known cluster members. :param task: (Task), the task executed on the all of the members. :return: (Map), :class:`~hazelcast.future.Future` tuples representing pending completion of the task on each member. ...
Calculates the request payload size
def calculate_size(name, replace_existing_values): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += BOOLEAN_SIZE_IN_BYTES return data_size
Event handler
def handle(client_message, handle_event_distributed_object=None, to_object=None): """ Event handler """ message_type = client_message.get_message_type() if message_type == EVENT_DISTRIBUTEDOBJECT and handle_event_distributed_object is not None: name = client_message.read_str() service_name =...
Calculates the request payload size
def calculate_size(name, entries): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += INT_SIZE_IN_BYTES for key, val in six.iteritems(entries): data_size += calculate_size_data(key) data_size += calculate_size_data(val) ret...
Encode request into client_message
def encode_request(name, entries): """ Encode request into client_message""" client_message = ClientMessage(payload_size=calculate_size(name, entries)) client_message.set_message_type(REQUEST_TYPE) client_message.set_retryable(RETRYABLE) client_message.append_str(name) client_message.append_int(...
Add a listener object to listen for lifecycle events. :param on_lifecycle_change: (Function), function to be called when LifeCycle state is changed. :return: (str), id of the listener.
def add_listener(self, on_lifecycle_change): """ Add a listener object to listen for lifecycle events. :param on_lifecycle_change: (Function), function to be called when LifeCycle state is changed. :return: (str), id of the listener. """ id = str(uuid.uuid4()) se...
Removes a lifecycle listener. :param registration_id: (str), the id of the listener to be removed. :return: (bool), ``true`` if the listener is removed successfully, ``false`` otherwise.
def remove_listener(self, registration_id): """ Removes a lifecycle listener. :param registration_id: (str), the id of the listener to be removed. :return: (bool), ``true`` if the listener is removed successfully, ``false`` otherwise. """ try: self._listeners...
Called when instance's state changes. :param new_state: (Lifecycle State), the new state of the instance.
def fire_lifecycle_event(self, new_state): """ Called when instance's state changes. :param new_state: (Lifecycle State), the new state of the instance. """ if new_state == LIFECYCLE_STATE_SHUTTING_DOWN: self.is_live = False self.state = new_state se...
Event handler
def handle(client_message, handle_event_item=None, to_object=None): """ Event handler """ message_type = client_message.get_message_type() if message_type == EVENT_ITEM and handle_event_item is not None: item = None if not client_message.read_bool(): item = client_message.read_da...
Calculates the request payload size
def calculate_size(name, value, timeout_millis): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += calculate_size_data(value) data_size += LONG_SIZE_IN_BYTES return data_size
Acquires the lock. If a lease time is specified, lock will be released after this lease time. If the lock is not available, the current thread becomes disabled for thread scheduling purposes and lies dormant until the lock has been acquired. :param lease_time: (long), time to wait before relea...
def lock(self, lease_time=-1): """ Acquires the lock. If a lease time is specified, lock will be released after this lease time. If the lock is not available, the current thread becomes disabled for thread scheduling purposes and lies dormant until the lock has been acquired. :...
Tries to acquire the lock. When the lock is not available, * If timeout is not provided, the current thread doesn't wait and returns ``false`` immediately. * If a timeout is provided, the current thread becomes disabled for thread scheduling purposes and lies dormant until one of th...
def try_lock(self, timeout=0, lease_time=-1): """ Tries to acquire the lock. When the lock is not available, * If timeout is not provided, the current thread doesn't wait and returns ``false`` immediately. * If a timeout is provided, the current thread becomes disabled for threa...
Releases the lock.
def unlock(self): """ Releases the lock. """ return self._encode_invoke(lock_unlock_codec, thread_id=thread_id(), reference_id=self.reference_id_generator.get_and_increment())
Calculates the request payload size
def calculate_size(name, txn_id, thread_id, key, value): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += calculate_size_str(txn_id) data_size += LONG_SIZE_IN_BYTES data_size += calculate_size_data(key) data_size += calculate_size_da...
Calculates the request payload size
def calculate_size(name, new_value): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += BOOLEAN_SIZE_IN_BYTES if new_value is not None: data_size += calculate_size_data(new_value) return data_size
Calculates the request payload size
def calculate_size(name, key, thread_id): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += calculate_size_data(key) data_size += LONG_SIZE_IN_BYTES return data_size
Decode response from client message
def decode_response(client_message, to_object=None): """ Decode response from client message""" parameters = dict(response=None) if not client_message.read_bool(): parameters['response'] = EntryViewCodec.decode(client_message, to_object) return parameters
Encode request into client_message
def encode_request(name, entries): """ Encode request into client_message""" client_message = ClientMessage(payload_size=calculate_size(name, entries)) client_message.set_message_type(REQUEST_TYPE) client_message.set_retryable(RETRYABLE) client_message.append_str(name) client_message.append_int(...
Adds an entry listener for this multimap. The listener will be notified for all multimap add/remove/clear-all events. :param include_value: (bool), whether received event should include the value or not (optional). :param key: (object), key for filtering the events (optional). :param ad...
def add_entry_listener(self, include_value=False, key=None, added_func=None, removed_func=None, clear_all_func=None): """ Adds an entry listener for this multimap. The listener will be notified for all multimap add/remove/clear-all events. :param include_value: (bool), whether received ...
Determines whether this multimap contains an entry with the key. **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations of __hash__ and __eq__ defined in key's class.** :param key: (object), the specified key. :return: (bool), ...
def contains_key(self, key): """ Determines whether this multimap contains an entry with the key. **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations of __hash__ and __eq__ defined in key's class.** :param key: (obje...
Determines whether this map contains one or more keys for the specified value. :param value: (object), the specified value. :return: (bool), ``true`` if this multimap contains an entry for the specified value.
def contains_value(self, value): """ Determines whether this map contains one or more keys for the specified value. :param value: (object), the specified value. :return: (bool), ``true`` if this multimap contains an entry for the specified value. """ check_not_none(value...
Returns whether the multimap contains an entry with the value. :param key: (object), the specified key. :param value: (object), the specified value. :return: (bool), ``true`` if this multimap contains the key-value tuple.
def contains_entry(self, key, value): """ Returns whether the multimap contains an entry with the value. :param key: (object), the specified key. :param value: (object), the specified value. :return: (bool), ``true`` if this multimap contains the key-value tuple. """ ...
Returns the list of values associated with the key. ``None`` if this map does not contain this key. **Warning: This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.** **Warning-2: Th...
def get(self, key): """ Returns the list of values associated with the key. ``None`` if this map does not contain this key. **Warning: This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's c...
Checks the lock for the specified key. If the lock is acquired, returns ``true``. Otherwise, returns false. **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations of __hash__ and __eq__ defined in key's class.** :param key: (object), t...
def is_locked(self, key): """ Checks the lock for the specified key. If the lock is acquired, returns ``true``. Otherwise, returns false. **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations of __hash__ and __eq__ defined in k...
Acquires the lock for the specified key infinitely or for the specified lease time if provided. If the lock is not available, the current thread becomes disabled for thread scheduling purposes and lies dormant until the lock has been acquired. Scope of the lock is this map only. Acquired lock ...
def lock(self, key, lease_time=-1): """ Acquires the lock for the specified key infinitely or for the specified lease time if provided. If the lock is not available, the current thread becomes disabled for thread scheduling purposes and lies dormant until the lock has been acquired. ...
Removes the given key-value tuple from the multimap. **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations of __hash__ and __eq__ defined in key's class.** :param key: (object), the key of the entry to remove. :param value: (...
def remove(self, key, value): """ Removes the given key-value tuple from the multimap. **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations of __hash__ and __eq__ defined in key's class.** :param key: (object), the k...
Removes all the entries with the given key and returns the value list associated with this key. **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations of __hash__ and __eq__ defined in key's class.** **Warning-2: The returned l...
def remove_all(self, key): """ Removes all the entries with the given key and returns the value list associated with this key. **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations of __hash__ and __eq__ defined in key's class....
Stores a key-value tuple in the multimap. **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations of __hash__ and __eq__ defined in key's class.** :param key: (object), the key to be stored. :param value: (object), the value to ...
def put(self, key, value): """ Stores a key-value tuple in the multimap. **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations of __hash__ and __eq__ defined in key's class.** :param key: (object), the key to be stored...
Removes the specified entry listener. Returns silently if there is no such listener added before. :param registration_id: (str), id of registered listener. :return: (bool), ``true`` if registration is removed, ``false`` otherwise.
def remove_entry_listener(self, registration_id): """ Removes the specified entry listener. Returns silently if there is no such listener added before. :param registration_id: (str), id of registered listener. :return: (bool), ``true`` if registration is removed, ``false`` otherwise. ...
Returns the number of values that match the given key in the multimap. **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations of __hash__ and __eq__ defined in key's class.** :param key: (object), the key whose values count is to be re...
def value_count(self, key): """ Returns the number of values that match the given key in the multimap. **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations of __hash__ and __eq__ defined in key's class.** :param key: ...
Tries to acquire the lock for the specified key. When the lock is not available, * If timeout is not provided, the current thread doesn't wait and returns ``false`` immediately. * If a timeout is provided, the current thread becomes disabled for thread scheduling purposes and lies ...
def try_lock(self, key, lease_time=-1, timeout=-1): """ Tries to acquire the lock for the specified key. When the lock is not available, * If timeout is not provided, the current thread doesn't wait and returns ``false`` immediately. * If a timeout is provided, the current threa...
Calculates the request payload size
def calculate_size(name, values): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += INT_SIZE_IN_BYTES for values_item in values: data_size += calculate_size_data(values_item) return data_size
Encode request into client_message
def encode_request(name, values): """ Encode request into client_message""" client_message = ClientMessage(payload_size=calculate_size(name, values)) client_message.set_message_type(REQUEST_TYPE) client_message.set_retryable(RETRYABLE) client_message.append_str(name) client_message.append_int(le...
Transactional implementation of :func:`Map.contains_key(key) <hazelcast.proxy.map.Map.contains_key>` :param key: (object), the specified key. :return: (bool), ``true`` if this map contains an entry for the specified key, ``false`` otherwise.
def contains_key(self, key): """ Transactional implementation of :func:`Map.contains_key(key) <hazelcast.proxy.map.Map.contains_key>` :param key: (object), the specified key. :return: (bool), ``true`` if this map contains an entry for the specified key, ``false`` otherwise. """ ...
Transactional implementation of :func:`Map.get(key) <hazelcast.proxy.map.Map.get>` :param key: (object), the specified key. :return: (object), the value for the specified key.
def get(self, key): """ Transactional implementation of :func:`Map.get(key) <hazelcast.proxy.map.Map.get>` :param key: (object), the specified key. :return: (object), the value for the specified key. """ check_not_none(key, "key can't be none") return self._encod...
Locks the key and then gets and returns the value to which the specified key is mapped. Lock will be released at the end of the transaction (either commit or rollback). :param key: (object), the specified key. :return: (object), the value for the specified key. .. seealso:: ...
def get_for_update(self, key): """ Locks the key and then gets and returns the value to which the specified key is mapped. Lock will be released at the end of the transaction (either commit or rollback). :param key: (object), the specified key. :return: (object), the value for t...
Transactional implementation of :func:`Map.put(key, value, ttl) <hazelcast.proxy.map.Map.put>` The object to be put will be accessible only in the current transaction context till the transaction is committed. :param key: (object), the specified key. :param value: (object), the value t...
def put(self, key, value, ttl=-1): """ Transactional implementation of :func:`Map.put(key, value, ttl) <hazelcast.proxy.map.Map.put>` The object to be put will be accessible only in the current transaction context till the transaction is committed. :param key: (object), the spe...
Transactional implementation of :func:`Map.put_if_absent(key, value) <hazelcast.proxy.map.Map.put_if_absent>` The object to be put will be accessible only in the current transaction context till the transaction is committed. :param key: (object), key of the entry. :param value:...
def put_if_absent(self, key, value): """ Transactional implementation of :func:`Map.put_if_absent(key, value) <hazelcast.proxy.map.Map.put_if_absent>` The object to be put will be accessible only in the current transaction context till the transaction is committed. :par...
Transactional implementation of :func:`Map.set(key, value) <hazelcast.proxy.map.Map.set>` The object to be set will be accessible only in the current transaction context till the transaction is committed. :param key: (object), key of the entry. :param value: (object), value of the entr...
def set(self, key, value): """ Transactional implementation of :func:`Map.set(key, value) <hazelcast.proxy.map.Map.set>` The object to be set will be accessible only in the current transaction context till the transaction is committed. :param key: (object), key of the entry. ...
Transactional implementation of :func:`Map.replace(key, value) <hazelcast.proxy.map.Map.replace>` The object to be replaced will be accessible only in the current transaction context till the transaction is committed. :param key: (object), the specified key. :param value: (object), the...
def replace(self, key, value): """ Transactional implementation of :func:`Map.replace(key, value) <hazelcast.proxy.map.Map.replace>` The object to be replaced will be accessible only in the current transaction context till the transaction is committed. :param key: (object), the...
Transactional implementation of :func:`Map.replace_if_same(key, old_value, new_value) <hazelcast.proxy.map.Map.replace_if_same>` The object to be replaced will be accessible only in the current transaction context till the transaction is committed. :param key: (object), the specified k...
def replace_if_same(self, key, old_value, new_value): """ Transactional implementation of :func:`Map.replace_if_same(key, old_value, new_value) <hazelcast.proxy.map.Map.replace_if_same>` The object to be replaced will be accessible only in the current transaction context till the transa...
Transactional implementation of :func:`Map.remove(key) <hazelcast.proxy.map.Map.remove>` The object to be removed will be removed from only the current transaction context until the transaction is committed. :param key: (object), key of the mapping to be deleted. :return: (object), the...
def remove(self, key): """ Transactional implementation of :func:`Map.remove(key) <hazelcast.proxy.map.Map.remove>` The object to be removed will be removed from only the current transaction context until the transaction is committed. :param key: (object), key of the mapping to...
Transactional implementation of :func:`Map.remove_if_same(key, value) <hazelcast.proxy.map.Map.remove_if_same>` The object to be removed will be removed from only the current transaction context until the transaction is committed. :param key: (object), the specified key. :param...
def remove_if_same(self, key, value): """ Transactional implementation of :func:`Map.remove_if_same(key, value) <hazelcast.proxy.map.Map.remove_if_same>` The object to be removed will be removed from only the current transaction context until the transaction is committed. ...
Transactional implementation of :func:`Map.delete(key) <hazelcast.proxy.map.Map.delete>` The object to be deleted will be removed from only the current transaction context until the transaction is committed. :param key: (object), key of the mapping to be deleted.
def delete(self, key): """ Transactional implementation of :func:`Map.delete(key) <hazelcast.proxy.map.Map.delete>` The object to be deleted will be removed from only the current transaction context until the transaction is committed. :param key: (object), key of the mapping to...
Transactional implementation of :func:`Map.key_set(predicate) <hazelcast.proxy.map.Map.key_set>` :param predicate: (Predicate), predicate to filter the entries (optional). :return: (Sequence), a list of the clone of the keys. .. seealso:: :class:`~hazelcast.serialization.predicate....
def key_set(self, predicate=None): """ Transactional implementation of :func:`Map.key_set(predicate) <hazelcast.proxy.map.Map.key_set>` :param predicate: (Predicate), predicate to filter the entries (optional). :return: (Sequence), a list of the clone of the keys. .. seealso:: ...
Transactional implementation of :func:`Map.values(predicate) <hazelcast.proxy.map.Map.values>` :param predicate: (Predicate), predicate to filter the entries (optional). :return: (Sequence), a list of clone of the values contained in this map. .. seealso:: :class:`~hazelcast.serial...
def values(self, predicate=None): """ Transactional implementation of :func:`Map.values(predicate) <hazelcast.proxy.map.Map.values>` :param predicate: (Predicate), predicate to filter the entries (optional). :return: (Sequence), a list of clone of the values contained in this map. ...
Alters the currently stored reference by applying a function on it. :param function: (Function), A stateful serializable object which represents the Function defined on server side. This object must have a serializable Function counter part registered on server side with the actual ...
def alter(self, function): """ Alters the currently stored reference by applying a function on it. :param function: (Function), A stateful serializable object which represents the Function defined on server side. This object must have a serializable Function counter part...
Applies a function on the value, the actual stored value will not change. :param function: (Function), A stateful serializable object which represents the Function defined on server side. This object must have a serializable Function counter part registered on server side with the actua...
def apply(self, function): """ Applies a function on the value, the actual stored value will not change. :param function: (Function), A stateful serializable object which represents the Function defined on server side. This object must have a serializable Function counte...
Alters the currently stored reference by applying a function on it and gets the result. :param function: (Function), A stateful serializable object which represents the Function defined on server side. This object must have a serializable Function counter part registered on server side ...
def alter_and_get(self, function): """ Alters the currently stored reference by applying a function on it and gets the result. :param function: (Function), A stateful serializable object which represents the Function defined on server side. This object must have a serial...
Atomically sets the value to the given updated value only if the current value == the expected value. :param expected: (object), the expected value. :param updated: (object), the new value. :return: (bool), ``true`` if successful; or ``false`` if the actual value was not equal to the expected v...
def compare_and_set(self, expected, updated): """ Atomically sets the value to the given updated value only if the current value == the expected value. :param expected: (object), the expected value. :param updated: (object), the new value. :return: (bool), ``true`` if successful...
Checks if the reference contains the value. :param expected: (object), the value to check (is allowed to be ``None``). :return: (bool), ``true`` if the value is found, ``false`` otherwise.
def contains(self, expected): """ Checks if the reference contains the value. :param expected: (object), the value to check (is allowed to be ``None``). :return: (bool), ``true`` if the value is found, ``false`` otherwise. """ return self._encode_invoke(atomic_reference...
Alters the currently stored reference by applying a function on it on and gets the old value. :param function: (Function), A stateful serializable object which represents the Function defined on server side. This object must have a serializable Function counter part registered on server...
def get_and_alter(self, function): """ Alters the currently stored reference by applying a function on it on and gets the old value. :param function: (Function), A stateful serializable object which represents the Function defined on server side. This object must have a ...
Gets the old value and sets the new value. :param new_value: (object), the new value. :return: (object), the old value.
def get_and_set(self, new_value): """ Gets the old value and sets the new value. :param new_value: (object), the new value. :return: (object), the old value. """ return self._encode_invoke(atomic_reference_get_and_set_codec, new_value=s...
Atomically sets the given value. :param new_value: (object), the new value.
def set(self, new_value): """ Atomically sets the given value. :param new_value: (object), the new value. """ return self._encode_invoke(atomic_reference_set_codec, new_value=self._to_data(new_value))
Sets and gets the value. :param new_value: (object), the new value. :return: (object), the new value.
def set_and_get(self, new_value): """ Sets and gets the value. :param new_value: (object), the new value. :return: (object), the new value. """ return self._encode_invoke(atomic_reference_set_and_get_codec, new_value=self._to_data(new_v...
Calculates the request payload size
def calculate_size(name, uuid, callable, address): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += calculate_size_str(uuid) data_size += calculate_size_data(callable) data_size += calculate_size_address(address) return data_size
Encode request into client_message
def encode_request(name, uuid, callable, address): """ Encode request into client_message""" client_message = ClientMessage(payload_size=calculate_size(name, uuid, callable, address)) client_message.set_message_type(REQUEST_TYPE) client_message.set_retryable(RETRYABLE) client_message.append_str(name...
Calculates the request payload size
def calculate_size(name, registration_id): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += calculate_size_str(registration_id) return data_size
Returns serialization type of binary form. :return: Serialization type of binary form.
def get_type(self): """ Returns serialization type of binary form. :return: Serialization type of binary form. """ if self.total_size() == 0: return CONSTANT_TYPE_NULL return unpack_from(FMT_BE_INT, self._buffer, TYPE_OFFSET)[0]
Returns partition hash calculated for serialized object. Partition hash is used to determine partition of a Data and is calculated using * PartitioningStrategy during serialization. * If partition hash is not set then hash_code() is used. :return: partition hash
def get_partition_hash(self): """ Returns partition hash calculated for serialized object. Partition hash is used to determine partition of a Data and is calculated using * PartitioningStrategy during serialization. * If partition hash is not set then hash_cod...
Determines whether this Data has partition hash or not. :return: (bool), ``true`` if Data has partition hash, ``false`` otherwise.
def has_partition_hash(self): """ Determines whether this Data has partition hash or not. :return: (bool), ``true`` if Data has partition hash, ``false`` otherwise. """ return self._buffer is not None \ and len(self._buffer) >= HEAP_DATA_OVERHEAD \ ...
Calculates the request payload size
def calculate_size(name, overflow_policy, value): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += INT_SIZE_IN_BYTES data_size += calculate_size_data(value) return data_size
Decode response from client message
def decode_response(client_message, to_object=None): """ Decode response from client message""" parameters = dict(response=None) parameters['response'] = client_message.read_long() return parameters
Serialize the input object into byte array representation :param obj: input object :param partitioning_strategy: function in the form of lambda key:partitioning_key :return: Data object
def to_data(self, obj, partitioning_strategy=None): """ Serialize the input object into byte array representation :param obj: input object :param partitioning_strategy: function in the form of lambda key:partitioning_key :return: Data object """ if obj is None: ...
Deserialize input data :param data: serialized input Data object :return: Deserialized object
def to_object(self, data): """ Deserialize input data :param data: serialized input Data object :return: Deserialized object """ if not isinstance(data, Data): return data if is_null_data(data): return None inp = self._create_data_...
Find and return the serializer for the type-id :param type_id: type-id the serializer :return: the serializer
def serializer_by_type_id(self, type_id): """ Find and return the serializer for the type-id :param type_id: type-id the serializer :return: the serializer """ if type_id <= 0: indx = index_for_default_type(type_id) serializer = self._constant_type...
Searches for a serializer for the provided object Serializers will be searched in this order; 1-NULL serializer 2-Default serializers, like primitives, arrays, string and some default types 3-Custom registered types by user 4-Global serializer if registered ...
def serializer_for(self, obj): """ Searches for a serializer for the provided object Serializers will be searched in this order; 1-NULL serializer 2-Default serializers, like primitives, arrays, string and some default types 3-Custom registered types...
Determines whether this record is expired or not. :param max_idle_seconds: (long), the maximum idle time of record, maximum time after the last access time. :return: (bool), ``true`` is this record is not expired.
def is_expired(self, max_idle_seconds): """ Determines whether this record is expired or not. :param max_idle_seconds: (long), the maximum idle time of record, maximum time after the last access time. :return: (bool), ``true`` is this record is not expired. """ now = cu...
Returns the statistics of the NearCache. :return: (Dict), Dictionary that stores statistics related to this near cache.
def get_statistics(self): """ Returns the statistics of the NearCache. :return: (Dict), Dictionary that stores statistics related to this near cache. """ stats = { "creation_time": self._creation_time_in_seconds, "evictions": self._evictions, "...
Combines set of Futures. :param futures: (Futures), Futures to be combined. :return: Result of the combination.
def combine_futures(*futures): """ Combines set of Futures. :param futures: (Futures), Futures to be combined. :return: Result of the combination. """ expected = len(futures) results = [] completed = AtomicInteger() combined = Future() def done(f): if not combined.done(...
Sets the result of the Future. :param result: Result of the Future.
def set_result(self, result): """ Sets the result of the Future. :param result: Result of the Future. """ if result is None: self._result = NONE_RESULT else: self._result = result self._event.set() self._invoke_callbacks()
Sets the exception for this Future in case of errors. :param exception: (Exception), exception to be threw in case of error. :param traceback: (Function), function to be called on traceback (optional).
def set_exception(self, exception, traceback=None): """ Sets the exception for this Future in case of errors. :param exception: (Exception), exception to be threw in case of error. :param traceback: (Function), function to be called on traceback (optional). """ if not is...
Returns the result of the Future, which makes the call synchronous if the result has not been computed yet. :return: Result of the Future.
def result(self): """ Returns the result of the Future, which makes the call synchronous if the result has not been computed yet. :return: Result of the Future. """ self._reactor_check() self._event.wait() if self._exception: six.reraise(self._excepti...
Create a continuation that executes when the Future is completed. :param continuation_func: A function which takes the future as the only parameter. Return value of the function will be set as the result of the continuation future. :return: A new Future which will be completed when the continua...
def continue_with(self, continuation_func, *args): """ Create a continuation that executes when the Future is completed. :param continuation_func: A function which takes the future as the only parameter. Return value of the function will be set as the result of the continuation future. ...
Gets the existing connection for a given address. If it does not exist, the system will try to connect asynchronously. In this case, it returns a Future. When the connection is established at some point in time, it can be retrieved by using the get_connection(:class:`~hazelcast.core.Address`) or from Fu...
def get_or_connect(self, address, authenticator=None): """ Gets the existing connection for a given address. If it does not exist, the system will try to connect asynchronously. In this case, it returns a Future. When the connection is established at some point in time, it can be retriev...
Checks for authentication of a connection. :param f: (:class:`~hazelcast.future.Future`), future that contains the result of authentication. :param connection: (:class:`~hazelcast.connection.Connection`), newly established connection. :param address: (:class:`~hazelcast.core.Address`), the adre...
def on_auth(self, f, connection, address): """ Checks for authentication of a connection. :param f: (:class:`~hazelcast.future.Future`), future that contains the result of authentication. :param connection: (:class:`~hazelcast.connection.Connection`), newly established connection. ...