loader

package
v0.106.8-alpha.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 51 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadDataEncryptionSvc

func LoadDataEncryptionSvc(cf *server.EncryptionConfigFile) (encryption.EncryptionService, error)

LoadDataEncryptionSvc builds an encryption service for data at rest only, from the master keyset or the CloudKMS settings, without the JWT keysets LoadEncryptionSvc also requires. It is for processes that encrypt and decrypt database columns but never mint or verify tokens, such as the out-of-process serverless operator; the service's JWT handles are nil.

func LoadDatabaseConfigFile

func LoadDatabaseConfigFile(files ...[]byte) (*database.ConfigFile, error)

LoadDatabaseConfigFile loads the database config file via viper

func LoadServerConfigFile

func LoadServerConfigFile(files ...[]byte) (*server.ServerConfigFile, error)

LoadServerConfigFile loads the server config file via viper

func NewPgxPool

func NewPgxPool(ctx context.Context, url string, opts PgxPoolOpts) (*pgxpool.Pool, error)

NewPgxPool opens a pool on url with the shared connection setup of NewPgxPoolConfig. It is the constructor for processes that talk to the engine database without the full config loader, such as the out-of-process serverless operator.

func NewPgxPoolConfig

func NewPgxPoolConfig(url string, opts PgxPoolOpts) (*pgxpool.Config, error)

NewPgxPoolConfig parses url and applies the connection setup every Hatchet pool shares: the application name, UTC session time zone, the enum and range types pgx cannot encode without registration, and the statement timeouts. Callers that need further hooks (the engine's query debugger) adjust the returned config before opening the pool.

Types

type ConfigLoader

type ConfigLoader struct {
	// contains filtered or unexported fields
}

func NewConfigLoader

func NewConfigLoader(directory string) *ConfigLoader

func (*ConfigLoader) CreateServerFromConfig

func (c *ConfigLoader) CreateServerFromConfig(version string, overrides ...ServerConfigFileOverride) (cleanup func() error, res *server.ServerConfig, err error)

CreateServerFromConfig loads the server configuration and returns a server

func (*ConfigLoader) InitDataLayer

func (c *ConfigLoader) InitDataLayer() (res *database.Layer, err error)

InitDataLayer initializes the database layer from the configuration

type PgxPoolOpts

type PgxPoolOpts struct {
	// ApplicationName shows up in pg_stat_activity so connections can be attributed to a
	// service on shared postgres instances. Not applied when the URL already carries one.
	ApplicationName string

	MaxConns        int32
	MinConns        int32
	MaxConnLifetime time.Duration
	MaxConnIdleTime time.Duration

	// StatementTimeout is set as both statement_timeout and
	// idle_in_transaction_session_timeout on every connection.
	StatementTimeout time.Duration

	// Tracer replaces the default OpenTelemetry query tracer.
	Tracer pgx.QueryTracer
}

PgxPoolOpts configures a pool built with NewPgxPool or NewPgxPoolConfig. Zero values leave the pgxpool defaults in place, except StatementTimeout, which defaults to defaultPgxStatementTimeout.

type ServerConfigFileOverride

type ServerConfigFileOverride func(*server.ServerConfigFile)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL