tb-rs
Native Rust client for TigerBeetle, the financial transactions database.
Compatibility
This client is compatible with TigerBeetle 0.16.x.
TigerBeetle requires exact client-server protocol compatibility. This crate's version
follows the format TB_VERSION+CRATE_VERSION (e.g., 0.16.0+0.1.0), where:
- The main version (
0.16.0) indicates TigerBeetle server compatibility - The build metadata (
+0.1.0) indicates the library version
You can check compatibility at runtime:
println!;
println!;
Features
- High-performance: Uses io_uring for efficient async I/O on Linux
- Type-safe: Strong typing for accounts, transfers, and results
- Simple API: One
Clienttype with a clean builder pattern
Requirements
- Linux (kernel 5.6+) with io_uring support
- Rust 1.75+
- TigerBeetle server 0.16.x
Installation
Add to your Cargo.toml:
[]
= "0.16" # Compatible with TigerBeetle 0.16.x
Note: The version "0.16" matches all 0.16.x+* versions. Cargo ignores build metadata for dependency resolution.
Quick Start
use ;
Configuration
Use the builder pattern for custom configuration:
use Duration;
use Client;
let client = builder
.cluster
.addresses?
.connect_timeout
.request_timeout
.build
.await?;
API
Account Operations
create_accounts(&[Account])- Create accounts, returns errors for failureslookup_accounts(&[u128])- Lookup accounts by IDquery_accounts(QueryFilter)- Query accounts with filtersget_account_balances(AccountFilter)- Get balance history
Transfer Operations
create_transfers(&[Transfer])- Create transfers, returns errors for failureslookup_transfers(&[u128])- Lookup transfers by IDquery_transfers(QueryFilter)- Query transfers with filtersget_account_transfers(AccountFilter)- Get transfers for an account
Thread Safety
The Client is !Send because io_uring submission queues are thread-local.
Create one client per thread if you need multi-threaded access.
License
Apache-2.0