Operations
TaiDB is embedded, so operations are mostly application-level decisions: database file location, backup policy, key management, compaction schedule, and upgrade testing.
File placement
Section titled “File placement”Use a durable application data directory, not a temporary directory, for data you need to keep.
Examples:
- desktop app data directory
- local service state directory
- project-specific cache directory for rebuildable indexes
Avoid storing databases inside source control.
Backups
Section titled “Backups”Use snapshots for simple backups:
taidb snapshot ./app.taidb ./backup.taidbIf the database is encrypted, back up the key separately and protect it with different access controls.
Process safety
Section titled “Process safety”TaiDB is embedded and single-writer. A writable open takes an exclusive file lock. Explicit read-only opens take a shared lock and can coexist with other read-only handles when no writer holds the database.
Use read-only opens when a tool should inspect an existing database without creating files:
let mut db = taidb::EngineConfig::new("./app.taidb") .read_only() .open()?;The CLI equivalent is:
taidb --read-only get ./app.taidb user:1taidb --read-only stats ./app.taidbWrite commands opened with --read-only fail with a read-only error.
Durability modes
Section titled “Durability modes”Choose durability based on whether the data can be rebuilt:
| Mode | Use case |
|---|---|
Buffered | Rebuildable caches where throughput matters most. |
Flush | Default application writes with explicit flushing. |
Sync | Data that should reach stable storage before the call returns. |
Verification
Section titled “Verification”Run verification after:
- import jobs
- crash recovery tests
- backup restore tests
- compaction jobs
- upgrades
taidb verify ./app.taidbCompaction schedule
Section titled “Compaction schedule”Use stats to decide when to compact:
taidb stats ./app.taidb --jsonCompact when stale data is large relative to live data. For rebuildable caches, it may be simpler to rebuild the database from source data.
Upgrade checklist
Section titled “Upgrade checklist”Before upgrading TaiDB:
- Back up the database and key files.
- Run
taidb verifywith the current version. - Read release notes for format or API changes.
- Run your application’s smoke tests against a copy.
- Run
taidb verifywith the new version.
Before 1.0.0, use extra caution because public API and storage format
stability are still roadmap items.