tigerbeetle 0.16.64__py3-none-any.whl → 0.16.70__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.
- tigerbeetle/client.py +10 -6
- tigerbeetle/lib/aarch64-linux-gnu.2.27/libtb_client.so +0 -0
- tigerbeetle/lib/aarch64-linux-musl/libtb_client.so +0 -0
- tigerbeetle/lib/aarch64-macos/libtb_client.dylib +0 -0
- tigerbeetle/lib/x86_64-linux-gnu.2.27/libtb_client.so +0 -0
- tigerbeetle/lib/x86_64-linux-musl/libtb_client.so +0 -0
- tigerbeetle/lib/x86_64-macos/libtb_client.dylib +0 -0
- tigerbeetle/lib/x86_64-windows/tb_client.dll +0 -0
- {tigerbeetle-0.16.64.dist-info → tigerbeetle-0.16.70.dist-info}/METADATA +13 -3
- tigerbeetle-0.16.70.dist-info/RECORD +15 -0
- {tigerbeetle-0.16.64.dist-info → tigerbeetle-0.16.70.dist-info}/WHEEL +1 -1
- tigerbeetle-0.16.64.dist-info/RECORD +0 -15
tigerbeetle/client.py
CHANGED
|
@@ -60,20 +60,24 @@ class _IDGenerator:
|
|
|
60
60
|
Keeps a monotonically increasing millisecond timestamp between calls to `.generate()`.
|
|
61
61
|
"""
|
|
62
62
|
def __init__(self) -> None:
|
|
63
|
-
self.
|
|
63
|
+
self._last_time_ms = time.time_ns() // (1000 * 1000)
|
|
64
|
+
self._last_random = int.from_bytes(os.urandom(10), 'little')
|
|
64
65
|
|
|
65
66
|
def generate(self) -> int:
|
|
66
67
|
time_ms = time.time_ns() // (1000 * 1000)
|
|
67
68
|
|
|
68
69
|
# Ensure time_ms monotonically increases.
|
|
69
|
-
if time_ms <= self.
|
|
70
|
-
time_ms = self.
|
|
70
|
+
if time_ms <= self._last_time_ms:
|
|
71
|
+
time_ms = self._last_time_ms
|
|
71
72
|
else:
|
|
72
|
-
self.
|
|
73
|
+
self._last_time_ms = time_ms
|
|
74
|
+
self._last_random = int.from_bytes(os.urandom(10), 'little')
|
|
73
75
|
|
|
74
|
-
|
|
76
|
+
self._last_random += 1
|
|
77
|
+
if self._last_random == 2 ** 80:
|
|
78
|
+
raise Exception('random bits overflow on monotonic increment')
|
|
75
79
|
|
|
76
|
-
return (time_ms << 80) |
|
|
80
|
+
return (time_ms << 80) | self._last_random
|
|
77
81
|
|
|
78
82
|
# Module-level singleton instance.
|
|
79
83
|
_id_generator = _IDGenerator()
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tigerbeetle
|
|
3
|
-
Version: 0.16.
|
|
3
|
+
Version: 0.16.70
|
|
4
4
|
Summary: The TigerBeetle client for Python.
|
|
5
5
|
Project-URL: Homepage, https://github.com/tigerbeetle/tigerbeetle
|
|
6
6
|
Project-URL: Issues, https://github.com/tigerbeetle/tigerbeetle/issues
|
|
@@ -15,7 +15,7 @@ Requires-Python: >=3.7
|
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
|
|
17
17
|
<!-- This file is generated by [/src/scripts/client_readmes.zig](/src/scripts/client_readmes.zig). -->
|
|
18
|
-
# tigerbeetle
|
|
18
|
+
# tigerbeetle-python
|
|
19
19
|
|
|
20
20
|
The TigerBeetle client for Python.
|
|
21
21
|
|
|
@@ -77,7 +77,7 @@ ID and replica addresses are both chosen by the system that
|
|
|
77
77
|
starts the TigerBeetle cluster.
|
|
78
78
|
|
|
79
79
|
Clients are thread-safe and a single instance should be shared
|
|
80
|
-
between multiple concurrent tasks. This allows events to be
|
|
80
|
+
between multiple concurrent tasks. This allows events to be
|
|
81
81
|
[automatically batched](https://docs.tigerbeetle.com/coding/requests/#batching-events).
|
|
82
82
|
|
|
83
83
|
Multiple clients are useful when connecting to more than
|
|
@@ -803,3 +803,13 @@ transfer_errors = client.create_transfers(transfers)
|
|
|
803
803
|
# Since it is a linked chain, in case of any error the entire batch is rolled back and can be retried
|
|
804
804
|
# with the same historical timestamps without regressing the cluster timestamp.
|
|
805
805
|
```
|
|
806
|
+
|
|
807
|
+
## Timeouts And Cancellation
|
|
808
|
+
|
|
809
|
+
The Client retries indefinitely and doesn't impose any per-request timeout. Cancellation is
|
|
810
|
+
provided as a mechanism, and the specific cancellation policy is left to the
|
|
811
|
+
application. A Client instance can be closed at any time. On close, all in-flight
|
|
812
|
+
requests are canceled and return an error to the caller. Even if an error is returned,
|
|
813
|
+
a request might still be processed by the TigerBeetle server.
|
|
814
|
+
[Reliable transaction submission](https://docs.tigerbeetle.com/coding/reliable-transaction-submission/)
|
|
815
|
+
explains how to make transfers retry-proof using IDs for end-to-end idempotency.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
tigerbeetle/__init__.py,sha256=vrZ9rqFxHpXtACa9qDhwKwSkhv3CGhAvg7vF3Ges8c0,957
|
|
2
|
+
tigerbeetle/bindings.py,sha256=NSND7UuFpnd4TRBDA9aDJLRS115QNi3m0dVksekVlZg,28155
|
|
3
|
+
tigerbeetle/client.py,sha256=eBvATWmEWrhPzmHB8bY9IfxZTjwLhilD0ontLr-2pNM,12239
|
|
4
|
+
tigerbeetle/lib.py,sha256=1Qln-Z4ZoCHJJ43sXlJJEs7-ZY5aZJjNNu7eISooAK8,2432
|
|
5
|
+
tigerbeetle/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
tigerbeetle/lib/aarch64-linux-gnu.2.27/libtb_client.so,sha256=uQ42OPwupDaTIWQFO_YPyi3Ixsht2jy2zMjCyeWH4Ic,548728
|
|
7
|
+
tigerbeetle/lib/aarch64-linux-musl/libtb_client.so,sha256=L-6cujG02R7ejaxuJIrPbcH0mM1PGVxMvL_xxWGiscc,547024
|
|
8
|
+
tigerbeetle/lib/aarch64-macos/libtb_client.dylib,sha256=LT6ZiqYghudmRS_nGcwiFbf_0a5eANbh9uzT0LSJzJU,552720
|
|
9
|
+
tigerbeetle/lib/x86_64-linux-gnu.2.27/libtb_client.so,sha256=bHi-MVurAP7LC1cUm3SqH8gfqn-Gx7ayNgdcgnnJuSc,618696
|
|
10
|
+
tigerbeetle/lib/x86_64-linux-musl/libtb_client.so,sha256=7927IkL43Gz7DApUZVPYsAVwlUjLxAhpqplUBdJxNOM,617176
|
|
11
|
+
tigerbeetle/lib/x86_64-macos/libtb_client.dylib,sha256=B-cBD8T2EmGAye9vz34bJCfHRFGUI4ygiSxpVECcbjU,600300
|
|
12
|
+
tigerbeetle/lib/x86_64-windows/tb_client.dll,sha256=zmHx_Ye-5iJ2-qJ1pKma7LB2LBMyXAukZIBzxqW8z4U,450560
|
|
13
|
+
tigerbeetle-0.16.70.dist-info/METADATA,sha256=BnFwd7xD3rAzlbccIUNwV1OKthCRzgrU3Ky_W667lzA,24050
|
|
14
|
+
tigerbeetle-0.16.70.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
15
|
+
tigerbeetle-0.16.70.dist-info/RECORD,,
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
tigerbeetle/__init__.py,sha256=vrZ9rqFxHpXtACa9qDhwKwSkhv3CGhAvg7vF3Ges8c0,957
|
|
2
|
-
tigerbeetle/bindings.py,sha256=NSND7UuFpnd4TRBDA9aDJLRS115QNi3m0dVksekVlZg,28155
|
|
3
|
-
tigerbeetle/client.py,sha256=pWHfWaO0oA1TDhOtIjxlTCuMPi8cwVNcTduOPxjibuQ,12005
|
|
4
|
-
tigerbeetle/lib.py,sha256=1Qln-Z4ZoCHJJ43sXlJJEs7-ZY5aZJjNNu7eISooAK8,2432
|
|
5
|
-
tigerbeetle/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
tigerbeetle/lib/aarch64-linux-gnu.2.27/libtb_client.so,sha256=pQkdJ7sCsFkVYgLxjExQXi2Q9PfH6Oq1PKkz8sHcCJg,691064
|
|
7
|
-
tigerbeetle/lib/aarch64-linux-musl/libtb_client.so,sha256=nQnWsFL9xGPrNxw4aZwBO_BAF59bOGNnaqZx0PIhyjw,689344
|
|
8
|
-
tigerbeetle/lib/aarch64-macos/libtb_client.dylib,sha256=P2VLKNa2srnUpDGb3sqJeXc1aBMRowDFFMS-a3ShnZk,696352
|
|
9
|
-
tigerbeetle/lib/x86_64-linux-gnu.2.27/libtb_client.so,sha256=cHcesNMuCYVQY1DIdAgJvN7HUxL6S9E53ryJGYVVF2A,814120
|
|
10
|
-
tigerbeetle/lib/x86_64-linux-musl/libtb_client.so,sha256=lpPDXBink1nUnozYWmbEj6OosoMbtRvJR3CVa2qMI6s,812600
|
|
11
|
-
tigerbeetle/lib/x86_64-macos/libtb_client.dylib,sha256=X-CLievVZ57kZVzSF8xoR_d62bIUKQC5rMKs_vV4wBc,788694
|
|
12
|
-
tigerbeetle/lib/x86_64-windows/tb_client.dll,sha256=r7j2g14w7aqJu2xKEmk-whDWioaiNCF12CaULiAXqtk,663040
|
|
13
|
-
tigerbeetle-0.16.64.dist-info/METADATA,sha256=p4qYjqt3jCVuI5UJXrhadTuc3vAC3a0vWzjegSVFP9U,23428
|
|
14
|
-
tigerbeetle-0.16.64.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
15
|
-
tigerbeetle-0.16.64.dist-info/RECORD,,
|