Skip to content

Commit bc94756

Browse files
authored
Make public attributes of the client properties and document them (#411)
We were not documenting the public attributes of the client. Now, we are doing it with their types, which has more documentation. Also, made them read-only properties.
1 parent 464b2d3 commit bc94756

File tree

2 files changed

+42
-8
lines changed

2 files changed

+42
-8
lines changed

hazelcast/client.py

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -335,20 +335,20 @@ def __init__(self, **kwargs):
335335
self._config = config
336336
self._context = _ClientContext()
337337
client_id = HazelcastClient._CLIENT_ID.get_and_increment()
338-
self.name = self._create_client_name(client_id)
338+
self._name = self._create_client_name(client_id)
339339
self._reactor = AsyncoreReactor()
340340
self._serialization_service = SerializationServiceV1(config)
341341
self._near_cache_manager = NearCacheManager(config, self._serialization_service)
342342
self._internal_lifecycle_service = _InternalLifecycleService(config)
343-
self.lifecycle_service = LifecycleService(self._internal_lifecycle_service)
343+
self._lifecycle_service = LifecycleService(self._internal_lifecycle_service)
344344
self._invocation_service = InvocationService(self, config, self._reactor)
345345
self._address_provider = self._create_address_provider()
346346
self._internal_partition_service = _InternalPartitionService(self)
347-
self.partition_service = PartitionService(
347+
self._partition_service = PartitionService(
348348
self._internal_partition_service, self._serialization_service
349349
)
350350
self._internal_cluster_service = _InternalClusterService(self, config)
351-
self.cluster_service = ClusterService(self._internal_cluster_service)
351+
self._cluster_service = ClusterService(self._internal_cluster_service)
352352
self._connection_manager = ConnectionManager(
353353
self,
354354
config,
@@ -365,7 +365,7 @@ def __init__(self, **kwargs):
365365
self, config, self._connection_manager, self._invocation_service
366366
)
367367
self._proxy_manager = ProxyManager(self._context)
368-
self.cp_subsystem = CPSubsystem(self._context)
368+
self._cp_subsystem = CPSubsystem(self._context)
369369
self._proxy_session_manager = ProxySessionManager(self._context)
370370
self._transaction_manager = TransactionManager(self._context)
371371
self._lock_reference_id_generator = AtomicInteger(1)
@@ -404,7 +404,7 @@ def _init_context(self):
404404
self._proxy_manager,
405405
self._near_cache_manager,
406406
self._lock_reference_id_generator,
407-
self.name,
407+
self._name,
408408
self._proxy_session_manager,
409409
self._reactor,
410410
)
@@ -425,7 +425,7 @@ def _start(self):
425425

426426
self._listener_service.start()
427427
self._invocation_service.add_backup_listener()
428-
self._load_balancer.init(self.cluster_service)
428+
self._load_balancer.init(self._cluster_service)
429429
self._statistics.start()
430430
except:
431431
self.shutdown()
@@ -667,6 +667,39 @@ def shutdown(self):
667667
self._reactor.shutdown()
668668
self._internal_lifecycle_service.fire_lifecycle_event(LifecycleState.SHUTDOWN)
669669

670+
@property
671+
def name(self):
672+
"""str: Name of the client."""
673+
return self._name
674+
675+
@property
676+
def lifecycle_service(self):
677+
"""LifecycleService: Lifecycle service allows you to check if the
678+
client is running and add and remove lifecycle listeners.
679+
"""
680+
return self._lifecycle_service
681+
682+
@property
683+
def partition_service(self):
684+
"""PartitionService: Partition service allows you to get partition
685+
count, introspect the partition owners, and partition ids of keys.
686+
"""
687+
return self._partition_service
688+
689+
@property
690+
def cluster_service(self):
691+
"""ClusterService: Cluster service allows you to get the list of
692+
the cluster members and add and remove membership listeners.
693+
"""
694+
return self._cluster_service
695+
696+
@property
697+
def cp_subsystem(self):
698+
"""CPSubsystem: CP Subsystem offers set of in-memory linearizable
699+
data structures.
700+
"""
701+
return self._cp_subsystem
702+
670703
def _create_address_provider(self):
671704
config = self._config
672705
cluster_members = config.cluster_members

hazelcast/partition.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ def __repr__(self):
2020

2121
class PartitionService(object):
2222
"""
23-
Allows to retrieve information about the partition count, the partition owner or the partitionId of a key.
23+
Allows to retrieve information about the partition count, the partition owner
24+
or the partition id of a key.
2425
"""
2526

2627
__slots__ = ("_service", "_serialization_service")

0 commit comments

Comments
 (0)