Skip to main content

Module postgres

Module postgres 

Source
Expand description

PostgreSQL event notification target.

Persists S3 events into a user-provided PostgreSQL table using the Target trait. Two output formats are supported:

  • namespace (default): single row per object key, UPSERT on each event.
  • access: append-only audit log with one row per delivered event.

TLS is provided via tokio-postgres-rustls with rustls + aws-lc-rs. When tls_ca is empty the connector loads native OS trust roots. Connection pooling is delegated to deadpool-postgres; the pool itself is Clone, so no Mutex is required around it.

Structs§

PostgresArgs
PostgreSQL target configuration.
PostgresDsn
Parsed representation of a PostgreSQL DSN string.
PostgresTarget
PostgreSQL notification target.

Enums§

PostgresFormat
Output format selection for the PostgreSQL target.

Functions§

access_insert_sql
SQL for the access format. Append-only with event_id as PK so that store-replay scenarios silently skip duplicates while distinct events still land as separate rows.
build_pool
Builds the deadpool-postgres Pool used by the target.
build_tls_config
Builds a rustls ClientConfig for the PostgreSQL connection.
map_pg_error
Maps a tokio_postgres::Error to the proper TargetError variant.
map_pool_error
Maps a deadpool_postgres::PoolError to the proper TargetError variant.
namespace_delete_sql
SQL for the namespace format on object removal. Deletes the row keyed on the object key so the namespace table stays consistent with the object lifecycle instead of retaining stale state after a delete.
namespace_upsert_sql
SQL for the namespace format. Performs UPSERT keyed on the object key.
parse_postgres_format
Parses the format configuration value.
qualified_table
Returns the qualified "schema"."table" SQL identifier for args.
table_probe_sql
SQL used by both init() and the connectivity probe to verify the table exists and is readable without producing rows or triggering side effects.
validate_pg_identifier
Validates a PostgreSQL identifier (schema or table name).