//! tidalDB quickstart: open an ephemeral database, verify health, and close. //! //! This example is the canonical first look at the tidalDB API. It compiles //! as a live contract — if the builder or health-check API changes, this //! example fails in CI. //! //! At M0 the database validates configuration and proves the builder works. //! Future milestones will add signal writes, queries, and ranking here. //! //! # Running //! //! ```bash //! cargo run --example quickstart --manifest-path tidal/Cargo.toml //! ``` fn main() -> Result<(), Box> { // Initialize tracing so spans emitted by tidalDB are visible. tracing_subscriber::fmt() .with_env_filter("tidaldb=debug") .init(); // Open an ephemeral (in-memory) database — no filesystem access. // Use TidalDb::builder().with_data_dir(path) for persistent storage. let db = tidaldb::TidalDb::builder().ephemeral().open()?; // Verify the database handle is operational. db.health_check()?; println!("build: {}", tidaldb::BUILD_HASH); println!("uptime: {:.3}s", db.metrics().uptime_seconds()); println!("health: ok"); // Explicit shutdown — also triggered automatically on drop. // Future milestones: flushes WAL and storage engine here. db.close()?; println!("tidalDB opened, verified, and closed. M0 complete."); Ok(()) }