llkv_table/lib.rs
1//! Table abstraction and system catalog for LLKV.
2//!
3//! This crate provides the [`Table`] type, which builds on [`llkv-column-map`]'s
4//! columnar storage to offer a higher-level, schema-aware interface. It includes:
5//!
6//! - **[`Table`]**: Schema-aware table abstraction with append, scan, and schema operations
7//! - **[`SysCatalog`]**: System catalog (table 0) that stores table and column metadata
8//! - **[`TableMeta`]** and **[`ColMeta`]**: Metadata structures for tables and columns
9//! - **Schema management**: Arrow schema integration with field ID tracking
10//! - **Scan operations**: Projection, filtering, ordering, and computed columns
11//! - **MVCC integration**: Automatic handling of `created_by` and `deleted_by` columns
12//!
13//! # Architecture
14//!
15//! Tables use [`ColumnStore`](llkv_column_map::ColumnStore) for physical storage but add:
16//! - Schema validation and enforcement
17//! - Field ID assignment and tracking
18//! - System catalog for metadata persistence
19//! - MVCC column management
20//! - Row ID filtering (for transaction visibility)
21//!
22//! # Table IDs
23//!
24//! - **Table 0**: Reserved for the system catalog (stores [`TableMeta`] and [`ColMeta`])
25//! - **Tables 1+**: User tables
26//!
27//! See [`CATALOG_TABLE_ID`] and [`is_reserved_table_id`](reserved::is_reserved_table_id).
28//!
29//! # System Catalog
30//!
31//! The [`SysCatalog`] stores table metadata in table 0, which is a reserved system table.
32#![forbid(unsafe_code)]
33
34pub mod catalog;
35pub mod constants;
36mod planner;
37pub mod reserved;
38mod scalar_eval;
39pub mod schema_ext;
40mod sys_catalog;
41pub mod expr {
42 pub use llkv_expr::expr::*;
43}
44
45pub mod table;
46pub mod types;
47
48pub use reserved::CATALOG_TABLE_ID;
49pub use sys_catalog::{ColMeta, SysCatalog, TableMeta};
50pub use table::Table;
51pub use types::{FieldId, RowId};
52
53pub use planner::plan_graph::{
54 PLAN_GRAPH_VERSION, PlanAnnotations, PlanEdge, PlanEdgeMetadata, PlanExpression, PlanField,
55 PlanGraph, PlanGraphBuilder, PlanGraphError, PlanGraphResult, PlanGraphVersion, PlanInput,
56 PlanNode, PlanNodeId, PlanOperator,
57};