Documentation
¶
Overview ¶
Package connect resolves the source's connection settings, from a URI or from the nested spec, into one pgx config that the query pool and the replication connection share, including TLS and the SSH tunnel.
Index ¶
Constants ¶
const ( // DefaultInitialWait and minInitialWait bound the CDC initial WAL wait. DefaultInitialWait = 300 * time.Second )
Defaults applied when the operator leaves a tuning field unset on the nested postgres block. Both mirror the OLake reference behavior.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// QueryURI is the libpq DSN rendered from the config. It is what travels
// to a distributed worker (the worker only receives kind + dsn).
QueryURI string
// ConnConfig is the native pgx config for replication and query
// connections. It carries TLSConfig (built by pgx from the DSN) and
// DialFunc (SSH) so both connection paths share one transport.
ConnConfig *pgx.ConnConfig
// MaxOpenConns is the resolved maxThreads value.
MaxOpenConns int
// RetryCount is the resolved number of transient-connection retries.
RetryCount int
// InitialWaitTime is the resolved CDC initial-WAL-message wait.
InitialWaitTime time.Duration
// Plugin is the resolved logical decoding plugin ("pgoutput"|"wal2json").
Plugin string
// contains filtered or unexported fields
}
Config holds the resolved connection parameters, built from either a URI or the nested PostgresSource config.
func BuildFromPostgres ¶
func BuildFromPostgres(pg *spec.PostgresSource) (*Config, error)
BuildFromPostgres constructs a Config from the nested PostgresSource config. When present, source.uri is ignored for connection building.
The config is created by pgx.ParseConfig on the rendered DSN — never by hand. pgx's ConnectConfig panics on a config it did not create, and it also needs RuntimeParams initialized (Reader.New writes "replication" into it). Parsing the DSN also gets pgx's native TLS handling for free (require, verify-ca and verify-full all follow libpq semantics, including loading the CA and client cert/key). Only the SSH DialFunc is layered on afterwards.