aiondb-catalog

Catalog descriptor types and reader/writer traits. Defines the in-memory shape of every catalog object (schemas, tables, indexes, sequences, views, roles, privileges, functions, triggers, domains, user-defined types, casts, policies, rules, graph labels) and the trait surface that the storage-side catalog implementation has to satisfy. The crate has no runtime state; it only exposes the data model and the API boundary used by aiondb-catalog-store.

cargo

[dependencies]
aiondb-catalog = { path = "../aiondb-catalog" }

modules

modulepurpose
apicatalog reader/writer traits, alteration enums, sequence manager.
descriptorspersistent shape of every catalog object (table, index, view, ...).
graphnode and edge label descriptors for the graph layer.
pg_cataloghelpers to expose catalog state through pg_catalog-style views.
sequenceSequenceDescriptor for CREATE SEQUENCE.
statisticsper-table column statistics (Histogram, McvList).

key types

typerole
CatalogReadertrait for read-only catalog lookups (schemas, tables, indexes, ...).
CatalogWritertrait for catalog mutations (DDL).
CatalogTxnParticipanttrait letting the catalog enlist in user transactions.
SequenceManagertrait for nextval / currval / setval.
AccessPathMetadata(table, indexes, stats) triple consumed by the optimizer.
TableAlteration, IndexAlteration, SequenceAlterationenums describing one ALTER step.
TableDescriptor, IndexDescriptor, ViewDescriptor, SchemaDescriptorpersistent object descriptors.
ColumnDescriptor, IndexKeyColumn, CheckConstraint, ForeignKeyConstraintstructural fragments.
IndexKind, SortOrder, VectorDistanceMetric, VectorQuantizationKindclassification enums.
HnswParams, IdentityColumnDescriptorvector-index and identity-column options.
RoleDescriptor, PrivilegeDescriptor, PrivilegeTarget, CatalogPrivilegerole and grant model.
PolicyDescriptor, RuleDescriptor, TriggerDescriptorRLS, rewrite rules, triggers.
FunctionDescriptor, FunctionParamDescriptorstored functions and their parameters.
DomainDescriptor, DomainConstraintDescriptor, UserTypeDescriptor, CastDescriptoruser-defined types and casts.
NodeLabelDescriptor, EdgeLabelDescriptor, EdgeEndpointsgraph labels.
TableStatistics, ColumnStatistics, Histogram, McvListoptimizer statistics.
QualifiedName(schema, name) identifier used everywhere in the catalog.

example

use aiondb_catalog::{
    ColumnDescriptor, IndexDescriptor, IndexKeyColumn, IndexKind, QualifiedName, SortOrder,
    TableDescriptor,
};
use aiondb_core::{ColumnId, DataType, IndexId, RelationId, SchemaId};

let table = TableDescriptor {
    table_id: RelationId::new(1),
    schema_id: SchemaId::new(1),
    name: QualifiedName::qualified("public", "users"),
    columns: vec![ColumnDescriptor {
        column_id: ColumnId::new(1),
        name: "id".to_owned(),
        data_type: DataType::Int,
        text_type_modifier: None,
        nullable: false,
        ordinal_position: 1,
        default_value: None,
    }],
    identity_columns: Vec::new(),
    primary_key: Some(vec![ColumnId::new(1)]),
    foreign_keys: Vec::new(),
    check_constraints: Vec::new(),
    shard_config: None,
    owner: None,
};

let index = IndexDescriptor {
    index_id: IndexId::new(1),
    schema_id: SchemaId::new(1),
    table_id: table.table_id,
    name: QualifiedName::qualified("public", "users_pkey"),
    unique: true,
    nulls_not_distinct: false,
    kind: IndexKind::BTree,
    key_columns: vec![IndexKeyColumn {
        column_id: ColumnId::new(1),
        sort_order: SortOrder::Ascending,
        nulls_first: false,
    }],
    include_columns: Vec::new(),
    hnsw_params: None,
};

let _ = (table, index);