-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring #2
Refactoring #2
Conversation
https://github.com/kassane/tb-client-cpp/actions/runs/5014156725/jobs/8988076462#step:7:16 zig 0.9.1(clang-13) no has c++20 full-support. Works in zig 0.11.0-dev (clang-16) |
@batiati, the c client is missing some step during the run? Currently in the CI (C++ sample) maybe there is a issue with the C++ sample - output C sample - output$> /zig-out/bin/c_sample
TigerBeetle C Sample
Connecting...
debug(tb_client_context): 73372712115674697003588304400769413876: init: initializing
debug(tb_client_context): 73372712115674697003588304400769413876: init: allocating tb_packets
debug(tb_client_context): 73372712115674697003588304400769413876: init: parsing vsr addresses: 127.0.0.1:3000
debug(tb_client_context): 73372712115674697003588304400769413876: init: initializing IO
debug(tb_client_context): 73372712115674697003588304400769413876: init: initializing MessagePool
debug(tb_client_context): 73372712115674697003588304400769413876: init: initializing client (cluster_id=0, addresses={ 127.0.0.1:3000 })
debug(vsr): 73372712115674697003588304400769413876: ping_timeout started
debug(tb_client_context): 73372712115674697003588304400769413876: init: initializing thread
debug(tb_client_thread): 73372712115674697003588304400769413876: init: initializing signal
debug(tb_client_thread): 73372712115674697003588304400769413876: init: spawning thread
Creating accounts...
debug(message_bus): connecting to replica 0 in 94ms...
debug(client): 73372712115674697003588304400769413876: register: registering a session with the cluster
debug(client): 73372712115674697003588304400769413876: send_request_for_the_first_time: request=0 checksum=155301856535823733174576865266543992954
debug(vsr): 73372712115674697003588304400769413876: request_timeout started
debug(client): 73372712115674697003588304400769413876: sending request to replica 0: Header{ .checksum = 155301856535823733174576865266543992954, .checksum_body = 98287347720187652707502696638535748739, .parent = 0, .client = 73372712115674697003588304400769413876, .context = 0, .request = 0, .cluster = 0, .epoch = 0, .view = 0, .op = 0, .commit = 0, .timestamp = 0, .size = 128, .replica = 0, .command = Command.request, .operation = Operation.register, .version = 0 }
debug(client): 73372712115674697003588304400769413876: request: user_data=541594930264586538710988464 request=1 size=384 create_accounts
debug(message_bus): connecting to replica 0...
error(message_bus): error connecting to replica 0: error.ConnectionRefused
debug(message_bus): connecting to replica 0 in 105ms...
debug(message_bus): connecting to replica 0...
error(message_bus): error connecting to replica 0: error.ConnectionRefused
debug(message_bus): connecting to replica 0 in 90ms...
debug(message_bus): connecting to replica 0...
error(message_bus): error connecting to replica 0: error.ConnectionRefused
debug(message_bus): connecting to replica 0 in 274ms...
debug(message_bus): connecting to replica 0...
error(message_bus): error connecting to replica 0: error.ConnectionRefused
debug(message_bus): connecting to replica 0 in 732ms... |
It looks like there isn't a TigerBeetle server available to connect to, as the client keeps trying to reconnect. |
So I'll need try to run the server in the background. 🫣
I suspect that there are problems with mutex, which by the way in C++ it is common to assign un/lock(RAII) when using |
There's a helper for that in TigerBeetle's build.zig: |
This solve issue. Sync sample with thread-safe
This latest commit adds CMake full-support for tigerbeetle. Please give it a read to improve it, I'd appreciate it. |
Yes, that's the idea when converting the async API from I think C++ could follow the same strategy we have with Java/C# clients, exposing both async and blocking APIs. |
Yes, it could be enhanced to work asynchronously. Now that the initial example is working, I want to improve the CMake support. |
First experiment, turning very complicated and inefficient.
Currently refactored and tested in CI/CD together with tigerbeetle server.
Use of classes and (smart-)pointers will be minimized only in specific use cases, like RAII.
cc: @batiati