pub enum CatalogCommand {
Show 38 variants
CreateTable {
name: String,
schema: Schema,
created_epoch: u64,
},
DropTable {
name: String,
at_epoch: u64,
},
RenameTable {
name: String,
new_name: String,
at_epoch: u64,
},
AlterColumn {
table: String,
column: ColumnDef,
},
AddColumn {
table: String,
column: ColumnDef,
},
DropColumn {
table: String,
column: String,
},
AddIndex {
table: String,
index: IndexDef,
},
RemoveIndex {
table: String,
name: String,
},
CreateUser {
username: String,
password_hash: String,
is_admin: bool,
created_epoch: u64,
},
DropUser {
username: String,
},
AlterUserPassword {
username: String,
password_hash: String,
},
SetUserAdmin {
username: String,
is_admin: bool,
},
CreateRole {
name: String,
created_epoch: u64,
},
DropRole {
name: String,
},
GrantRole {
username: String,
role: String,
},
RevokeRole {
username: String,
role: String,
},
GrantPermission {
role: String,
permission: Permission,
},
RevokePermission {
role: String,
permission: Permission,
},
EnableRls {
table: String,
},
DisableRls {
table: String,
},
SetRowPolicy {
policy: RowPolicy,
},
DropRowPolicy {
table: String,
name: String,
},
SetColumnMask {
mask: ColumnMask,
},
DropColumnMask {
table: String,
name: String,
},
SetSecurityCatalog {
security: SecurityCatalog,
},
CreateTrigger {
trigger: StoredTrigger,
},
DropTrigger {
name: String,
},
CreateProcedure {
procedure: StoredProcedure,
},
DropProcedure {
name: String,
},
CreateMaterializedView {
definition: MaterializedViewEntry,
},
DropMaterializedView {
name: String,
},
RefreshMaterializedView {
name: String,
at_epoch: u64,
checkpoint_event_id: Option<String>,
},
SetResourceGroup {
group: ResourceGroupDef,
},
RemoveResourceGroup {
name: String,
},
SubmitJob {
job: JobDefinition,
},
SetJobState {
job_id: u64,
state: JobState,
at_epoch: u64,
},
ReplaceTrigger {
trigger: StoredTrigger,
},
ReplaceProcedure {
procedure: StoredProcedure,
},
}Expand description
One logical catalog mutation (spec §10.6, S1F-001).
Variants carry already-validated payloads (mirroring how DdlOp records
carry resolved ColumnDef/schema JSON): deep semantic validation
(expression trees, SQL typing) happens at the emitting layer, while
apply enforces the catalog-level structural invariants fail-closed
(existence, uniqueness, id allocation, reference integrity).
Variants§
CreateTable
Create a live table. table_id is allocated deterministically from
next_table_id at apply time and stamped as schema.schema_id.
DropTable
Logically drop a live table. Cascades to triggers targeting the
table, the same-named materialized-view definition, RLS state,
policies, masks, and table-scoped role permissions (mirrors
Database::drop_table).
RenameTable
Rename a live table. Retargets triggers and renames the same-named
materialized-view definition. name == new_name is a recorded no-op
(mirrors Database::rename_table).
AlterColumn
Replace one existing column definition (same id) with an
already-validated one. Mirrors DdlOp::AlterTable.
AddColumn
Add a column with a caller-allocated, unused id.
DropColumn
Drop a column by name; indexes referencing it are dropped too
(mirrors the SQL ALTER TABLE ... DROP COLUMN rebuild path).
AddIndex
Add a secondary index definition to a live table.
RemoveIndex
Remove one index by exact name. Compound SQL index names expand to
one command per IndexDef at the emitting layer.
CreateUser
Create a user. id is allocated deterministically from
next_user_id (minimum 1) at apply time.
DropUser
AlterUserPassword
SetUserAdmin
CreateRole
DropRole
Drop a role and strip it from every user (mirrors
Database::drop_role).
GrantRole
Grant a role to a user. Idempotent: granting an already-held role is
a recorded no-op (mirrors Database::grant_role).
RevokeRole
Revoke a role from a user. Idempotent no-op when not held.
GrantPermission
Grant a permission to a role, merging column lists for column-scoped grants. Idempotent no-op when the merged set is unchanged.
RevokePermission
Revoke a permission from a role. Idempotent no-op when unchanged.
EnableRls
DisableRls
SetRowPolicy
Create or replace a row policy keyed by (table, name).
DropRowPolicy
SetColumnMask
Create or replace a column mask keyed by (table, name).
Fields
mask: ColumnMaskDropColumnMask
SetSecurityCatalog
Wholesale security-catalog replacement (RLS tables, policies, masks),
mirroring Database::set_security_catalog. Validated against the
candidate catalog exactly like the legacy path.
Fields
security: SecurityCatalogCreateTrigger
Fields
trigger: StoredTriggerDropTrigger
CreateProcedure
Fields
procedure: StoredProcedureDropProcedure
CreateMaterializedView
Create or replace a materialized-view definition. The backing live
table must already exist (mirrors Database::set_materialized_view).
Fields
definition: MaterializedViewEntryDropMaterializedView
Drop only the definition; the physical table is dropped separately
via CatalogCommand::DropTable (which also cascades definitions).
RefreshMaterializedView
Record refresh bookkeeping: bump last_refresh_epoch and, for
incremental views, advance the CDC checkpoint when provided.
SetResourceGroup
Create or replace a resource group.
Fields
group: ResourceGroupDefRemoveResourceGroup
SubmitJob
Submit a new persistent job. job_id must be unused.
Fields
job: JobDefinitionSetJobState
Record a job state change. Transitions out of terminal states
(Succeeded/Failed) fail closed; S1F-002 owns the full machine.
ReplaceTrigger
Create or replace a trigger, keyed by name. trigger is the resolved
image: the emitter stamps created_epoch/updated_epoch/version
from the commit epoch (and bumps version on replacement) before
proposing, so replay is verbatim (mirrors
Database::create_or_replace_trigger).
Fields
trigger: StoredTriggerReplaceProcedure
Create or replace a stored procedure, keyed by name; the payload is
the epoch-resolved image (mirrors
Database::create_or_replace_procedure).
Fields
procedure: StoredProcedureTrait Implementations§
Source§impl Clone for CatalogCommand
impl Clone for CatalogCommand
Source§fn clone(&self) -> CatalogCommand
fn clone(&self) -> CatalogCommand
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CatalogCommand
impl Debug for CatalogCommand
Source§impl<'de> Deserialize<'de> for CatalogCommand
impl<'de> Deserialize<'de> for CatalogCommand
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for CatalogCommand
impl RefUnwindSafe for CatalogCommand
impl Send for CatalogCommand
impl Sync for CatalogCommand
impl Unpin for CatalogCommand
impl UnsafeUnpin for CatalogCommand
impl UnwindSafe for CatalogCommand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more