TraceDb Rust Library
The TraceDb Rust library provides convenient access to the TraceDb APIs from Rust.
Table of Contents
- Install
- Quickstart
- Current Packaging Boundary
- Claim Boundary
- Installation
- Reference
- Usage
- Environments
- Errors
- Request Types
- Advanced
- Contributing
Install
Quickstart
use ;
let config = from_env?;
let client = new;
let ready = client.ready_typed?;
println!;
Against an existing TraceDB HTTP server, run the bundled example from this repository:
Current Packaging Boundary
This repository is the standalone Rust SDK lane for
platform-contract-v0, pinned by tracedb-protocol.lock.
The crate owns its HTTP contract wire models directly and has no normal or
dev-dependency path links to the sibling core repo. Local integration tests
still start the sibling tracedb-server process through Cargo so the SDK can
exercise the real local HTTP product path without linking core crates. Those
real-server tests skip when the sibling core checkout is not present.
The source crate version for this release wave is tracedb-sdk = "0.1.1".
Claim Boundary
tracedb-sdk = "0.1.1" is Rust SDK packaging for the current TraceDB HTTP
product surface. It does not claim managed-cloud
readiness, hosted-alpha readiness, SQL compatibility, benchmark wins,
production SLA, or Go SDK support.
Installation
Add this to your Cargo.toml:
[]
= "0.1.1"
Or install via cargo:
Reference
A full reference for this library is available here.
Usage
Instantiate and use the client with the following:
use *;
async
Environments
This SDK allows you to configure different environments for API requests.
use ;
let config = ClientConfig ;
let client = new.expect;
Errors
When the API returns a non-success status code (4xx or 5xx response), an error will be returned.
match client.tracedb.admin.post_admin_compact?.await
Request Types
The SDK exports all request types as Rust structs. Simply import them from the crate to access them:
use ;
let request = RestoreRequest ;
Advanced
Retries
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2).
A request is deemed retryable when any of the following HTTP status codes is returned:
The retryStatusCodes configuration controls which 5XX status codes are retried:
legacy(default): Retries408,429, and all>= 500recommended: Retries408,429,502,503,504only (excludes500 Internal Server Errorto avoid retrying non-idempotent failures)
Use the max_retries method to configure this behavior.
let response = client.tracedb.admin.post_admin_compact?.await;
Timeouts
The SDK defaults to a 30 second timeout. Use the timeout method to configure this behavior.
let response = client.tracedb.admin.post_admin_compact?.await;
Additional Headers
You can add custom headers to requests using RequestOptions.
let response = client.tracedb.admin.post_admin_compact?
.await;
Additional Query String Parameters
You can add custom query parameters to requests using RequestOptions.
let response = client.tracedb.admin.post_admin_compact?
.await;
Contributing
While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!
On the other hand, contributions to the README are always very welcome!