You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: Hooks v1 should be scoped to web hooks only. Break out function hooks into another issue later. Including here for comms on the final end state.
Hooks
We want to let users run semi-arbitrary code when certain things happen in the system. Users may want to do things when pools are spawned or destroyed. When certain kinds of SQL statements are submitted or when certain records are updated in the database.
A Hook can be a function hook (Postgres function call) or a web hook (http request)
Hooks can by sync or async
Function hooks
When you create a function hook it creates a hook record in the metadata database with the code required to create a Postgres function using a Postgres TLE language.
When a connection pool starts up Supavisor will create or replace all registered function hooks in the tenant database ensuring they exist.
Web hooks
Supavisor will manage making the http requests for web hooks.
Async hooks
Async hooks can be implemented as Telemetry events
A Telemetry event handler for a tenant database can attached to telemetry events based on hooks for a tenant in the metadata database
Example: like Realtime's Telemetry.Logger but instead of logging it would dynamically do what was registered with the hook, and the Telemetry events could be registered dynamically
Sync hooks
Sync hooks should be ran in between hook events and block until the hook response
Note: Hooks v1 should be scoped to web hooks only. Break out function hooks into another issue later. Including here for comms on the final end state.
Hooks
We want to let users run semi-arbitrary code when certain things happen in the system. Users may want to do things when pools are spawned or destroyed. When certain kinds of SQL statements are submitted or when certain records are updated in the database.
Function hooks
Web hooks
Async hooks
Sync hooks
Hook events
Hook evens will be generated from:
Unknown:
Examples
As a db admin I want to turn my database to read-only mode when it's used a certain amount of storage
ALTER SYSTEM SET default_transaction_read_only TO on;
As a dev I want my Stripe data updated in Stripe when I update a customer record in my database:
insert
statements on acustomers
table for exampleinsert
will error to the SQL client if Stripe responds with an errorPrior Art
The text was updated successfully, but these errors were encountered: