Set

class Set(service_name, name, context)[source]

Bases: hazelcast.proxy.base.PartitionSpecificProxy, Generic[hazelcast.types.ItemType]

Concurrent, distributed implementation of Set

add(item: hazelcast.types.ItemType) hazelcast.future.Future[bool][source]

Adds the specified item if it is not exists in this set.

Parameters

item – The specified item to be added.

Returns

True if this set is changed after call, False otherwise.

add_all(items: Sequence[hazelcast.types.ItemType]) hazelcast.future.Future[bool][source]

Adds the elements in the specified collection if they’re not exist in this set.

Parameters

items – Collection which includes the items to be added.

Returns

True if this set is changed after call, False otherwise.

add_listener(include_value: bool = False, item_added_func: Optional[Callable[[hazelcast.proxy.base.ItemEvent[hazelcast.types.ItemType]], None]] = None, item_removed_func: Optional[Callable[[hazelcast.proxy.base.ItemEvent[hazelcast.types.ItemType]], None]] = None) hazelcast.future.Future[str][source]

Adds an item listener for this container.

Listener will be notified for all container add/remove events.

Parameters
  • include_value – Whether received events include the updated item or not.

  • item_added_func – Function to be called when an item is added to this set.

  • item_removed_func – Function to be called when an item is deleted from this set.

Returns

A registration id which is used as a key to remove the listener.

clear() hazelcast.future.Future[None][source]

Clears the set. Set will be empty with this call.

contains(item: hazelcast.types.ItemType) hazelcast.future.Future[bool][source]

Determines whether this set contains the specified item or not.

Parameters

item – The specified item to be searched.

Returns

True if the specified item exists in this set, False otherwise.

contains_all(items: Sequence[hazelcast.types.ItemType]) hazelcast.future.Future[bool][source]

Determines whether this set contains all items in the specified collection or not.

Parameters

items – The specified collection which includes the items to be searched.

Returns

True if all the items in the specified collection exist in this set, False otherwise.

get_all() hazelcast.future.Future[List[hazelcast.types.ItemType]][source]

Returns all the items in the set.

Returns

List of the items in this set.

is_empty() hazelcast.future.Future[bool][source]

Determines whether this set is empty or not.

Returns

True if this set is empty, False otherwise.

remove(item: hazelcast.types.ItemType) hazelcast.future.Future[bool][source]

Removes the specified element from the set if it exists.

Parameters

item – The specified element to be removed.

Returns

True if the specified element exists in this set, False otherwise.

remove_all(items: Sequence[hazelcast.types.ItemType]) hazelcast.future.Future[bool][source]

Removes all of the elements of the specified collection from this set.

Parameters

items – The specified collection.

Returns

True if the call changed this set, False otherwise.

remove_listener(registration_id: str) hazelcast.future.Future[bool][source]

Removes the specified item listener.

Returns silently if the specified listener was not added before.

Parameters

registration_id – Id of the listener to be deleted.

Returns

True if the item listener is removed, False otherwise.

retain_all(items: Sequence[hazelcast.types.ItemType]) hazelcast.future.Future[bool][source]

Removes the items which are not contained in the specified collection.

In other words, only the items that are contained in the specified collection will be retained.

Parameters

items – Collection which includes the elements to be retained in this set.

Returns

True if this set changed as a result of the call, False otherwise.

size() hazelcast.future.Future[int][source]

Returns the number of items in this set.

Returns

Number of items in this set.

blocking() hazelcast.proxy.set.BlockingSet[hazelcast.types.ItemType][source]

Returns a version of this proxy with only blocking method calls.

class BlockingSet(wrapped: hazelcast.proxy.set.Set[hazelcast.types.ItemType])[source]

Bases: hazelcast.proxy.set.Set[hazelcast.types.ItemType]

name
service_name
add(item: hazelcast.types.ItemType) bool[source]

Adds the specified item if it is not exists in this set.

Parameters

item – The specified item to be added.

Returns

True if this set is changed after call, False otherwise.

add_all(items: Sequence[hazelcast.types.ItemType]) bool[source]

Adds the elements in the specified collection if they’re not exist in this set.

Parameters

items – Collection which includes the items to be added.

Returns

True if this set is changed after call, False otherwise.

add_listener(include_value: bool = False, item_added_func: Optional[Callable[[hazelcast.proxy.base.ItemEvent[hazelcast.types.ItemType]], None]] = None, item_removed_func: Optional[Callable[[hazelcast.proxy.base.ItemEvent[hazelcast.types.ItemType]], None]] = None) str[source]

Adds an item listener for this container.

Listener will be notified for all container add/remove events.

Parameters
  • include_value – Whether received events include the updated item or not.

  • item_added_func – Function to be called when an item is added to this set.

  • item_removed_func – Function to be called when an item is deleted from this set.

Returns

A registration id which is used as a key to remove the listener.

clear() None[source]

Clears the set. Set will be empty with this call.

contains(item: hazelcast.types.ItemType) bool[source]

Determines whether this set contains the specified item or not.

Parameters

item – The specified item to be searched.

Returns

True if the specified item exists in this set, False otherwise.

contains_all(items: Sequence[hazelcast.types.ItemType]) bool[source]

Determines whether this set contains all items in the specified collection or not.

Parameters

items – The specified collection which includes the items to be searched.

Returns

True if all the items in the specified collection exist in this set, False otherwise.

get_all() List[hazelcast.types.ItemType][source]

Returns all the items in the set.

Returns

List of the items in this set.

is_empty() bool[source]

Determines whether this set is empty or not.

Returns

True if this set is empty, False otherwise.

remove(item: hazelcast.types.ItemType) bool[source]

Removes the specified element from the set if it exists.

Parameters

item – The specified element to be removed.

Returns

True if the specified element exists in this set, False otherwise.

remove_all(items: Sequence[hazelcast.types.ItemType]) bool[source]

Removes all of the elements of the specified collection from this set.

Parameters

items – The specified collection.

Returns

True if the call changed this set, False otherwise.

remove_listener(registration_id: str) bool[source]

Removes the specified item listener.

Returns silently if the specified listener was not added before.

Parameters

registration_id – Id of the listener to be deleted.

Returns

True if the item listener is removed, False otherwise.

retain_all(items: Sequence[hazelcast.types.ItemType]) bool[source]

Removes the items which are not contained in the specified collection.

In other words, only the items that are contained in the specified collection will be retained.

Parameters

items – Collection which includes the elements to be retained in this set.

Returns

True if this set changed as a result of the call, False otherwise.

size() int[source]

Returns the number of items in this set.

Returns

Number of items in this set.

blocking() hazelcast.proxy.set.BlockingSet[hazelcast.types.ItemType][source]

Returns a version of this proxy with only blocking method calls.

destroy() bool[source]

Destroys this proxy.

Returns

True if this proxy is destroyed successfully, False otherwise.