@@ -517,6 +517,14 @@ async def is_empty(self) -> bool:
517
517
:return: `true` if this map contains no key-value mappings.
518
518
"""
519
519
520
+ @abc .abstractmethod
521
+ async def is_ready (self ) -> bool :
522
+ """
523
+ Returns `true` if this map is ready to be used.
524
+
525
+ :return: `true`if this map is ready to be used.
526
+ """
527
+
520
528
@abc .abstractmethod
521
529
async def size (self ) -> int :
522
530
"""
@@ -846,6 +854,22 @@ async def is_empty(self) -> bool:
846
854
v = await self ._client_stub .isEmpty (r )
847
855
return self ._request_factory .serializer .deserialize (v .value )
848
856
857
+ @_pre_call_cache
858
+ async def is_ready (self ) -> bool :
859
+ try :
860
+ r = self ._request_factory .is_ready_request ()
861
+ v = await self ._client_stub .isReady (r )
862
+ return self ._request_factory .serializer .deserialize (v .value )
863
+ except grpc .aio ._call .AioRpcError as e :
864
+ if e .code () == grpc .StatusCode .UNIMPLEMENTED :
865
+ raise OperationNotSupportedError (
866
+ "This operation is not supported by the gRPC proxy for the connected Coherence Server."
867
+ "Please upgrade to a version that supports this operation."
868
+ ) from e
869
+ raise # Re-raise all other gRPC errors
870
+ except Exception as e :
871
+ raise RuntimeError ("An unexpected error occurred in is_ready()" ) from e
872
+
849
873
@_pre_call_cache
850
874
async def size (self ) -> int :
851
875
r = self ._request_factory .size_request ()
@@ -1364,6 +1388,11 @@ async def is_empty(self) -> bool:
1364
1388
await dispatcher .dispatch (self ._stream_handler )
1365
1389
return dispatcher .result ()
1366
1390
1391
+ async def is_ready (self ) -> bool :
1392
+ dispatcher : UnaryDispatcher [bool ] = self ._request_factory .is_ready_request ()
1393
+ await dispatcher .dispatch (self ._stream_handler )
1394
+ return dispatcher .result ()
1395
+
1367
1396
@_pre_call_cache
1368
1397
async def size (self ) -> int :
1369
1398
dispatcher : UnaryDispatcher [int ] = self ._request_factory .size_request ()
@@ -2701,3 +2730,9 @@ async def handle_zero_id_response(self, response: ProxyResponse) -> None:
2701
2730
self ._events_manager ._emitter .emit (
2702
2731
MapLifecycleEvent .TRUNCATED .value , self ._events_manager ._named_map .name
2703
2732
)
2733
+
2734
+
2735
+ class OperationNotSupportedError (Exception ):
2736
+ """Exception raised when the requested operation is not supported by the server."""
2737
+
2738
+ pass
0 commit comments