Skip to main content

chronix_core/
lib.rs

1//! # chronix-core
2//!
3//! Core data model, types, errors, and configuration for the Chronix time-series
4//! database. This crate provides the foundational types that all other Chronix
5//! crates depend on.
6//!
7//! ## Overview
8//!
9//! - **Data model:** [`FieldValue`], [`SeriesKey`], [`Point`] — the fundamental
10//!   units of time-series data.
11//! - **Exact decimals:** [`Decimal`] — `mantissa × 10⁻ˢᶜᵃˡᵉ` for the one class
12//!   of series whose value is a legal quantity: metering, billing and
13//!   settlement. See [`decimal`] for why a `f64` cannot carry those.
14//! - **Schema:** [`MeasurementSchema`], [`SchemaRegistry`] — schema-on-write with
15//!   additive evolution.
16//! - **Errors:** [`ChronixError`] — crate-level and top-level error hierarchy.
17//! - **Configuration:** [`ChronixConfig`], [`WalConfig`] — full database
18//!   configuration with builder pattern.
19
20#![warn(missing_docs)]
21#![deny(unsafe_code)]
22#![allow(clippy::module_name_repetitions)]
23
24pub mod config;
25pub mod decimal;
26pub mod error;
27pub mod schema;
28pub mod types;
29pub mod wal_codec;
30
31pub use config::{
32    AnalyticsConfig, ChronixConfig, ChronixConfigBuilder, CompressionCodec, FloatEncoding,
33    FsyncPolicy, WalConfig,
34};
35pub use decimal::{
36    pow10, Decimal, DecimalError, DECIMAL_PRECISION, MAX_DECIMAL_MANTISSA, MAX_DECIMAL_SCALE,
37};
38pub use error::{ChronixError, ConfigError, SchemaError, WalError};
39pub use schema::{
40    ColumnDef, ColumnRole, ColumnType, MeasurementSchema, SchemaAction, SchemaRegistry,
41};
42pub use types::{
43    canonical_from_pairs, push_canonical, FieldValue, Fields, NamespaceId, NamespaceQuota,
44    NamespaceUsage, Point, SegmentId, SegmentState, SeriesKey, ShardId, Tags, Timestamp, Tombstone,
45    TombstoneSet, WalEntry, KV_SEPARATOR, MAX_STRING_FIELD_LENGTH, NAMESPACE_TAG,
46    RESERVED_COLUMN_NAMES, TAG_SEPARATOR, TIME_COLUMN,
47};
48pub use wal_codec::{
49    decode as wal_decode, encode as wal_encode, encode_write_point as wal_encode_write_point,
50    CodecError as WalCodecError,
51};