Skip to main content

headwaters_client/
lib.rs

1//! An async Rust client for the [Headwaters](https://github.com/open-lakehouse/headwaters)
2//! read API.
3//!
4//! [`HeadwatersClient`] wraps the generated ConnectRPC client with one method
5//! per read RPC, returning owned response messages. Build one from a base URL:
6//!
7//! ```no_run
8//! # async fn run() -> Result<(), headwaters_client::Error> {
9//! use headwaters_client::HeadwatersClient;
10//!
11//! let client = HeadwatersClient::connect("http://localhost:8091")?;
12//!
13//! // Browse, then walk the lineage graph.
14//! let dataset = client.get_dataset("analytics", "orders").await?;
15//! let node = headwaters_client::dataset_node_id("analytics", "orders");
16//! let graph = client.get_lineage(&node, 2).await?;
17//! println!("{} reachable nodes", graph.graph.len());
18//! # Ok(())
19//! # }
20//! ```
21//!
22//! The open-ended `facets` / `data` / `fields` / `events` fields on the response
23//! messages are `google.protobuf.Struct`; [`struct_to_json`] turns one into a
24//! [`serde_json::Value`].
25
26mod client;
27mod config;
28mod error;
29pub mod nodeid;
30pub mod types;
31
32pub use client::HeadwatersClient;
33pub use config::{DEFAULT_TIMEOUT, ENV_AUTH, ENV_TIMEOUT_MS, ENV_TOKEN, ENV_URL, HeadwatersConfig};
34pub use error::Error;
35pub use nodeid::{dataset_field_node_id, dataset_node_id, job_node_id};
36pub use types::*;