Skip to main content

Crate surrealdb_catalog

Crate surrealdb_catalog 

Source
Expand description

The SurrealDB catalog.

Schema definitions in two forms per entity: a Stored* twin persisted with canonical SurrealQL text for its expression-bearing fields, and a runtime form holding compiled ASTs, bridged by FromStored/to_stored. The provider traits here are the read/write contract the datastore layer implements to serve definitions to the engine.

Every persisted catalog entry is a keyed map in the stored-value grammar, declared once per type by #[derive(Stored)] and frozen by catalog-schema.lock; entries a 3.x binary wrote in the revision encoding stay readable. The envelope, the dispatch between the two grammars, the feature-level rules and the embedded frame are described in stored.

This crate is an internal implementation detail of SurrealDB: its API is unstable and changes without notice. Depend on the surrealdb SDK or surrealdb-core instead.

Re-exports§

pub use feature::StoredFeatureLevel;
pub use layout::Column;
pub use layout::ColumnRole;
pub use layout::GenerationLayout;
pub use layout::LayoutDescriptor;
pub use layout::LayoutRefusal;
pub use layout::Location;
pub use layout::MAX_PATH_DEPTH;
pub use layout::PLANNED_PHYSICAL_KINDS;
pub use layout::PackedDescriptor;
pub use layout::PhysicalKind;
pub use layout::Presence;
pub use layout::RecordLayoutError;
pub use layout::RowLayout;
pub use layout::TableLayouts;
pub use layout::VERIFIED_EPOCH;
pub use layout::decode_generation;
pub use schema::ApiMethod;
pub use schema::DiskAnnParams;
pub use schema::Distance;
pub use schema::FullTextParams;
pub use schema::HnswParams;
pub use schema::Scoring;
pub use schema::StoredApiDefinition;
pub use schema::VectorType;
pub use view_state::StoredStat;
pub use view_state::ViewState;
pub use surrealdb_iam as iam;
pub use schema::*;
pub use record::*;
pub use view::*;

Modules§

aggregation
Common code related to aggregation calculations.
api_path
The API route-path vocabulary persisted by API definitions.
auth
expr
The type definitions for the computation format of the surreaql executor.
feature
The store-wide feature level record. The store-wide feature level record.
layout
Row layouts of table generations. Row layouts of table generations: the immutable descriptor each generation’s rows are read against, and the set of them one table holds.
node
Cluster-node registration and liveness bookkeeping.
packed
Packed rows: writing and reading the rows of a packed descriptor. Packed rows: the rows of a table generation whose descriptor (PackedDescriptor) lists columns, written by pack, and decoded whole by PackedRow::decode. A reader that takes a packed row in place takes it only as a CheckedPackedRow, which StoredRecord::checked_packed makes by walking the row through the same code as the whole decode, instantiated to build nothing. So an in-place read refuses every row the whole decode refuses, with the same error, whichever fields it asks for.
providers
Catalog providers.
record
Record module for SurrealDB
schema
stored
Catalog entries in the stored-value grammar. Catalog entries in the stored-value grammar.
syn
Compiles parser-next’s flat tree into logical plans and native payloads.
val
view
view_state
The running statistics of an aggregated view’s groups, in the stored grammar.

Macros§

catalog_vtable
Builds the CatalogVTable of a type.
impl_kv_value_catalog
Implements KVValue for a catalog type written in either grammar: revision at the Legacy level, the stored grammar above it.
impl_kv_value_stored
Implements KVValue for a catalog type that has no revision form: the stored grammar only, refused at the Legacy level, and written only through the levelled transaction path.

Structs§

AccessGrant
AccessGrantWalker
Walker for a revisioned struct. Generated by #[revisioned(...)].
CompiledSubscription
The evaluable half of a subscription.
DatabaseCompatibility
A database’s compatibility level: how strictly its SCHEMAFULL tables hold their stored rows to their field definitions.
DatabaseDefinition
DatabaseDefinitionWalker
Walker for a revisioned struct. Generated by #[revisioned(...)].
DatabaseId
FieldCandidate
One field definition compiled for the claim rules (birth_claims_of) and for the derivation of a packed layout (derive_layout).
FieldClaim
The claim that one field of a table conforms.
Generation
A generation of a table: a nonzero u16, which names one descriptor of the table’s ring.
GenerationMark
The highest generation minted for a table name of a database, stored under the database’s !gn key for that name.
GenerationRing
A table’s generation ring: the generations from base to head in mint order, and the floor.
GrantBearer
GrantBearerWalker
Walker for a revisioned struct. Generated by #[revisioned(...)].
GrantJwt
GrantJwtWalker
Walker for a revisioned struct. Generated by #[revisioned(...)].
GrantRecord
GrantRecordWalker
Walker for a revisioned struct. Generated by #[revisioned(...)].
GrantWalker
Walker for a revisioned enum. Generated by #[revisioned(...)].
LogicalBlockBody
A block clause of a definition — a function body — compiled to its logical operator on first use and kept for the life of the definition. The block counterpart of LogicalBody, with the same identity and caching rules.
LogicalBody
An expression clause of a definition, compiled to its logical form on first use and kept for the life of the definition.
Migration
The migration a generation carries: a name, unique per table, and what the migration does to a row stamped before it.
MigrationRun
The permanent record that a table ran the migration whose name keys it.
MigrationTest
The whole test a rewritten value must pass, as the catalog stood when its step was minted.
ModuleExecutableWalker
Walker for a revisioned enum. Generated by #[revisioned(...)].
NamespaceDefinition
NamespaceDefinitionWalker
Walker for a revisioned struct. Generated by #[revisioned(...)].
NamespaceId
NodeLiveQuery
NodeLiveQueryWalker
Walker for a revisioned struct. Generated by #[revisioned(...)].
Relation
SiloExecutable
SiloExecutableWalker
Walker for a revisioned struct. Generated by #[revisioned(...)].
StoredSubscriptionDefinition
StoredSubscriptionDefinitionWalker
Walker for a revisioned struct. Generated by #[revisioned(...)].
StoredSubscriptionFieldsWalker
Walker for a revisioned enum. Generated by #[revisioned(...)].
StoredTableDefinition
StoredTableDefinitionWalker
Walker for a revisioned struct. Generated by #[revisioned(...)].
SubjectWalker
Walker for a revisioned enum. Generated by #[revisioned(...)].
SubscriptionDefinition
Runtime form of StoredSubscriptionDefinition.
SurqlText
Canonical SurrealQL text stored in a catalog definition, tagged with the type T it compiles back to.
SurrealismExecutable
SurrealismExecutableWalker
Walker for a revisioned struct. Generated by #[revisioned(...)].
TableConformance
The claims of a table, strictly ascending by field.
TableDefinition
Runtime form of StoredTableDefinition.
TableId
TableMigrations
A table’s generation ring, stored under the table’s !mi key.
TableShape
What derivation reads of a table definition.
TaskLease
Represents a distributed task lease stored in the datastore.
TaskLeaseWalker
Walker for a revisioned struct. Generated by #[revisioned(...)].

Enums§

Conformance
What is known of a field’s values across the rows of its table.
Error
A failure in the catalog layer.
Grant
MigrationStep
What a migration does to a row older than it.
ModuleExecutable
ModuleName
The parsed name of an extension: an ext:: name, or the package release of an unnamed silo definition.
StoredSubscriptionFields
Subject
SubscriptionFields
Runtime form of StoredSubscriptionFields.
SubscriptionQuery
A subscription’s query, which may no longer compile.
TableType
The type of records stored by a table

Constants§

INERT_SUBSCRIPTION_MARKER
Marker appended to an inert subscription’s rendering.

Traits§

FromStored
Builds a runtime catalog form from its stored (canonical-text) counterpart.
SurqlTarget
A type that round-trips through the canonical SurrealQL text stored in catalog definitions.

Functions§

birth_claims
The claims a table takes at its birth from its field definitions, each definition given as its FieldKey component and stored value.
birth_claims_of
The claims a table takes at its birth from its compiled field definitions.
definition_digest
The digest of a field definition: FNV-1a-64 over its canonical stored bytes, with the 64 bits read as an i64.
derive_layout
The layout the rows of table are written in at a generation minted now, derived from the table’s definition and its compiled field definitions alone.
extension_name
The name SurrealQL addresses an extension by, from its storage name: a named extension is stored as mod::name and addressed as ext::name; an unnamed silo definition is stored as silo::org::pkg::<v> and addressed as silo::org::pkg<v>. Any other name is returned as it is.
from_stored_all
Build every runtime definition in a stored slice.
table_select_permission
The SELECT permission guarding a table, for callers holding a table lookup that may have missed.

Type Aliases§

BlockText
Canonical text of a { ... } block (function bodies).
ExprText
Canonical text of an expression (VALUE/ASSERT/WHEN/THEN/ permission clauses, API actions, fetch targets, …).
FieldsText
Canonical text of a SELECT-clause field list (live subscriptions).
IdiomText
Canonical text of an idiom path (index columns).
KindText
Canonical text of a kind-grammar type annotation (TYPE, function argument/return types).
LogicalBlockText
Canonical text of a { ... } block, compiled to the logical operator the streaming engine runs. The same grammar and the same stored bytes as BlockText; only the compile target differs. See SurqlText::<Block>::to_logical.
LogicalExprText
Canonical text of an expression, compiled to the logical scalar the streaming engine evaluates. The same grammar and the same stored bytes as ExprText; only the compile target differs. See SurqlText::to_logical.
PathText
Canonical text of an API’s route path (/users/:id<int>/*rest).