Expand description
PostgreSQL executor for Fireweed’s data-plane DSL (API-008).
apply_schema creates a space’s tables and indexes from its schema.
execute runs a program as one transaction of plain SQL statements
over those tables. sweep writes back time-driven state and deletes
what retention has expired.
These are functions over a connection. They keep nothing in the process
between calls: each call reads the space’s schema from the database,
checks the program against it, and runs it. Queries are sent unprepared
with text parameters (query_typed), so each costs one round trip.
PgExecutor wraps these functions in fireweed_dsl::Executor over a
pool of connections, so a consumer can hold it as a dyn Executor.
Structs§
- PgExecutor
- The PostgreSQL executor as a
fireweed_dsl::Executor. Each call takes an idle connection, or opens one, and gives it back when the call finishes. A call that is dropped part way drops its connection instead, so no connection with an open transaction is reused. Connections are opened on demand; at mostmax_idleare kept between calls. - Swept
- What one sweep pass changed (the shared type). What one sweep pass changed.
Constants§
- CATALOG
- Objects shared by every space. Idempotent; run under the catalog lock.
Functions§
- apply_
schema - Creates a space, or changes its schema (API-008 §Changing a schema).
expectedis the version the caller expects to replace:Nonefor a new space. - execute
- Runs a program as one transaction (API-008 §Transactions).
- execute_
batch - Runs independent programs in one space as one transaction with one commit (API-008 §Batches). Each program runs under its own savepoint, so one that fails or rejects leaves the others alone; each gets its own result, in order. A program that hits a deadlock is run again.
- get_
schema - The stored schema of a space, if it exists.
- sweep
- Writes back time-driven state and deletes what retention has expired,
at most
batchrows per object (API-008 §Time). Rows other transactions hold are skipped.