Documentation
¶
Index ¶
- func LoadDataEncryptionSvc(cf *server.EncryptionConfigFile) (encryption.EncryptionService, error)
- func LoadDatabaseConfigFile(files ...[]byte) (*database.ConfigFile, error)
- func LoadEncryptionSvc(cf *server.ServerConfigFile) (encryption.EncryptionService, error)
- func LoadServerConfigFile(files ...[]byte) (*server.ServerConfigFile, error)
- func LoadServerlessOperatorConfigFile() (*serverlessoperatorconfig.ConfigFile, error)
- func LoadServerlessOperatorRepository(ctx context.Context, cf *serverlessoperatorconfig.ConfigFile, ...) (repository.ServerlessRepository, func() error, error)
- func LoadServerlessOperatorTokenExchange(cf *serverlessoperatorconfig.ConfigFile, l *zerolog.Logger) (hostgrpc.TokenSource, func(), error)
- func NewPgxPool(ctx context.Context, url string, opts PgxPoolOpts) (*pgxpool.Pool, error)
- func NewPgxPoolConfig(url string, opts PgxPoolOpts) (*pgxpool.Config, error)
- type ConfigLoader
- type ConfigLoaderOpt
- type PgxPoolOpts
- type ServerConfigFileOverride
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadDataEncryptionSvc ¶ added in v0.113.0
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 LoadEncryptionSvc ¶
func LoadEncryptionSvc(cf *server.ServerConfigFile) (encryption.EncryptionService, error)
func LoadServerConfigFile ¶
func LoadServerConfigFile(files ...[]byte) (*server.ServerConfigFile, error)
LoadServerConfigFile loads the server config file via viper
func LoadServerlessOperatorConfigFile ¶ added in v0.113.0
func LoadServerlessOperatorConfigFile() (*serverlessoperatorconfig.ConfigFile, error)
LoadServerlessOperatorConfigFile binds SERVERLESS_OPERATOR_* onto the binary's config and validates it; a value the binary cannot start with is refused here, before any connection is opened.
func LoadServerlessOperatorRepository ¶ added in v0.113.0
func LoadServerlessOperatorRepository(ctx context.Context, cf *serverlessoperatorconfig.ConfigFile, l *zerolog.Logger) (repository.ServerlessRepository, func() error, error)
LoadServerlessOperatorRepository opens the binary's pool on the configured database and builds the serverless repository on it. The returned cleanup releases the repository's resources and closes the pool.
func LoadServerlessOperatorTokenExchange ¶ added in v0.113.0
func LoadServerlessOperatorTokenExchange(cf *serverlessoperatorconfig.ConfigFile, l *zerolog.Logger) (hostgrpc.TokenSource, func(), error)
LoadServerlessOperatorTokenExchange builds the tenant token source the config selects (Validate has checked the mode and its variables). The returned close stops a local exchange's file watcher.
func NewPgxPool ¶ added in v0.113.0
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 ¶ added in v0.113.0
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, opts ...ConfigLoaderOpt) *ConfigLoader
NewConfigLoader creates a ConfigLoader that reads server and database configuration from the given directory, applying any options.
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 ConfigLoaderOpt ¶ added in v0.106.11
type ConfigLoaderOpt func(*ConfigLoader)
ConfigLoaderOpt configures a ConfigLoader created by NewConfigLoader.
func WithLogWriter ¶ added in v0.106.11
func WithLogWriter(w io.Writer) ConfigLoaderOpt
WithLogWriter routes the loggers this loader constructs (database, server and the additional per-service loggers) to w instead of os.Stderr. This is a runtime-only override intended for embedding callers; it cannot be expressed in a config file. Explicit writers set by a ServerConfigFileOverride take precedence over w.
The loader hands the same writer to several independent loggers that log concurrently, so w is wrapped in a mutex-guarded writer here; callers can pass writers that are not safe for concurrent use, such as a bytes.Buffer.
type PgxPoolOpts ¶ added in v0.113.0
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)