tigerbeetle 0.16.61__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 CHANGED
@@ -60,23 +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._time_ms_last = time.time_ns() // (1000 * 1000)
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._time_ms_last:
70
- time_ms = self._time_ms_last
70
+ if time_ms <= self._last_time_ms:
71
+ time_ms = self._last_time_ms
71
72
  else:
72
- self._time_ms_last = time_ms
73
+ self._last_time_ms = time_ms
74
+ self._last_random = int.from_bytes(os.urandom(10), 'little')
73
75
 
74
- randomness = os.urandom(10)
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 int.from_bytes(
77
- time_ms.to_bytes(6, "big") + randomness,
78
- "big",
79
- )
80
+ return (time_ms << 80) | self._last_random
80
81
 
81
82
  # Module-level singleton instance.
82
83
  _id_generator = _IDGenerator()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tigerbeetle
3
- Version: 0.16.61
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,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.27.0
2
+ Generator: hatchling 1.28.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,15 +0,0 @@
1
- tigerbeetle/__init__.py,sha256=vrZ9rqFxHpXtACa9qDhwKwSkhv3CGhAvg7vF3Ges8c0,957
2
- tigerbeetle/bindings.py,sha256=NSND7UuFpnd4TRBDA9aDJLRS115QNi3m0dVksekVlZg,28155
3
- tigerbeetle/client.py,sha256=iLvRvUk-_YNip2ZIzPV3C5BbqjvlYa4vHDXbQpAoDnU,12048
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=SIMaXMGgHACHI8tJxue6MvZmtjphMdvNW2Eh_sm3wQ4,690760
7
- tigerbeetle/lib/aarch64-linux-musl/libtb_client.so,sha256=btk7SbHNyvdUB87od1kHYJrsdXsF6w7XK9Mt-Xc5shk,689056
8
- tigerbeetle/lib/aarch64-macos/libtb_client.dylib,sha256=27aCGFk6pvSstgK6HFUiJF11XzExFrzT6qmADSziLsA,700320
9
- tigerbeetle/lib/x86_64-linux-gnu.2.27/libtb_client.so,sha256=5GgbPr5cYllBvpqswanGFBVJAKb_kiQrcBf9zO2imI8,813800
10
- tigerbeetle/lib/x86_64-linux-musl/libtb_client.so,sha256=FRvKh9jaQaeLlS9bF_Ot5PXzgpvRrhC7oxnuZtu-heE,812280
11
- tigerbeetle/lib/x86_64-macos/libtb_client.dylib,sha256=ZwDKWSMyKXeraJXy49EmOIaNRDhTFs1rqzsZE02TG94,792679
12
- tigerbeetle/lib/x86_64-windows/tb_client.dll,sha256=yf3JxjfmCtI-4uru9n8J9LxrZmcABgrVaAZBTFo9z6c,661504
13
- tigerbeetle-0.16.61.dist-info/METADATA,sha256=969rksxWOX-OGXCLOAw1bLgt4SsODt7bz8by3A5g0Ds,23428
14
- tigerbeetle-0.16.61.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
- tigerbeetle-0.16.61.dist-info/RECORD,,