4949from .api import cache_get_node_partitions
5050from .api .binary import get_binary_type , put_binary_type
5151from .api .cache_config import cache_get_names
52+ from .cluster import Cluster
5253from .cursors import SqlFieldsCursor
5354from .cache import Cache , create_cache , get_cache , get_or_create_cache , BaseCache
5455from .connection import Connection
@@ -83,32 +84,32 @@ def __init__(self, compact_footer: bool = None, partition_aware: bool = False, *
8384 self ._partition_aware = partition_aware
8485 self .affinity_version = (0 , 0 )
8586 self ._affinity = {'version' : self .affinity_version , 'partition_mapping' : defaultdict (dict )}
86- self ._protocol_version = None
87+ self ._protocol_context = None
8788
8889 @property
89- def protocol_version (self ):
90+ def protocol_context (self ):
9091 """
91- Returns the tuple of major, minor, and revision numbers of the used
92- thin protocol version, or None, if no connection to the Ignite cluster
93- was not yet established.
92+ Returns protocol context, or None, if no connection to the Ignite
93+ cluster was not yet established.
9494
9595 This method is not a part of the public API. Unless you wish to
9696 extend the `pyignite` capabilities (with additional testing, logging,
9797 examining connections, et c.) you probably should not use it.
9898 """
99- return self ._protocol_version
99+ return self ._protocol_context
100100
101- @protocol_version .setter
102- def protocol_version (self , value ):
103- self ._protocol_version = value
101+ @protocol_context .setter
102+ def protocol_context (self , value ):
103+ self ._protocol_context = value
104104
105105 @property
106106 def partition_aware (self ):
107107 return self ._partition_aware and self .partition_awareness_supported_by_protocol
108108
109109 @property
110110 def partition_awareness_supported_by_protocol (self ):
111- return self .protocol_version is not None and self .protocol_version >= (1 , 4 , 0 )
111+ return self .protocol_context is not None \
112+ and self .protocol_context .is_partition_awareness_supported ()
112113
113114 @property
114115 def compact_footer (self ) -> bool :
@@ -379,7 +380,7 @@ def _connect(self, nodes):
379380 conn = Connection (self , host , port , ** self ._connection_args )
380381
381382 try :
382- if self .protocol_version is None or self .partition_aware :
383+ if self .protocol_context is None or self .partition_aware :
383384 # open connection before adding to the pool
384385 conn .connect ()
385386
@@ -396,7 +397,7 @@ def _connect(self, nodes):
396397
397398 self ._nodes .append (conn )
398399
399- if self .protocol_version is None :
400+ if self .protocol_context is None :
400401 raise ReconnectError ('Can not connect.' )
401402
402403 def close (self ):
@@ -727,3 +728,11 @@ def sql(
727728 return SqlFieldsCursor (self , c_id , query_str , page_size , query_args , schema , statement_type , distributed_joins ,
728729 local , replicated_only , enforce_join_order , collocated , lazy , include_field_names ,
729730 max_rows , timeout )
731+
732+ def get_cluster (self ) -> 'Cluster' :
733+ """
734+ Gets client cluster facade.
735+
736+ :return: Client cluster facade.
737+ """
738+ return Cluster (self )
0 commit comments