Skip to main content

Crate aimdb_core

Crate aimdb_core 

Source
Expand description

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
  • Runtime Agnostic: Works with Tokio (std) or Embassy (embedded)
  • Producer-Consumer: Built-in typed message passing

See examples in the repository for usage patterns.

§A panic is a bug, not an error channel

Every failure is a DbError. The crate is compiled under deny(clippy::unwrap_used, clippy::expect_used, clippy::panic) outside its tests; the sites that remain carry an allow with a reason. A dependency can still panic on its own, and a poisoned lock is recovered from.

§Where aimdb’s own reporting goes

Two optional destinations, neither on by default: tracing, the ordinary choice for a Rust binary, and log, for a host that cannot be handed a process-global subscriber — chiefly an FFI layer, which needs its callback’s context pointer to live somewhere a tracing::Layer has no room for. Both may be on at once; both off emits nothing. Events carry the emitting module as their target (aimdb_core::builder) either way. Every crate in this workspace that reports at all now does so through the facade, so a destination sees the connectors too. See docs/design/050 for filtering and duplicate delivery.

§What a log destination must guarantee

Getting one wrong costs a deadlock or memory unsafety, not a bad log line:

  1. Called from any thread, aimdb’s runtime thread included.
  2. Must not unwind — across a C or C++ boundary that is UB.
  3. Must not re-enter aimdb on a path that itself logs. log has no reentrancy guard (tracing does), so this recurses without bound. Getters are fine.
  4. Must not block on anything a thread might hold while calling into aimdb — that is the lock ordering.
  5. Cannot be uninstalled. set_logger is once per process; a second call returns Err and the first destination keeps receiving.

Re-exports§

pub use context::RuntimeContext;
pub use extensions::Extensions;
pub use executor::BoxFuture;
pub use executor::ExecutorError;
pub use executor::ExecutorResult;
pub use executor::LogLevel;
pub use executor::RuntimeOps;
pub use buffer::JsonReader;
pub use buffer::Reader;
pub use buffer::TryProduceError;
pub use builder::OutboundRoute;
pub use builder::AimDb;
pub use builder::AimDbBuilder;
pub use connector::ConnectorBuilder;
pub use transport::Connector;
pub use transport::ConnectorConfig;
pub use transport::PublishError;
pub use typed_api::Consumer;
pub use typed_api::InboundConnectorBuilder;
pub use typed_api::OutboundConnectorBuilder;
pub use typed_api::Producer;
pub use typed_api::RecordRegistrar;
pub use typed_record::JsonRecordAccess;
pub use typed_record::AnyRecord;
pub use typed_record::AnyRecordExt;
pub use typed_record::TypedRecord;
pub use codec::JsonCodec;
pub use codec::RemoteSerialize;
pub use codec::SerdeJsonCodec;
pub use remote::topic_leaf;
pub use session::is_wildcard;
pub use session::pattern_contains;
pub use session::pump_sink;
pub use session::pump_source;
pub use session::topic_matches;
pub use session::AuthError;
pub use session::BoxFut;
pub use session::BoxStream;
pub use session::CodecError;
pub use session::Connection;
pub use session::Dialer;
pub use session::Dispatch;
pub use session::EnvelopeCodec;
pub use session::Inbound;
pub use session::Listener;
pub use session::Outbound;
pub use session::Payload;
pub use session::PeerInfo;
pub use session::RpcError;
pub use session::SessionCtx;
pub use session::SessionLimits;
pub use session::Source;
pub use session::SubUpdate;
pub use session::TransportError;
pub use session::TransportResult;
pub use signal::SignalGaugeHandle;
pub use connector::TopicProvider;
pub use connector::TopicResolverFn;
pub use connector::ConnectorUrl;
pub use connector::LinkAddress;
pub use connector::SerializeError;
pub use connector::IngestFactoryFn;
pub use connector::IngestFn;
pub use connector::SerializedPayload;
pub use connector::SerializedReader;
pub use connector::SerializedSource;
pub use connector::SerializedValue;
pub use connector::SerializedValueInto;
pub use connector::SourceFactoryFn;
pub use router::Route;
pub use router::Router;
pub use router::RouterBuilder;
pub use record_id::RecordId;
pub use record_id::RecordKey;
pub use record_id::StringKey;
pub use graph::DependencyGraph;
pub use graph::EdgeType;
pub use graph::GraphEdge;
pub use graph::GraphNode;
pub use graph::RecordOrigin;
pub use transform::JoinBuilder;
pub use transform::JoinEventRx;
pub use transform::JoinPipeline;
pub use transform::JoinTrigger;
pub use transform::TransformBuilder;
pub use transform::TransformPipeline;

Modules§

buffer
Runtime-agnostic buffer traits and configuration for async producer-consumer dispatch
builder
Database builder with type-safe record registration
codec
JSON codec for records (feature remote, no_std + alloc compatible).
connector
Connector infrastructure for external protocol integration
context
Runtime context for AimDB services
executor
Runtime capability surface consumed by the database engine.
extensions
Generic extension storage for AimDbBuilder and AimDb.
graph
Dependency graph for AimDB record topology
record_id
Record identification types for stable, O(1) lookups
remote
Remote access subsystem for AimDB (AimX protocol)
router
Generic message router for efficient connector dispatch
session
Connector-session substrate — the shared machinery for transport-based remote access.
signal
Signal gauge handle: per-record domain-signal statistics.
transform
Reactive transform primitives for derived records.
transport
Transport connector traits for protocol-agnostic publishing
typed_api
Type-safe Producer-Consumer API
typed_record
Type-safe record storage using TypeId

Macros§

log_debug
log_error
log_info
log_trace
log_warn

Structs§

ConfigError
One configuration mistake found while configuring an AimDbBuilder.

Enums§

DbError
Streamlined error type for AimDB operations
DbErrorKind
What a caller does about a DbError: retry, resubscribe, stop, or fix something — and which something.

Type Aliases§

DbResult
Type alias for Results using DbError

Derive Macros§

RecordKey
Derive the RecordKey trait for an enum