aegis-common
Shared types, error definitions, and utilities used across all Aegis crates.
Overview
The aegis-common crate provides the foundational types and utilities that are shared across the entire Aegis database platform. This includes error handling, core data types, configuration structures, and common utilities.
Modules
error.rs
Unified error handling with the AegisError enum:
Storage- Storage layer errorsTransaction- Transaction-related errorsQuery- Query parsing/execution errorsParse- SQL parsing errorsReplication- Distributed replication errorsAuth- Authentication/authorization errorsConfig- Configuration errorsInternal- Internal system errors
Error classification methods:
is_retryable()- Whether the operation can be retriedis_user_error()- Whether the error is due to user input
types.rs
Core data types:
Identifiers:
BlockId- Storage block identifierPageId- Buffer pool page identifierTransactionId- Transaction identifierNodeId- Cluster node identifierShardId- Shard identifierLsn- Log sequence number
Value Types:
Valueenum - Multi-paradigm value representation (Null, Boolean, Integer, Float, String, Bytes, Timestamp, Array, Object)DataTypeenum - SQL data types (Boolean, Integer, Float, Text, Timestamp, etc.)
Structures:
Row- A row of valuesColumnDef- Column metadataTimeRange- Time range for queriesKeyRange- Key range for sharding
config.rs
Configuration management with TOML support.
utils.rs
Common utility functions.
Usage
use aegis_common::{AegisError, Result, Value, DataType, TransactionId};
fn example() -> Result<Value> {
let value = Value::Integer(42);
Ok(value)
}
Tests
4 tests covering error handling and type conversions.