tigerbeetle 0.16.17__py3-none-any.whl → 0.16.19__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/__init__.py +1 -1
- tigerbeetle/bindings.py +19 -3
- tigerbeetle/client.py +22 -0
- 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.17.dist-info → tigerbeetle-0.16.19.dist-info}/METADATA +6 -2
- tigerbeetle-0.16.19.dist-info/RECORD +14 -0
- {tigerbeetle-0.16.17.dist-info → tigerbeetle-0.16.19.dist-info}/WHEEL +1 -1
- tigerbeetle-0.16.17.dist-info/RECORD +0 -14
tigerbeetle/__init__.py
CHANGED
tigerbeetle/bindings.py
CHANGED
|
@@ -28,9 +28,11 @@ class PacketStatus(enum.IntEnum):
|
|
|
28
28
|
OK = 0
|
|
29
29
|
TOO_MUCH_DATA = 1
|
|
30
30
|
CLIENT_EVICTED = 2
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
CLIENT_RELEASE_TOO_LOW = 3
|
|
32
|
+
CLIENT_RELEASE_TOO_HIGH = 4
|
|
33
|
+
CLIENT_SHUTDOWN = 5
|
|
34
|
+
INVALID_OPERATION = 6
|
|
35
|
+
INVALID_DATA_SIZE = 7
|
|
34
36
|
|
|
35
37
|
|
|
36
38
|
Client = ctypes.c_void_p
|
|
@@ -45,6 +47,12 @@ class Status(enum.IntEnum):
|
|
|
45
47
|
NETWORK_SUBSYSTEM = 6
|
|
46
48
|
|
|
47
49
|
|
|
50
|
+
class RegisterLogCallbackStatus(enum.IntEnum):
|
|
51
|
+
SUCCESS = 0
|
|
52
|
+
ALREADY_REGISTERED = 1
|
|
53
|
+
NOT_REGISTERED = 2
|
|
54
|
+
|
|
55
|
+
|
|
48
56
|
class AccountFlags(enum.IntFlag):
|
|
49
57
|
NONE = 0
|
|
50
58
|
LINKED = 1 << 0
|
|
@@ -610,6 +618,7 @@ CQueryFilter._fields_ = [ # noqa: SLF001
|
|
|
610
618
|
# Don't be tempted to use c_char_p for bytes_ptr - it's for null terminated strings only.
|
|
611
619
|
OnCompletion = ctypes.CFUNCTYPE(None, ctypes.c_void_p, Client, ctypes.POINTER(CPacket),
|
|
612
620
|
ctypes.c_uint64, ctypes.c_void_p, ctypes.c_uint32)
|
|
621
|
+
LogHandler = ctypes.CFUNCTYPE(None, ctypes.c_uint8, ctypes.c_void_p, ctypes.c_uint)
|
|
613
622
|
|
|
614
623
|
# Initialize a new TigerBeetle client which connects to the addresses provided and
|
|
615
624
|
# completes submitted packets by invoking the callback with the given context.
|
|
@@ -639,6 +648,13 @@ tb_client_deinit.argtypes = [Client]
|
|
|
639
648
|
tb_client_submit = tbclient.tb_client_submit
|
|
640
649
|
tb_client_submit.restype = None
|
|
641
650
|
tb_client_submit.argtypes = [Client, ctypes.POINTER(CPacket)]
|
|
651
|
+
|
|
652
|
+
tb_client_register_log_callback = tbclient.tb_client_register_log_callback
|
|
653
|
+
tb_client_register_log_callback.restype = RegisterLogCallbackStatus
|
|
654
|
+
# Need to pass in None to clear - ctypes will error if argtypes is set.
|
|
655
|
+
#tb_client_register_log_callback.argtypes = [LogHandler, ctypes.c_bool]
|
|
656
|
+
|
|
657
|
+
|
|
642
658
|
class AsyncStateMachineMixin:
|
|
643
659
|
_submit: Callable[[Operation, Any, Any, Any], Any]
|
|
644
660
|
async def create_accounts(self, accounts: list[Account]) -> list[CreateAccountsResult]:
|
tigerbeetle/client.py
CHANGED
|
@@ -236,3 +236,25 @@ class ClientAsync(Client, bindings.AsyncStateMachineMixin):
|
|
|
236
236
|
raise inflight_packet.response
|
|
237
237
|
|
|
238
238
|
return inflight_packet.response
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
@bindings.LogHandler
|
|
242
|
+
def log_handler(level_zig, message_ptr, message_len):
|
|
243
|
+
level_python = {
|
|
244
|
+
0: logging.ERROR,
|
|
245
|
+
1: logging.WARNING,
|
|
246
|
+
2: logging.INFO,
|
|
247
|
+
3: logging.DEBUG,
|
|
248
|
+
}[level_zig]
|
|
249
|
+
logger.log(level_python, ctypes.string_at(message_ptr, message_len).decode("utf-8"))
|
|
250
|
+
|
|
251
|
+
tb_assert(bindings.tb_client_register_log_callback(log_handler, True) ==
|
|
252
|
+
bindings.RegisterLogCallbackStatus.SUCCESS)
|
|
253
|
+
|
|
254
|
+
def configure_logging(*, debug, log_handler=log_handler):
|
|
255
|
+
# First disable the existing log handler, before enabling the new one.
|
|
256
|
+
tb_assert(bindings.tb_client_register_log_callback(None, debug) ==
|
|
257
|
+
bindings.RegisterLogCallbackStatus.SUCCESS)
|
|
258
|
+
|
|
259
|
+
tb_assert(bindings.tb_client_register_log_callback(log_handler, debug) ==
|
|
260
|
+
bindings.RegisterLogCallbackStatus.SUCCESS)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: tigerbeetle
|
|
3
|
-
Version: 0.16.
|
|
3
|
+
Version: 0.16.19
|
|
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
|
|
@@ -47,6 +47,10 @@ import os
|
|
|
47
47
|
import tigerbeetle as tb
|
|
48
48
|
|
|
49
49
|
print("Import OK!")
|
|
50
|
+
|
|
51
|
+
# To enable debug logging, via Python's built in logging module:
|
|
52
|
+
# logging.basicConfig(level=logging.DEBUG)
|
|
53
|
+
# tb.configure_logging(debug=True)
|
|
50
54
|
```
|
|
51
55
|
|
|
52
56
|
Finally, build and run:
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
tigerbeetle/__init__.py,sha256=3cmov0HPkByJw1znLKoTqIuZUEeEQMEg1fflWY3ty9A,168
|
|
2
|
+
tigerbeetle/bindings.py,sha256=K3rgGuiH6kHO1rZOypk32S06O5OfHYHwLA2KQOyG2BM,26341
|
|
3
|
+
tigerbeetle/client.py,sha256=Xm9WumDj_aN3DVAnX7N3P1dT4QOT7LW91VrJQ-era6o,8588
|
|
4
|
+
tigerbeetle/lib.py,sha256=JKreDxdw_YejtH7F135_m6I6mNBSwjokaI6QicKm7cc,2425
|
|
5
|
+
tigerbeetle/lib/aarch64-linux-gnu.2.27/libtb_client.so,sha256=qx8DILqLjglR-Sn5tPBUu1k5BCz7tIWep9iGFfSvauQ,3676440
|
|
6
|
+
tigerbeetle/lib/aarch64-linux-musl/libtb_client.so,sha256=Fx9lIIn8WvuOW6qNjz5aBBBx5VIAg2ozT3fzFGouHF8,3653256
|
|
7
|
+
tigerbeetle/lib/aarch64-macos/libtb_client.dylib,sha256=lEmuxwV3AgRpGKu7VkFb2tFN7jXsEgLMeD0df1mhA1c,516336
|
|
8
|
+
tigerbeetle/lib/x86_64-linux-gnu.2.27/libtb_client.so,sha256=lAacu-usVbIOf6nAj_fW44Uj-6xEXMa_ThwCPTnmoFU,3591640
|
|
9
|
+
tigerbeetle/lib/x86_64-linux-musl/libtb_client.so,sha256=aa8TYkLhWerwJPfpT9iXYYIF2VCiWgcEHQUak7DDLOg,3588672
|
|
10
|
+
tigerbeetle/lib/x86_64-macos/libtb_client.dylib,sha256=y68dzVEXXI53kSdpWAEBJOgwSDugZWwkHMEJSEdax1I,716357
|
|
11
|
+
tigerbeetle/lib/x86_64-windows/tb_client.dll,sha256=4ce6L5QV_FEYvi2_KuyseksC23jOs0Y0Cls6cwT0xRE,819712
|
|
12
|
+
tigerbeetle-0.16.19.dist-info/METADATA,sha256=_BnbKcln6SPQXFt9MRg9O15Qm4GXsCNR5bXX9pl7rgA,22980
|
|
13
|
+
tigerbeetle-0.16.19.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
14
|
+
tigerbeetle-0.16.19.dist-info/RECORD,,
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
tigerbeetle/__init__.py,sha256=3B2UoTndlx7dViX1_TU4qM98pDzFjB6SujEsEdV4As8,149
|
|
2
|
-
tigerbeetle/bindings.py,sha256=TGVdrS-00_tVv-1EsbLx3FLYcSBqPn0tMvWNPJPx2oc,25789
|
|
3
|
-
tigerbeetle/client.py,sha256=eRrbTcAKN4n0mRvQNYn1i3C7-JNr-UHYiwLzIWvsyG0,7769
|
|
4
|
-
tigerbeetle/lib.py,sha256=JKreDxdw_YejtH7F135_m6I6mNBSwjokaI6QicKm7cc,2425
|
|
5
|
-
tigerbeetle/lib/aarch64-linux-gnu.2.27/libtb_client.so,sha256=9UECxzXVgN1nf-ooZnF6zdYCPQ2LCwQEQwKOt1G5zXE,3670776
|
|
6
|
-
tigerbeetle/lib/aarch64-linux-musl/libtb_client.so,sha256=cee7qh_3b9tIyWjPL0HhXTVid-sdt0QflXSDMCUNq4M,3647584
|
|
7
|
-
tigerbeetle/lib/aarch64-macos/libtb_client.dylib,sha256=t0uTPueUMPRbYbHJ7_AR74i52V6kfa3OBmhbd00NxbM,499600
|
|
8
|
-
tigerbeetle/lib/x86_64-linux-gnu.2.27/libtb_client.so,sha256=JMqbIOjVJbZhob5v2iHbC4FmhpdxyA1RphecFuFAevs,3591208
|
|
9
|
-
tigerbeetle/lib/x86_64-linux-musl/libtb_client.so,sha256=ckX1bB8SmI_cNKzXSNBg59M4ZyH1MrRhQxIgHRk_Xo4,3588208
|
|
10
|
-
tigerbeetle/lib/x86_64-macos/libtb_client.dylib,sha256=Vm2OKbFZae1HznJ34tgbAMjQaeF-YSvZQevDBKePdoQ,711941
|
|
11
|
-
tigerbeetle/lib/x86_64-windows/tb_client.dll,sha256=vCx6Jjxb_jU3xldi-n_h6owO8eM4U8IKwh7ZJB1HntQ,816128
|
|
12
|
-
tigerbeetle-0.16.17.dist-info/METADATA,sha256=efsQTgwXtfa4SzxvjJAwM_nenqy5HMzzKo4VK-sFLWU,22836
|
|
13
|
-
tigerbeetle-0.16.17.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
14
|
-
tigerbeetle-0.16.17.dist-info/RECORD,,
|