mecha10-core 0.6.2

Mecha10 core runtime and foundational types
Documentation
//! Schema Registry
//!
//! Provides versioned message schema storage and retrieval.
//! Enables schema evolution and documentation of message types.
//!
//! # Architecture
//!
//! - Stores schemas in Redis with versioning
//! - Each schema has a name and version number
//! - Schemas stored as JSON Schema format
//! - Supports listing all schemas and retrieving specific versions
//!
//! # Example
//!
//! ```rust
//! use mecha10::prelude::*;
//! use mecha10::schema::{SchemaRegistryExt, MessageSchema};
//!
//! # async fn example(ctx: &Context) -> Result<()> {
//! // Register a schema
//! let schema = MessageSchema::new("LaserScan", 1)
//!     .with_description("2D laser scan data")
//!     .with_field("timestamp", "integer", true)
//!     .with_field("ranges", "array", true)
//!     .with_field("intensities", "array", false);
//!
//! ctx.register_schema(&schema).await?;
//!
//! // Get latest schema
//! let schema = ctx.get_latest_schema("LaserScan").await?;
//!
//! // Get specific version
//! let schema_v1 = ctx.get_schema("LaserScan", 1).await?;
//!
//! // List all schemas
//! let all_schemas = ctx.list_schemas().await?;
//!
//! # Ok(())
//! # }
//! ```
//!
//! This module is organized into:
//! - `types`: The `MessageSchema`/`SchemaField` data model
//! - `registry`: The `SchemaRegistryExt` trait (CRUD against the Redis-backed registry)
//! - `registry_impl`: The `Context` implementation of `SchemaRegistryExt`
//! - `compatibility`: Schema evolution and compatibility checking
//! - `versioning`: Versioned schema operations built on top of the registry

mod compatibility;
mod registry;
mod registry_impl;
mod types;
mod versioning;

pub use compatibility::{CompatibilityCheck, CompatibilityMode, SchemaEvolution};
pub use registry::SchemaRegistryExt;
pub use types::{MessageSchema, SchemaField};
pub use versioning::{MessageVersionInfo, SchemaVersioningExt};

/// Get current Unix timestamp in seconds
fn current_timestamp() -> u64 {
    crate::prelude::now_secs()
}