tursodatabase / tursodatabase/libsql
Feature Request: Add embedded replicas support to C API
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 17.2k
- Forks
- 531
- Avg merge
- 1h 12m
- Merged PRs (30d)
- 1
Description
Current Behavior
Currently, the C API (libsql_experimental.h) only supports remote database mode through the libsql_config structure:
typedef struct {
const char *db_path;
const char *primary_url; // Only one URL parameter
const char *auth_token;
char read_your_writes;
const char *encryption_key;
int sync_interval;
char with_webpki;
} libsql_config;
This structure doesn't support the embedded replicas functionality that is available in the Rust API through the Builder pattern:
```rust
// Rust API supports different modes:
Builder::new_remote_replica(path, url, auth_token)
Builder::new_synced_database(path, url, auth_token)
Problem
Libraries that use the C API (like op-sqlite) cannot implement embedded replicas functionality because:
- There's no way to distinguish between primary URL and sync URL
- No way to specify the desired mode (remote/embedded replica/synced database)
- All operations go directly to the remote database instead of using local replica
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with libsql_experimental.h and the libsql_config structure, then compare its current options with the Rust Builder constructors named in the issue. Trace how the C API currently selects remote mode and how embedded replicas are represented in the Rust API. Done means C callers can distinguish primary and sync URLs and select the supported database modes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, rust
- Domain
- backend-api-design, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100