Documentation ¶
Overview ¶
Package sinkprod contains configuration and providers for connecting to production database(s).
Index ¶
- Variables
- func ProvideStagingDB(ctx context.Context, config *StagingConfig, pool *types.StagingPool) (ident.StagingSchema, error)
- func ProvideStagingPool(ctx *stopper.Context, config *StagingConfig, diags *diag.Diagnostics, ...) (*types.StagingPool, error)
- func ProvideStatementCache(ctx *stopper.Context, config *TargetConfig, pool *types.TargetPool, ...) (*types.TargetStatements, error)
- func ProvideTargetPool(ctx *stopper.Context, config *TargetConfig, diags *diag.Diagnostics) (*types.TargetPool, error)
- type CommonConfig
- type StagingConfig
- type TargetConfig
Constants ¶
This section is empty.
Variables ¶
var ( StagingSchemaDefault = ident.MustSchema(ident.New("_replicator"), ident.Public) StagingSchemaLegacy = ident.MustSchema(ident.New("_cdc_sink"), ident.Public) )
These are default names for the staging database schema.
var Set = wire.NewSet( ProvideStagingDB, ProvideStagingPool, ProvideTargetPool, ProvideStatementCache, )
Set is used by Wire.
Functions ¶
func ProvideStagingDB ¶
func ProvideStagingDB( ctx context.Context, config *StagingConfig, pool *types.StagingPool, ) (ident.StagingSchema, error)
ProvideStagingDB is called by Wire to retrieve the name of the staging SQL DATABASE. If StagingSchemaDefault does not exist, but StagingSchemaLegacy does, then the latter will be returned.
func ProvideStagingPool ¶
func ProvideStagingPool( ctx *stopper.Context, config *StagingConfig, diags *diag.Diagnostics, tgtConfig *TargetConfig, ) (*types.StagingPool, error)
ProvideStagingPool is called by Wire to create a connection pool that accesses the staging cluster. The pool will be closed when the context is stopped.
func ProvideStatementCache ¶
func ProvideStatementCache( ctx *stopper.Context, config *TargetConfig, pool *types.TargetPool, diags *diag.Diagnostics, ) (*types.TargetStatements, error)
ProvideStatementCache is called by Wire to construct a prepared-statement cache. Anywhere the associated TargetPool is reused should also reuse the cache.
func ProvideTargetPool ¶
func ProvideTargetPool( ctx *stopper.Context, config *TargetConfig, diags *diag.Diagnostics, ) (*types.TargetPool, error)
ProvideTargetPool is called by Wire to create a connection pool that accesses the target cluster. The pool will be closed when the context is stopped.
Types ¶
type CommonConfig ¶
type CommonConfig struct { // Connection string for the database. Conn string // The maximum lifetime of an idle connection. IdleTime time.Duration // The length of time to jitter disconnections over. JitterTime time.Duration // The maximum lifetime for a database connection; improves // loadbalancer compatibility. MaxLifetime time.Duration // The number of connections to the target database. If zero, a // default value will be used. MaxPoolSize int }
CommonConfig defines settings that are shared by StagingConfig and TargetConfig.
type StagingConfig ¶
type StagingConfig struct { CommonConfig // Create the destination schema. CreateSchema bool // The name of a SQL schema in the staging cluster to store // metadata in. Schema ident.Schema }
StagingConfig defines staging-database connection behaviors.
func (*StagingConfig) Bind ¶
func (c *StagingConfig) Bind(f *pflag.FlagSet)
Bind adds flags to the set.
func (*StagingConfig) Preflight ¶
func (c *StagingConfig) Preflight() error
Preflight ensures that unset configuration options have sane defaults and returns an error if the StagingConfig is missing any fields for which a default cannot be provided.
type TargetConfig ¶
type TargetConfig struct { CommonConfig // The maximum length of time to wait for an incoming transaction // to settle (i.e. to detect stalls in the target database). ApplyTimeout time.Duration // The number of prepared statements to retain in the target // database connection pool. Depending on the database in question, // there may be more or fewer available resources to retain // statements. StatementCacheSize int }
TargetConfig defines target-database connection behaviors.
func (*TargetConfig) Bind ¶
func (c *TargetConfig) Bind(f *pflag.FlagSet)
Bind adds flags to the set.
func (*TargetConfig) Preflight ¶
func (c *TargetConfig) Preflight() error
Preflight ensures that unset configuration options have sane defaults and returns an error if the TargetConfig is missing any fields for which a default cannot be provided.