Skip to main content

nodedb_client/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2
3//! NodeDB client SDK: the [`NodeDb`](traits::NodeDb) trait, the
4//! `NodeDbRemote` client (native MessagePack via TLS, opt-in via the
5//! `native` feature; pgwire compatibility via the `remote` feature), and
6//! capability negotiation.
7//!
8//! For embedded use, depend on `nodedb-lite` directly. For server use,
9//! enable the `native` feature and connect to a NodeDB Origin node via
10//! its native protocol — pgwire compatibility (`remote`) is provided so
11//! existing PostgreSQL drivers can connect for read-mostly workloads, but
12//! it is not the long-term ORM target.
13
14pub mod capabilities;
15pub mod traits;
16
17/// Shared row decoders used by both the trait default impls and the
18/// feature-gated clients. Feature-agnostic on purpose — one parser per
19/// row shape regardless of which transport delivered the row.
20mod row_decode;
21
22#[cfg(feature = "remote")]
23pub mod remote;
24#[cfg(feature = "remote")]
25mod remote_parse;
26
27#[cfg(feature = "native")]
28pub mod native;
29
30pub use capabilities::Capabilities;
31pub use traits::NodeDb;
32
33#[cfg(feature = "remote")]
34pub use remote::NodeDbRemote;
35
36#[cfg(feature = "native")]
37pub use native::builder::ConnectionBuilder;
38#[cfg(feature = "native")]
39pub use native::client::NativeClient;
40
41// Re-export core types so users only need `nodedb-client` in their Cargo.toml.
42pub use nodedb_types::error::{NodeDbError, NodeDbResult};
43pub use nodedb_types::{
44    Document, EdgeFilter, EdgeId, MetadataFilter, NodeId, QueryResult, SearchResult, SubGraph,
45    Value,
46};