Skip to main content

datazen_driver_api/
lib.rs

1//! Public API for DataZen database driver plugins.
2//!
3//! External drivers depend on this crate and implement [`DatabaseDriver`].
4//! They register themselves at link time via the [`register_driver!`] macro,
5//! which uses the [`inventory`] crate for zero-code discovery in the host binary.
6
7pub use async_trait::async_trait;
8pub use inventory;
9
10pub mod command;
11mod factory;
12mod query_stream;
13mod reuse;
14pub mod sql_dump;
15pub mod sync;
16mod traits;
17mod types;
18
19pub use command::{
20    check_command_access, execute_command_definition, execute_command_definition_for,
21    query_command_definition, query_command_definition_for, query_only_command_definitions,
22    required_access_level, statement_command_definitions, validate_command_input,
23    CommandAccessLevel, CommandCategory, CommandResult, DriverCommandDefinition,
24    DriverCommandMetadata,
25};
26pub use factory::*;
27pub use query_stream::{
28    append_select_limit, emit_execute_statement, emit_multi_query_as_stream, stream_decoded_rows,
29    QueryRowBatcher, QueryStreamCallback, QueryStreamEvent, QUERY_STREAM_BATCH_SIZE,
30};
31pub use reuse::ReuseDriver;
32pub use sync::{
33    BoxedSyncAdapter, IRColumn, IRDefault, IRTable, IRType, SyncAdapterFactory, SyncSourceAdapter,
34    SyncTargetAdapter,
35};
36pub use traits::*;
37pub use types::*;
38
39/// Protocol version for the driver API.
40///
41/// Bump this when making breaking changes to `DatabaseDriver`, `KeyValueDriver`,
42/// or `DatabaseDriverFactory` traits.
43pub const PROTOCOL_VERSION: u32 = 2;
44
45/// Minimum protocol version the host still supports.
46///
47/// Plugins with version < MIN will be rejected; those between MIN and current
48/// will run in degraded mode (missing capabilities default to `false`).
49pub const MIN_PROTOCOL_VERSION: u32 = 1;