hazelcast-python-client 5.3.0__py3-none-any.whl → 5.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
hazelcast/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "5.3.0"
1
+ __version__ = "5.4.0"
2
2
 
3
3
  # Set the default handler to "hazelcast" loggers
4
4
  # to avoid "No handlers could be found" warnings.
hazelcast/asyncore.py ADDED
@@ -0,0 +1,643 @@
1
+ # -*- Mode: Python -*-
2
+ # Id: asyncore.py,v 2.51 2000/09/07 22:29:26 rushing Exp
3
+ # Author: Sam Rushing <rushing@nightmare.com>
4
+
5
+ # ======================================================================
6
+ # Copyright 1996 by Sam Rushing
7
+ #
8
+ # All Rights Reserved
9
+ #
10
+ # Permission to use, copy, modify, and distribute this software and
11
+ # its documentation for any purpose and without fee is hereby
12
+ # granted, provided that the above copyright notice appear in all
13
+ # copies and that both that copyright notice and this permission
14
+ # notice appear in supporting documentation, and that the name of Sam
15
+ # Rushing not be used in advertising or publicity pertaining to
16
+ # distribution of the software without specific, written prior
17
+ # permission.
18
+ #
19
+ # SAM RUSHING DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
20
+ # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
21
+ # NO EVENT SHALL SAM RUSHING BE LIABLE FOR ANY SPECIAL, INDIRECT OR
22
+ # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
23
+ # OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
24
+ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
25
+ # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
26
+ # ======================================================================
27
+
28
+ """Basic infrastructure for asynchronous socket service clients and servers.
29
+
30
+ There are only two ways to have a program on a single processor do "more
31
+ than one thing at a time". Multi-threaded programming is the simplest and
32
+ most popular way to do it, but there is another very different technique,
33
+ that lets you have nearly all the advantages of multi-threading, without
34
+ actually using multiple threads. it's really only practical if your program
35
+ is largely I/O bound. If your program is CPU bound, then pre-emptive
36
+ scheduled threads are probably what you really need. Network servers are
37
+ rarely CPU-bound, however.
38
+
39
+ If your operating system supports the select() system call in its I/O
40
+ library (and nearly all do), then you can use it to juggle multiple
41
+ communication channels at once; doing other work while your I/O is taking
42
+ place in the "background." Although this strategy can seem strange and
43
+ complex, especially at first, it is in many ways easier to understand and
44
+ control than multi-threaded programming. The module documented here solves
45
+ many of the difficult problems for you, making the task of building
46
+ sophisticated high-performance network servers and clients a snap.
47
+ """
48
+
49
+ import select
50
+ import socket
51
+ import sys
52
+ import time
53
+ import warnings
54
+
55
+ import os
56
+ from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL, \
57
+ ENOTCONN, ESHUTDOWN, EISCONN, EBADF, ECONNABORTED, EPIPE, EAGAIN, \
58
+ errorcode
59
+
60
+ _DISCONNECTED = frozenset({ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED, EPIPE,
61
+ EBADF})
62
+
63
+ try:
64
+ _d: dict = socket_map
65
+ del _d
66
+ except NameError:
67
+ socket_map: dict = {}
68
+
69
+ def _strerror(err):
70
+ try:
71
+ return os.strerror(err)
72
+ except (ValueError, OverflowError, NameError):
73
+ if err in errorcode:
74
+ return errorcode[err]
75
+ return "Unknown error %s" %err
76
+
77
+ class ExitNow(Exception):
78
+ pass
79
+
80
+ _reraised_exceptions = (ExitNow, KeyboardInterrupt, SystemExit)
81
+
82
+ def read(obj):
83
+ try:
84
+ obj.handle_read_event()
85
+ except _reraised_exceptions:
86
+ raise
87
+ except:
88
+ obj.handle_error()
89
+
90
+ def write(obj):
91
+ try:
92
+ obj.handle_write_event()
93
+ except _reraised_exceptions:
94
+ raise
95
+ except:
96
+ obj.handle_error()
97
+
98
+ def _exception(obj):
99
+ try:
100
+ obj.handle_expt_event()
101
+ except _reraised_exceptions:
102
+ raise
103
+ except:
104
+ obj.handle_error()
105
+
106
+ def readwrite(obj, flags):
107
+ try:
108
+ if flags & select.POLLIN:
109
+ obj.handle_read_event()
110
+ if flags & select.POLLOUT:
111
+ obj.handle_write_event()
112
+ if flags & select.POLLPRI:
113
+ obj.handle_expt_event()
114
+ if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
115
+ obj.handle_close()
116
+ except OSError as e:
117
+ if e.errno not in _DISCONNECTED:
118
+ obj.handle_error()
119
+ else:
120
+ obj.handle_close()
121
+ except _reraised_exceptions:
122
+ raise
123
+ except:
124
+ obj.handle_error()
125
+
126
+ def poll(timeout=0.0, map=None):
127
+ if map is None:
128
+ map = socket_map
129
+ if map:
130
+ r = []; w = []; e = []
131
+ for fd, obj in list(map.items()):
132
+ is_r = obj.readable()
133
+ is_w = obj.writable()
134
+ if is_r:
135
+ r.append(fd)
136
+ # accepting sockets should not be writable
137
+ if is_w and not obj.accepting:
138
+ w.append(fd)
139
+ if is_r or is_w:
140
+ e.append(fd)
141
+ if [] == r == w == e:
142
+ time.sleep(timeout)
143
+ return
144
+
145
+ r, w, e = select.select(r, w, e, timeout)
146
+
147
+ for fd in r:
148
+ obj = map.get(fd)
149
+ if obj is None:
150
+ continue
151
+ read(obj)
152
+
153
+ for fd in w:
154
+ obj = map.get(fd)
155
+ if obj is None:
156
+ continue
157
+ write(obj)
158
+
159
+ for fd in e:
160
+ obj = map.get(fd)
161
+ if obj is None:
162
+ continue
163
+ _exception(obj)
164
+
165
+ def poll2(timeout=0.0, map=None):
166
+ # Use the poll() support added to the select module in Python 2.0
167
+ if map is None:
168
+ map = socket_map
169
+ if timeout is not None:
170
+ # timeout is in milliseconds
171
+ timeout = int(timeout*1000)
172
+ pollster = select.poll()
173
+ if map:
174
+ for fd, obj in list(map.items()):
175
+ flags = 0
176
+ if obj.readable():
177
+ flags |= select.POLLIN | select.POLLPRI
178
+ # accepting sockets should not be writable
179
+ if obj.writable() and not obj.accepting:
180
+ flags |= select.POLLOUT
181
+ if flags:
182
+ pollster.register(fd, flags)
183
+
184
+ r = pollster.poll(timeout)
185
+ for fd, flags in r:
186
+ obj = map.get(fd)
187
+ if obj is None:
188
+ continue
189
+ readwrite(obj, flags)
190
+
191
+ poll3 = poll2 # Alias for backward compatibility
192
+
193
+ def loop(timeout=30.0, use_poll=False, map=None, count=None):
194
+ if map is None:
195
+ map = socket_map
196
+
197
+ if use_poll and hasattr(select, 'poll'):
198
+ poll_fun = poll2
199
+ else:
200
+ poll_fun = poll
201
+
202
+ if count is None:
203
+ while map:
204
+ poll_fun(timeout, map)
205
+
206
+ else:
207
+ while map and count > 0:
208
+ poll_fun(timeout, map)
209
+ count = count - 1
210
+
211
+ class dispatcher:
212
+
213
+ debug = False
214
+ connected = False
215
+ accepting = False
216
+ connecting = False
217
+ closing = False
218
+ addr = None
219
+ ignore_log_types = frozenset({'warning'})
220
+
221
+ def __init__(self, sock=None, map=None):
222
+ if map is None:
223
+ self._map = socket_map
224
+ else:
225
+ self._map = map
226
+
227
+ self._fileno = None
228
+
229
+ if sock:
230
+ # Set to nonblocking just to make sure for cases where we
231
+ # get a socket from a blocking source.
232
+ sock.setblocking(False)
233
+ self.set_socket(sock, map)
234
+ self.connected = True
235
+ # The constructor no longer requires that the socket
236
+ # passed be connected.
237
+ try:
238
+ self.addr = sock.getpeername()
239
+ except OSError as err:
240
+ if err.errno in (ENOTCONN, EINVAL):
241
+ # To handle the case where we got an unconnected
242
+ # socket.
243
+ self.connected = False
244
+ else:
245
+ # The socket is broken in some unknown way, alert
246
+ # the user and remove it from the map (to prevent
247
+ # polling of broken sockets).
248
+ self.del_channel(map)
249
+ raise
250
+ else:
251
+ self.socket = None
252
+
253
+ def __repr__(self):
254
+ status = [self.__class__.__module__+"."+self.__class__.__qualname__]
255
+ if self.accepting and self.addr:
256
+ status.append('listening')
257
+ elif self.connected:
258
+ status.append('connected')
259
+ if self.addr is not None:
260
+ try:
261
+ status.append('%s:%d' % self.addr)
262
+ except TypeError:
263
+ status.append(repr(self.addr))
264
+ return '<%s at %#x>' % (' '.join(status), id(self))
265
+
266
+ def add_channel(self, map=None):
267
+ #self.log_info('adding channel %s' % self)
268
+ if map is None:
269
+ map = self._map
270
+ map[self._fileno] = self
271
+
272
+ def del_channel(self, map=None):
273
+ fd = self._fileno
274
+ if map is None:
275
+ map = self._map
276
+ if fd in map:
277
+ #self.log_info('closing channel %d:%s' % (fd, self))
278
+ del map[fd]
279
+ self._fileno = None
280
+
281
+ def create_socket(self, family=socket.AF_INET, type=socket.SOCK_STREAM):
282
+ self.family_and_type = family, type
283
+ sock = socket.socket(family, type)
284
+ sock.setblocking(False)
285
+ self.set_socket(sock)
286
+
287
+ def set_socket(self, sock, map=None):
288
+ self.socket = sock
289
+ self._fileno = sock.fileno()
290
+ self.add_channel(map)
291
+
292
+ def set_reuse_addr(self):
293
+ # try to re-use a server port if possible
294
+ try:
295
+ self.socket.setsockopt(
296
+ socket.SOL_SOCKET, socket.SO_REUSEADDR,
297
+ self.socket.getsockopt(socket.SOL_SOCKET,
298
+ socket.SO_REUSEADDR) | 1
299
+ )
300
+ except OSError:
301
+ pass
302
+
303
+ # ==================================================
304
+ # predicates for select()
305
+ # these are used as filters for the lists of sockets
306
+ # to pass to select().
307
+ # ==================================================
308
+
309
+ def readable(self):
310
+ return True
311
+
312
+ def writable(self):
313
+ return True
314
+
315
+ # ==================================================
316
+ # socket object methods.
317
+ # ==================================================
318
+
319
+ def listen(self, num):
320
+ self.accepting = True
321
+ if os.name == 'nt' and num > 5:
322
+ num = 5
323
+ return self.socket.listen(num)
324
+
325
+ def bind(self, addr):
326
+ self.addr = addr
327
+ return self.socket.bind(addr)
328
+
329
+ def connect(self, address):
330
+ self.connected = False
331
+ self.connecting = True
332
+ err = self.socket.connect_ex(address)
333
+ if err in (EINPROGRESS, EALREADY, EWOULDBLOCK) \
334
+ or err == EINVAL and os.name == 'nt':
335
+ self.addr = address
336
+ return
337
+ if err in (0, EISCONN):
338
+ self.addr = address
339
+ self.handle_connect_event()
340
+ else:
341
+ raise OSError(err, errorcode[err])
342
+
343
+ def accept(self):
344
+ # XXX can return either an address pair or None
345
+ try:
346
+ conn, addr = self.socket.accept()
347
+ except TypeError:
348
+ return None
349
+ except OSError as why:
350
+ if why.errno in (EWOULDBLOCK, ECONNABORTED, EAGAIN):
351
+ return None
352
+ else:
353
+ raise
354
+ else:
355
+ return conn, addr
356
+
357
+ def send(self, data):
358
+ try:
359
+ result = self.socket.send(data)
360
+ return result
361
+ except OSError as why:
362
+ if why.errno == EWOULDBLOCK:
363
+ return 0
364
+ elif why.errno in _DISCONNECTED:
365
+ self.handle_close()
366
+ return 0
367
+ else:
368
+ raise
369
+
370
+ def recv(self, buffer_size):
371
+ try:
372
+ data = self.socket.recv(buffer_size)
373
+ if not data:
374
+ # a closed connection is indicated by signaling
375
+ # a read condition, and having recv() return 0.
376
+ self.handle_close()
377
+ return b''
378
+ else:
379
+ return data
380
+ except OSError as why:
381
+ # winsock sometimes raises ENOTCONN
382
+ if why.errno in _DISCONNECTED:
383
+ self.handle_close()
384
+ return b''
385
+ else:
386
+ raise
387
+
388
+ def close(self):
389
+ self.connected = False
390
+ self.accepting = False
391
+ self.connecting = False
392
+ self.del_channel()
393
+ if self.socket is not None:
394
+ try:
395
+ self.socket.close()
396
+ except OSError as why:
397
+ if why.errno not in (ENOTCONN, EBADF):
398
+ raise
399
+
400
+ # log and log_info may be overridden to provide more sophisticated
401
+ # logging and warning methods. In general, log is for 'hit' logging
402
+ # and 'log_info' is for informational, warning and error logging.
403
+
404
+ def log(self, message):
405
+ sys.stderr.write('log: %s\n' % str(message))
406
+
407
+ def log_info(self, message, type='info'):
408
+ if type not in self.ignore_log_types:
409
+ print('%s: %s' % (type, message))
410
+
411
+ def handle_read_event(self):
412
+ if self.accepting:
413
+ # accepting sockets are never connected, they "spawn" new
414
+ # sockets that are connected
415
+ self.handle_accept()
416
+ elif not self.connected:
417
+ if self.connecting:
418
+ self.handle_connect_event()
419
+ self.handle_read()
420
+ else:
421
+ self.handle_read()
422
+
423
+ def handle_connect_event(self):
424
+ err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
425
+ if err != 0:
426
+ raise OSError(err, _strerror(err))
427
+ self.handle_connect()
428
+ self.connected = True
429
+ self.connecting = False
430
+
431
+ def handle_write_event(self):
432
+ if self.accepting:
433
+ # Accepting sockets shouldn't get a write event.
434
+ # We will pretend it didn't happen.
435
+ return
436
+
437
+ if not self.connected:
438
+ if self.connecting:
439
+ self.handle_connect_event()
440
+ self.handle_write()
441
+
442
+ def handle_expt_event(self):
443
+ # handle_expt_event() is called if there might be an error on the
444
+ # socket, or if there is OOB data
445
+ # check for the error condition first
446
+ err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
447
+ if err != 0:
448
+ # we can get here when select.select() says that there is an
449
+ # exceptional condition on the socket
450
+ # since there is an error, we'll go ahead and close the socket
451
+ # like we would in a subclassed handle_read() that received no
452
+ # data
453
+ self.handle_close()
454
+ else:
455
+ self.handle_expt()
456
+
457
+ def handle_error(self):
458
+ nil, t, v, tbinfo = compact_traceback()
459
+
460
+ # sometimes a user repr method will crash.
461
+ try:
462
+ self_repr = repr(self)
463
+ except:
464
+ self_repr = '<__repr__(self) failed for object at %0x>' % id(self)
465
+
466
+ self.log_info(
467
+ 'uncaptured python exception, closing channel %s (%s:%s %s)' % (
468
+ self_repr,
469
+ t,
470
+ v,
471
+ tbinfo
472
+ ),
473
+ 'error'
474
+ )
475
+ self.handle_close()
476
+
477
+ def handle_expt(self):
478
+ self.log_info('unhandled incoming priority event', 'warning')
479
+
480
+ def handle_read(self):
481
+ self.log_info('unhandled read event', 'warning')
482
+
483
+ def handle_write(self):
484
+ self.log_info('unhandled write event', 'warning')
485
+
486
+ def handle_connect(self):
487
+ self.log_info('unhandled connect event', 'warning')
488
+
489
+ def handle_accept(self):
490
+ pair = self.accept()
491
+ if pair is not None:
492
+ self.handle_accepted(*pair)
493
+
494
+ def handle_accepted(self, sock, addr):
495
+ sock.close()
496
+ self.log_info('unhandled accepted event', 'warning')
497
+
498
+ def handle_close(self):
499
+ self.log_info('unhandled close event', 'warning')
500
+ self.close()
501
+
502
+ # ---------------------------------------------------------------------------
503
+ # adds simple buffered output capability, useful for simple clients.
504
+ # [for more sophisticated usage use asynchat.async_chat]
505
+ # ---------------------------------------------------------------------------
506
+
507
+ class dispatcher_with_send(dispatcher):
508
+
509
+ def __init__(self, sock=None, map=None):
510
+ dispatcher.__init__(self, sock, map)
511
+ self.out_buffer = b''
512
+
513
+ def initiate_send(self):
514
+ num_sent = 0
515
+ num_sent = dispatcher.send(self, self.out_buffer[:65536])
516
+ self.out_buffer = self.out_buffer[num_sent:]
517
+
518
+ def handle_write(self):
519
+ self.initiate_send()
520
+
521
+ def writable(self):
522
+ return (not self.connected) or len(self.out_buffer)
523
+
524
+ def send(self, data):
525
+ if self.debug:
526
+ self.log_info('sending %s' % repr(data))
527
+ self.out_buffer = self.out_buffer + data
528
+ self.initiate_send()
529
+
530
+ # ---------------------------------------------------------------------------
531
+ # used for debugging.
532
+ # ---------------------------------------------------------------------------
533
+
534
+ def compact_traceback():
535
+ t, v, tb = sys.exc_info()
536
+ tbinfo = []
537
+ if not tb: # Must have a traceback
538
+ raise AssertionError("traceback does not exist")
539
+ while tb:
540
+ tbinfo.append((
541
+ tb.tb_frame.f_code.co_filename,
542
+ tb.tb_frame.f_code.co_name,
543
+ str(tb.tb_lineno)
544
+ ))
545
+ tb = tb.tb_next
546
+
547
+ # just to be safe
548
+ del tb
549
+
550
+ file, function, line = tbinfo[-1]
551
+ info = ' '.join(['[%s|%s|%s]' % x for x in tbinfo])
552
+ return (file, function, line), t, v, info
553
+
554
+ def close_all(map=None, ignore_all=False):
555
+ if map is None:
556
+ map = socket_map
557
+ for x in list(map.values()):
558
+ try:
559
+ x.close()
560
+ except OSError as x:
561
+ if x.errno == EBADF:
562
+ pass
563
+ elif not ignore_all:
564
+ raise
565
+ except _reraised_exceptions:
566
+ raise
567
+ except:
568
+ if not ignore_all:
569
+ raise
570
+ map.clear()
571
+
572
+ # Asynchronous File I/O:
573
+ #
574
+ # After a little research (reading man pages on various unixen, and
575
+ # digging through the linux kernel), I've determined that select()
576
+ # isn't meant for doing asynchronous file i/o.
577
+ # Heartening, though - reading linux/mm/filemap.c shows that linux
578
+ # supports asynchronous read-ahead. So _MOST_ of the time, the data
579
+ # will be sitting in memory for us already when we go to read it.
580
+ #
581
+ # What other OS's (besides NT) support async file i/o? [VMS?]
582
+ #
583
+ # Regardless, this is useful for pipes, and stdin/stdout...
584
+
585
+ if os.name == 'posix':
586
+ class file_wrapper:
587
+ # Here we override just enough to make a file
588
+ # look like a socket for the purposes of asyncore.
589
+ # The passed fd is automatically os.dup()'d
590
+
591
+ def __init__(self, fd):
592
+ self.fd = os.dup(fd)
593
+
594
+ def __del__(self):
595
+ if self.fd >= 0:
596
+ warnings.warn("unclosed file %r" % self, ResourceWarning,
597
+ source=self)
598
+ self.close()
599
+
600
+ def recv(self, *args):
601
+ return os.read(self.fd, *args)
602
+
603
+ def send(self, *args):
604
+ return os.write(self.fd, *args)
605
+
606
+ def getsockopt(self, level, optname, buflen=None):
607
+ if (level == socket.SOL_SOCKET and
608
+ optname == socket.SO_ERROR and
609
+ not buflen):
610
+ return 0
611
+ raise NotImplementedError("Only asyncore specific behaviour "
612
+ "implemented.")
613
+
614
+ read = recv
615
+ write = send
616
+
617
+ def close(self):
618
+ if self.fd < 0:
619
+ return
620
+ fd = self.fd
621
+ self.fd = -1
622
+ os.close(fd)
623
+
624
+ def fileno(self):
625
+ return self.fd
626
+
627
+ class file_dispatcher(dispatcher):
628
+
629
+ def __init__(self, fd, map=None):
630
+ dispatcher.__init__(self, None, map)
631
+ self.connected = True
632
+ try:
633
+ fd = fd.fileno()
634
+ except AttributeError:
635
+ pass
636
+ self.set_file(fd)
637
+ # set it to non-blocking mode
638
+ os.set_blocking(fd, False)
639
+
640
+ def set_file(self, fd):
641
+ self.socket = file_wrapper(fd)
642
+ self._fileno = self.socket.fileno()
643
+ self.add_channel()
hazelcast/client.py CHANGED
@@ -530,7 +530,7 @@ class HazelcastClient:
530
530
  if address_list_provided and cloud_enabled:
531
531
  raise IllegalStateError(
532
532
  "Only one discovery method can be enabled at a time. "
533
- "Cluster members given explicitly: %s, Hazelcast Viridian enabled: %s"
533
+ "Cluster members given explicitly: %s, Hazelcast Cloud enabled: %s"
534
534
  % (address_list_provided, cloud_enabled)
535
535
  )
536
536
 
hazelcast/config.py CHANGED
@@ -662,9 +662,9 @@ class Config:
662
662
 
663
663
  @property
664
664
  def cloud_discovery_token(self) -> typing.Optional[str]:
665
- """Discovery token of the Hazelcast Viridian cluster.
665
+ """Discovery token of the Hazelcast Cloud cluster.
666
666
 
667
- When this value is set, Hazelcast Viridian discovery is enabled.
667
+ When this value is set, Hazelcast Cloud discovery is enabled.
668
668
  """
669
669
  return self._cloud_discovery_token
670
670
 
hazelcast/discovery.py CHANGED
@@ -11,7 +11,7 @@ _logger = logging.getLogger(__name__)
11
11
 
12
12
  class HazelcastCloudAddressProvider:
13
13
  """Provides initial addresses for client to find and connect to a node
14
- and resolves private IP addresses of Hazelcast Viridian service.
14
+ and resolves private IP addresses of Hazelcast Cloud service.
15
15
  """
16
16
 
17
17
  def __init__(self, token, connection_timeout):
@@ -19,7 +19,7 @@ class HazelcastCloudAddressProvider:
19
19
  self._private_to_public = dict()
20
20
 
21
21
  def load_addresses(self):
22
- """Loads member addresses from Hazelcast Viridian endpoint.
22
+ """Loads member addresses from Hazelcast Cloud endpoint.
23
23
 
24
24
  Returns:
25
25
  tuple[list[hazelcast.core.Address], list[hazelcast.core.Address]]: The possible member addresses
@@ -30,7 +30,7 @@ class HazelcastCloudAddressProvider:
30
30
  # Every private address is primary
31
31
  return list(nodes.keys()), []
32
32
  except Exception as e:
33
- _logger.warning("Failed to load addresses from Hazelcast Viridian: %s", e)
33
+ _logger.warning("Failed to load addresses from Hazelcast Cloud: %s", e)
34
34
  return [], []
35
35
 
36
36
  def translate(self, address):
@@ -58,15 +58,15 @@ class HazelcastCloudAddressProvider:
58
58
  try:
59
59
  self._private_to_public = self.cloud_discovery.discover_nodes()
60
60
  except Exception as e:
61
- _logger.warning("Failed to load addresses from Hazelcast Viridian: %s", e)
61
+ _logger.warning("Failed to load addresses from Hazelcast Cloud: %s", e)
62
62
 
63
63
 
64
64
  class HazelcastCloudDiscovery:
65
- """Service that discovers nodes via Hazelcast Viridian.
66
- https://api.viridian.hazelcast.com/cluster/discovery?token=<TOKEN>
65
+ """Service that discovers nodes via Hazelcast Cloud.
66
+ https://api.cloud.hazelcast.com/cluster/discovery?token=<TOKEN>
67
67
  """
68
68
 
69
- _CLOUD_URL_BASE = "api.viridian.hazelcast.com"
69
+ _CLOUD_URL_BASE = "api.cloud.hazelcast.com"
70
70
  _CLOUD_URL_PATH = "/cluster/discovery?token="
71
71
  _PRIVATE_ADDRESS_PROPERTY = "private-address"
72
72
  _PUBLIC_ADDRESS_PROPERTY = "public-address"
@@ -78,7 +78,7 @@ class HazelcastCloudDiscovery:
78
78
  self._ctx = ssl.create_default_context()
79
79
 
80
80
  def discover_nodes(self):
81
- """Discovers nodes from Hazelcast Viridian.
81
+ """Discovers nodes from Hazelcast Cloud.
82
82
 
83
83
  Returns:
84
84
  dict[hazelcast.core.Address, hazelcast.core.Address]: Dictionary that maps private
@@ -150,6 +150,13 @@ class ReliableMessageListener(typing.Generic[MessageType]):
150
150
  """
151
151
  raise NotImplementedError("is_terminal")
152
152
 
153
+ def on_cancel(self) -> None:
154
+ """
155
+ Called when the ReliableMessageListener is cancelled. This can happen
156
+ when the listener is unregistered or cancelled due to an exception or during shutdown.
157
+ """
158
+ pass
159
+
153
160
 
154
161
  class _MessageRunner:
155
162
  def __init__(
@@ -211,6 +218,7 @@ class _MessageRunner:
211
218
  """
212
219
  self._cancelled = True
213
220
  self._runners.pop(self._registration_id, None)
221
+ self._listener.on_cancel()
214
222
 
215
223
  def _handle_next_batch(self, future):
216
224
  """Handles the result of the read_many request from
hazelcast/reactor.py CHANGED
@@ -1,4 +1,7 @@
1
- import asyncore
1
+ try:
2
+ import asyncore
3
+ except ImportError:
4
+ import hazelcast.asyncore as asyncore # type: ignore
2
5
  import errno
3
6
  import io
4
7
  import logging
@@ -1,13 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hazelcast-python-client
3
- Version: 5.3.0
3
+ Version: 5.4.0
4
4
  Summary: Hazelcast Python Client
5
5
  Home-page: https://github.com/hazelcast/hazelcast-python-client
6
6
  Author: Hazelcast Inc. Developers
7
7
  Author-email: hazelcast@googlegroups.com
8
8
  License: Apache 2.0
9
9
  Keywords: hazelcast,hazelcast client,In-Memory Data Grid,Distributed Computing
10
- Platform: UNKNOWN
11
10
  Classifier: Development Status :: 5 - Production/Stable
12
11
  Classifier: Intended Audience :: Developers
13
12
  Classifier: License :: OSI Approved :: Apache Software License
@@ -22,6 +21,7 @@ Classifier: Programming Language :: Python :: 3.8
22
21
  Classifier: Programming Language :: Python :: 3.9
23
22
  Classifier: Programming Language :: Python :: 3.10
24
23
  Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
25
  Classifier: Programming Language :: Python :: Implementation :: CPython
26
26
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
27
27
  License-File: LICENSE.txt
@@ -173,7 +173,7 @@ Features
173
173
  - Distributed, CRDT based counter, called **PNCounter**
174
174
  - Distributed concurrency primitives from CP Subsystem such as
175
175
  **FencedLock**, **Semaphore**, **AtomicLong**
176
- - Integration with `Hazelcast Viridian <https://viridian.hazelcast.com/>`__
176
+ - Integration with `Hazelcast Cloud <https://cloud.hazelcast.com/>`__
177
177
  - Support for serverless and traditional web service architectures with
178
178
  **Unisocket** and **Smart** operation modes
179
179
  - Ability to listen to client lifecycle, cluster state, and distributed
@@ -191,9 +191,6 @@ development/usage issues:
191
191
  repository <https://github.com/hazelcast/hazelcast-python-client/issues/new>`__
192
192
  - `Documentation <https://hazelcast.readthedocs.io>`__
193
193
  - `Slack <https://slack.hazelcast.com>`__
194
- - `Google Groups <https://groups.google.com/g/hazelcast>`__
195
- - `Stack
196
- Overflow <https://stackoverflow.com/questions/tagged/hazelcast>`__
197
194
 
198
195
  Contributing
199
196
  ------------
@@ -245,8 +242,8 @@ Testing
245
242
  In order to test Hazelcast Python client locally, you will need the
246
243
  following:
247
244
 
248
- - Java 8 or newer
249
- - Maven
245
+ - `Supported Java virtual machine <https://docs.hazelcast.com/hazelcast/latest/deploy/versioning-compatibility#supported-java-virtual-machines>`
246
+ - `Apache Maven <https://maven.apache.org/>`
250
247
 
251
248
  Following commands starts the tests:
252
249
 
@@ -269,5 +266,3 @@ Copyright (c) 2008-2023, Hazelcast, Inc. All Rights Reserved.
269
266
 
270
267
  Visit `hazelcast.com <https://hazelcast.com>`__ for more
271
268
  information.
272
-
273
-
@@ -1,14 +1,15 @@
1
- hazelcast/__init__.py,sha256=8kVLC26pFnt92rfdc-ADWnSXz3HEYY0rYU6wToZE8zs,246
1
+ hazelcast/__init__.py,sha256=g79UzuZD6WnIzucfm6dqTu89IJdhJXRI7mUl6WSjm6A,246
2
2
  hazelcast/aggregator.py,sha256=UKiwZZohGdo_8ALc508DlO6gBzrnDm_s2zrXuQlhAE8,16433
3
- hazelcast/client.py,sha256=euCCZbVZWUcWKef_squvvEsgNt447Y34AVAMV39FjXU,22523
3
+ hazelcast/asyncore.py,sha256=DZMhwOJe8h5oW3kpNS6M8Y6RDmoh-bUgQ8tn-QyPTao,20114
4
+ hazelcast/client.py,sha256=aMlgr3XpnsGP1YwMZfqTx0TWziJnQc1JtJWUMRWGkl0,22520
4
5
  hazelcast/cluster.py,sha256=sHNuyML5m19r4R8NG7zhdeTCDRK0i4x4503-2nTCU3U,13634
5
6
  hazelcast/compact.py,sha256=_JyHSQhtdGiefPEhaTGxLoP5gwG90BuawBp8QCt2EW0,6168
6
- hazelcast/config.py,sha256=0N0zbMzdnCt4jxf4V8XgynXqfmZhniJUerEwMVWaCOI,72382
7
+ hazelcast/config.py,sha256=D2g2mAfjWWaiv3YH2Rke6k6WLdX07zqIMqEskyHwzS8,72376
7
8
  hazelcast/connection.py,sha256=UmmxxcGwxOI-KcE297MFOEQpTOLpMmCJh6IpI1X1hQg,38921
8
9
  hazelcast/core.py,sha256=XC0Myppppr0W1hC5flPp0SL1M0Q1IH_BnToMo5r5FVg,14181
9
10
  hazelcast/cp.py,sha256=pH53k8j1kIiSNsf9oRnzjmxQD5ktxfGn4igzft8-MVY,17582
10
11
  hazelcast/db.py,sha256=NaTbvvCECyYJWTo1C7UG6BDag1bxsptojYTNVawISBs,16593
11
- hazelcast/discovery.py,sha256=Nv4YHMH3yzCwWe8xAiJIzp0voAkYMxKfEsnamHV1yVo,4502
12
+ hazelcast/discovery.py,sha256=ZBUa9B80ErAvZP7vcwfg8X0vP_EHSRPoZnzopN1Mlfc,4478
12
13
  hazelcast/errors.py,sha256=0ev_OvRKy-CUy4QpN7AqsYidaRBVWIsR4wO1U97kpzk,15384
13
14
  hazelcast/future.py,sha256=LoE9x_Qw6nnOf3t6AOCG6B89ErrYluqOFt19Z_kQ2_I,9302
14
15
  hazelcast/hash.py,sha256=ECp4ggoAgD3qcHqFhQdfewlRJKLYgUh7N3smhKh7oeA,1650
@@ -20,7 +21,7 @@ hazelcast/near_cache.py,sha256=rhlko6zTb4Vwo1KsqNQnDXUB9_16cmTgorAN0Ut7i1Q,10787
20
21
  hazelcast/partition.py,sha256=kZ3J2uV95UrN6AFyFy-nLFTkijlpuAzVdyzTnFiIRhM,5420
21
22
  hazelcast/predicate.py,sha256=QqlZLYP0Bp-pIDJmaDCcG_QtydLYr271Nj9kxc_ASLU,23360
22
23
  hazelcast/projection.py,sha256=WI6o9C5ZwGULooaJ7kpU8lZ4kyqYsQjHlDt5mtbsUz0,3225
23
- hazelcast/reactor.py,sha256=pM1kCFzzQdHHvZGiXsUajqKc4yagKdj02kLW_DIZRsM,19104
24
+ hazelcast/reactor.py,sha256=mYX77J84l0LZhRwLwfC9mfWtZ3j3ZuMPYXowxs5sPYQ,19191
24
25
  hazelcast/security.py,sha256=B_KCVXDtL81w7JPSwzHiXr9UTUs6bzzhYn3J2qYxC1w,924
25
26
  hazelcast/sql.py,sha256=QnQb9HOBtF47e5iYIbvfcHeb0USAw8eEOPnqw0Z1gbw,48167
26
27
  hazelcast/statistics.py,sha256=KtjECRkhD1bR2ZTMEp_vQR3pBnVE46DES15idxp_VAo,14211
@@ -325,7 +326,7 @@ hazelcast/proxy/map.py,sha256=55UE3568fFIrEb53B28ErH8aGvBhnaUI-f5ccvdqNbE,91050
325
326
  hazelcast/proxy/multi_map.py,sha256=1CqeQOWcSDomtfDo-Tcj9TbM2FxBhIa6FjZFyc4f0qg,28442
326
327
  hazelcast/proxy/pn_counter.py,sha256=DyHY2xnEj2Kfn-x14kwGO4RTWkwwW2sKZ2ruYpqbYQw,14045
327
328
  hazelcast/proxy/queue.py,sha256=7OhF-qw5PPUAyUmetijNgRJjlzbzvlwHqfOklq2CaZ0,19223
328
- hazelcast/proxy/reliable_topic.py,sha256=qGG_K4UwaZUYemex9R5WdT-thenZMkHwR18D6rxQ9JM,30702
329
+ hazelcast/proxy/reliable_topic.py,sha256=ybZ9C2S1CCyhiCe_ESsfLbqHYWxFjRnHv3WUYTPcc3E,30981
329
330
  hazelcast/proxy/replicated_map.py,sha256=vM459atCFdJvol-U7Q673ZIK3nOVt28gjAX9XgInKJU,20727
330
331
  hazelcast/proxy/ringbuffer.py,sha256=jI-fgWAqGlfis2TUh-lZsUhm1I5S5CKMmgloO3Uaymo,18381
331
332
  hazelcast/proxy/set.py,sha256=NS2avILnBBTp6R_Vgv-OMg9kEYTu7vC1mMOB4DpZf-M,12795
@@ -359,8 +360,8 @@ hazelcast/serialization/portable/context.py,sha256=212s_Yy3r69-qMS11UIDCQBQcsJxp
359
360
  hazelcast/serialization/portable/reader.py,sha256=3gyde6pRRqmFdJbfSnlD6TDrSCaCGcoClbpNnnfqyGw,24966
360
361
  hazelcast/serialization/portable/serializer.py,sha256=uICNE_7S3DTLfl2K6LQH9tDwuXjozBmVgAvvtn1hMjY,4427
361
362
  hazelcast/serialization/portable/writer.py,sha256=4b2dQZApYSAXkWuOUOKj_EBLPilBqyeeMkhz2QFnjnA,17762
362
- hazelcast_python_client-5.3.0.dist-info/LICENSE.txt,sha256=xllut76FgcGL5zbIRvuRc7aezPbvlMUTWJPsVr2Sugg,11358
363
- hazelcast_python_client-5.3.0.dist-info/METADATA,sha256=_3drkscdC7YhP_Gt1TyumLoWesQaqPLwhz2MIB6iEWU,8870
364
- hazelcast_python_client-5.3.0.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
365
- hazelcast_python_client-5.3.0.dist-info/top_level.txt,sha256=FjsMjMV9heYkCS1UxodGursrHx4syTbob-ctphwLIA0,10
366
- hazelcast_python_client-5.3.0.dist-info/RECORD,,
363
+ hazelcast_python_client-5.4.0.dist-info/LICENSE.txt,sha256=xllut76FgcGL5zbIRvuRc7aezPbvlMUTWJPsVr2Sugg,11358
364
+ hazelcast_python_client-5.4.0.dist-info/METADATA,sha256=MBq4PrsSSEUaHE9K179jpPb-vHM0iCV1FEunxljESJE,8918
365
+ hazelcast_python_client-5.4.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
366
+ hazelcast_python_client-5.4.0.dist-info/top_level.txt,sha256=FjsMjMV9heYkCS1UxodGursrHx4syTbob-ctphwLIA0,10
367
+ hazelcast_python_client-5.4.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.40.0)
2
+ Generator: bdist_wheel (0.43.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5