Skip to main content

Module view_definition_store

Module view_definition_store 

Source
Expand description

Postgres-backed persistence for DDL-defined view definitions (lakehouse_view_set_definitions). Postgres-backed persistence for lakehouse_view_set_definitions.

[ViewDefinitionStore] is reduced to the single pool-backed [ViewDefinitionStore::list] method [super::view_registry::ViewRegistry::reload] needs – its only implementors are [PgViewDefinitionStore] and a test fake. The DDL executor (rust/public/src/servers/view_ddl.rs) instead calls the free functions below directly, against its own open sqlx::Transaction, so a CREATE/DROP’s existence check, upsert/delete and dependent-protection re-read all run inside one transaction, alongside retire_partitions on a DROP – with no trait indirection for methods a test fake could never implement.

Structs§

PgViewDefinitionStore
The production, pool-backed implementation.
ViewDefinitionRow
One row of lakehouse_view_set_definitions, exactly as read back. view_options is kept as its raw JSON text here (parsed into a ViewOptions only by ViewDefinitionRow::into_definition) so a row that fails to parse can still be reported by name rather than losing its identity.

Traits§

ViewDefinitionStore
The rows-in seam super::view_registry::ViewRegistry::reload needs: every definition currently in force, ordered by (update_group, view_set_name) – the order super::view_registry::build_factory relies on regardless of which caller fed it the rows.

Functions§

delete_tx
Deletes a row by name; true if a row was actually deleted.
list_tx
The transaction-scoped counterpart of ViewDefinitionStore::list, for a caller (the DDL executor) already holding an open sqlx::Transaction – so a pre-mutation read cannot miss a concurrent, uncommitted write from a sibling transaction, and a post-mutation read sees this transaction’s own write.
partition_insert_range
The exact insert-time range currently materialized for view_set_name’s 'global' instance – None when it has no partitions – for DROP’s call to retire_partitions. Deliberately exact rather than an unbounded range: retire_partitions is hash-agnostic but still needs an explicit range to key its deletion on.
upsert_tx
Inserts a new row, or – on a name collision – updates every column including updated_at/ updated_by explicitly: the column defaults only fire on INSERT, and reload()’s digest is over (view_set_name, updated_at), so a REPLACE that left it unset would go live only on the replacing node while every other replica kept serving/materializing the old definition.