Skip to main content

Crate mongreldb_kit

Crate mongreldb_kit 

Source
Expand description

Storage-backed MongrelDB Kit crate.

This crate wraps MongrelDB core with the kit schema model, transaction semantics, query execution, and migration runner.

Re-exports§

pub use db::ApproxAggKind;
pub use db::ApproxAggregate;
pub use db::Database;
pub use db::ExplainPlan;
pub use db::IncrementalAggKind;
pub use db::IncrementalAggregate;
pub use db::SimilarRow;
pub use error::KitError;
pub use error::Result;
pub use migrate::migrate;
pub use query::JoinRow;
pub use schema::Row;
pub use txn::Transaction;

Modules§

arrow_util
Arrow IPC <-> JSON row helpers, shared by the embedded SQL surface ([Database::sql] / sql_arrow / sql_rows) and the optional remote HTTP client. Kept here (rather than inside remote.rs) so the default embedded build — which has no HTTP dependency — can still decode the Arrow IPC bytes that MongrelSession::run produces.
check
Evaluation of table/column check constraints.
db
Database handle for mongreldb-kit.
error
Error model for mongreldb-kit.
external
keys
Key encoding for Kit indexes, guards, and primary keys.
migrate
Migration runner for mongreldb-kit.
migrations
Migration planning and checksums.
planner
Delete planning: compute the set of rows affected by a delete, including cascade, set-null, and restrict foreign-key actions.
procedure
pushdown
Predicate pushdown: translate Kit Expr predicates into MongrelDB core Conditions so the native engine can resolve them via indexes instead of a full-scan + Rust evaluation (Kit Priority 1).
query
Query execution for kit statements.
schema
Schema/value conversion between the kit model and MongrelDB core.
trigger
tsv
TSV import/export for kit tables.
txn
Kit transaction wrapper around a MongrelDB core transaction.
validation
Row validation against a Table schema.

Structs§

Aggregate
A single aggregate output column, e.g. SUM(total) AS total_sum.
AggregateQuery
A grouped/aggregated query. Rows are scanned, optionally filtered, grouped by group_by key columns, reduced with aggregates, and finally filtered by having. With no group_by, the whole (filtered) table is one group.
CacheStats
Cumulative page-cache access counters (Priority 14: hit visibility). A hit is a lookup that returned a page visible to the snapshot; a miss is a lookup that found nothing or an entry too new for the snapshot (the caller then reads from disk).
CheckConstraint
A named table-level check constraint.
CheckParseError
Error produced when a check expression cannot be parsed.
Column
A column definition.
Cte
A common table expression: a named, materialized subquery. A later query can read from name as if it were a table.
Delete
A DELETE statement.
DeletePlan
Result of planning a delete against a schema.
ForeignKey
A foreign-key reference from child columns to parent columns.
Index
An index on one or more columns.
Insert
An INSERT statement.
Join
One joined table in a JoinQuery.
JoinQuery
A nested-loop join query. The result is a list of combined rows; each combined row is a JSON object keyed by table alias whose values are that source’s row object (or JSON null for an unmatched right side of a LEFT join). Column references in filter/order_by/join on must be qualified (alias.column).
Migration
A numbered schema migration.
OrderBy
An ORDER BY clause.
ProcedureSpec
RestrictedConstraint
A foreign-key constraint that blocks the delete.
RowRef
A row identified for deletion planning.
Schema
A validated collection of tables.
Select
A SELECT statement.
Sequence
A monotonic sequence allocator.
SetNullUpdate
A child row that must be updated to set its foreign-key columns to null.
Table
A table definition.
TriggerConfig
TriggerSpec
UniqueConstraint
A uniqueness constraint over one or more columns.
Update
An UPDATE statement.
Upsert
An UPSERT statement.
ValidationError
A validation failure returned by validate_row.
ViewSpec
A SQL view definition (CREATE VIEW <name> AS <select>). Views are session-scoped in the engine (not persisted to the catalog), so a view created via a migration lives in the kit’s long-lived SQL session for the database’s lifetime — mirroring how the daemon and long-lived apps use MongrelDB. See Database::sql / refresh_sql_session.
VirtualTableSpec

Enums§

AggFunc
An aggregate function.
ColumnType
Storage/application types supported by Kit columns.
DefaultKind
How a default value is produced when a row omits a column.
Direction
Sort direction for ORDER BY.
Expr
A query expression.
ForeignKeyAction
Action taken when a referenced parent row is deleted.
IndexBuildPolicy
When a bulk load (bulk_load / bulk_load_columns / bulk_load_fast) builds the live in-memory indexes.
IndexKind
The kind of secondary index the Kit declares on a column.
JoinKind
The kind of join to perform.
KeyComponent
A single typed key component.
Literal
A scalar literal.
MigrationOp
A single schema-migration operation.
OnConflict
SQL-style conflict behavior for UPSERT.
PlannerError
Errors returned by delete planning.
Query
Top-level query statement.
SchemaError
Errors that can occur while constructing a Schema.

Constants§

KIT_KEY_VERSION
Stable on-disk format version embedded in unique-key encodings.

Functions§

decode_pk
Decode an encoded primary key into its typed components.
encode_component
Encode a single typed component.
encode_pk
Encode a primary key value.
encode_row_guard_key
Encode a row-guard key for optimistic foreign-key checks.
encode_unique_key
Encode a unique-constraint key.
eval_check
Evaluate a check expression against a row.
migration_checksum
Compute a deterministic, content-aware SHA-256 checksum for a migration.
plan_delete
Plan the deletion of a single row identified by its table and primary key.
plan_migrations
Plan the migrations that must be applied.
quote_ident
validate_row
Validate a JSON row against a table definition.