aimdb-core 1.1.0

Type-safe async data pipelines — one Rust codebase from MCU to cloud
Documentation
//! AimDB Core Database Engine
//!
//! # aimdb-core
//!
//! Type-safe, async in-memory database for data synchronization
//! across MCU → edge → cloud environments.
//!
//! # Architecture
//!
//! - **RecordKey/RecordId**: Stable identifiers for multi-instance records
//! - **Unified API**: Single `Database<A>` type for all operations
//! - **Runtime Agnostic**: Works with Tokio (std) or Embassy (embedded)
//! - **Producer-Consumer**: Built-in typed message passing
//!
//! See examples in the repository for usage patterns.

#![cfg_attr(not(feature = "std"), no_std)]

#[cfg(feature = "alloc")]
extern crate alloc;

pub mod buffer;
pub mod builder;
pub mod connector;
pub mod context;
pub mod database;
mod error;
pub mod ext_macros;
pub mod extensions;
pub mod graph;
#[cfg(feature = "profiling")]
pub mod profiling;
pub mod record_id;
#[cfg(feature = "std")]
pub mod remote;
pub mod router;
pub mod time;
pub mod transform;
pub mod transport;
pub mod typed_api;
pub mod typed_record;

/// Marker trait used to add a `TimeOps` requirement to runtime-agnostic builder
/// methods *only* when the `profiling` feature is enabled.
///
/// When `profiling` is off this is a blanket no-op (every `R` implements it), so
/// the public API is unchanged. When `profiling` is on it requires
/// [`aimdb_executor::TimeOps`], which every real runtime adapter already provides
/// (it is part of [`aimdb_executor::Runtime`]).
#[cfg(feature = "profiling")]
pub trait RuntimeForProfiling: aimdb_executor::TimeOps {}
#[cfg(feature = "profiling")]
impl<R: aimdb_executor::TimeOps> RuntimeForProfiling for R {}

/// See the `profiling`-enabled definition above. Blanket no-op when `profiling`
/// is disabled.
#[cfg(not(feature = "profiling"))]
pub trait RuntimeForProfiling {}
#[cfg(not(feature = "profiling"))]
impl<R> RuntimeForProfiling for R {}

// Public API exports
pub use context::RuntimeContext;
pub use error::{DbError, DbResult};
pub use extensions::Extensions;

// Runtime trait re-exports from aimdb-executor
// These traits define the platform-specific execution, timing, and logging capabilities
pub use aimdb_executor::{
    ExecutorError, ExecutorResult, Logger, Runtime, RuntimeAdapter, RuntimeInfo, Spawn, TimeOps,
};

// Database implementation exports
pub use database::Database;

// Producer-Consumer Pattern exports
#[cfg(feature = "alloc")]
pub use builder::OutboundRoute;
pub use builder::{AimDb, AimDbBuilder};
pub use connector::ConnectorBuilder;
pub use transport::{Connector, ConnectorConfig, PublishError};
pub use typed_api::{Consumer, Producer, RecordRegistrar, RecordT, StageKind};
pub use typed_record::{AnyRecord, AnyRecordExt, TypedRecord};

// Stage profiling exports (feature-gated)
#[cfg(feature = "profiling")]
pub use profiling::{RecordProfilingMetrics, StageMetrics, StageProfilingInfo};

// Connector Infrastructure exports
pub use connector::TopicResolverFn;
pub use connector::{ConnectorClient, ConnectorLink, ConnectorUrl, SerializeError};
pub use connector::{TopicProvider, TopicProviderAny, TopicProviderFn, TopicProviderWrapper};

// Router exports for connector implementations
pub use router::{Route, Router, RouterBuilder};

// Record identification exports
pub use record_id::{RecordId, RecordKey, StringKey};

// Graph exports (dependency graph for record topology)
pub use graph::{DependencyGraph, EdgeType, GraphEdge, GraphNode, RecordGraphInfo, RecordOrigin};

// Transform API exports
#[cfg(feature = "alloc")]
pub use transform::{JoinBuilder, JoinEventRx, JoinPipeline, JoinTrigger};
pub use transform::{TransformBuilder, TransformPipeline};