service

package
v0.0.0-...-1232c89 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DependencyManager

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

func NewDependencyManager

func NewDependencyManager(serviceId string, cfg config.C) *DependencyManager

func (*DependencyManager) AutoMigrateAll

func (dm *DependencyManager) AutoMigrateAll()

func (*DependencyManager) AutoMigrateAppMetricsService

func (dm *DependencyManager) AutoMigrateAppMetricsService()

func (*DependencyManager) AutoMigrateCore

func (dm *DependencyManager) AutoMigrateCore()

TODO: this automigrate should not be specific to the connectors config

func (*DependencyManager) AutoMigrateDatabase

func (dm *DependencyManager) AutoMigrateDatabase()

AutoMigrateDatabase will attempt to migrate the database if the root config has auto migrate enabled.

func (*DependencyManager) AutoMigratePredefinedActors

func (dm *DependencyManager) AutoMigratePredefinedActors()

AutoMigratePredefinedActors synchronizes actors from ConfiguredActorsList configuration to the database. This only runs for ConfiguredActorsList configuration (not ConfiguredActorsExternalSource which uses cron). Uses a distributed Redis lock to ensure only one instance performs the migration.

func (*DependencyManager) AutoMigrateSyncKeysToDatabase

func (dm *DependencyManager) AutoMigrateSyncKeysToDatabase()

AutoMigrateSyncKeysToDatabase syncs encryption key versions from config into the database. Uses a Redis sentinel to avoid redundant runs across processes.

func (*DependencyManager) GetAppMetricsService

func (dm *DependencyManager) GetAppMetricsService() *app_metrics.StorageService

func (*DependencyManager) GetAsyncClient

func (dm *DependencyManager) GetAsyncClient() apasynq.Client

func (*DependencyManager) GetAsyncDefaultOptions

func (dm *DependencyManager) GetAsyncDefaultOptions() []asynq.Option

func (*DependencyManager) GetAsyncInspector

func (dm *DependencyManager) GetAsyncInspector() *asynq.Inspector

func (*DependencyManager) GetConfig

func (dm *DependencyManager) GetConfig() config.C

func (*DependencyManager) GetConfigRoot

func (dm *DependencyManager) GetConfigRoot() *sconfig.Root

func (*DependencyManager) GetCoreService

func (dm *DependencyManager) GetCoreService() coreIface.C

func (*DependencyManager) GetDatabase

func (dm *DependencyManager) GetDatabase() database.DB

func (*DependencyManager) GetEncryptService

func (dm *DependencyManager) GetEncryptService() encrypt.E

func (*DependencyManager) GetHttpf

func (dm *DependencyManager) GetHttpf() httpf.F

func (*DependencyManager) GetLogBuilder

func (dm *DependencyManager) GetLogBuilder() aplog.Builder

func (*DependencyManager) GetLogger

func (dm *DependencyManager) GetLogger() *slog.Logger

func (*DependencyManager) GetRateLimitCache

func (dm *DependencyManager) GetRateLimitCache() ratelimit.Cache

GetRateLimitCache returns the lazily-initialised in-memory rate-limit cache for this process. The cache starts empty; call StartRateLimitRefresher() to populate and keep it fresh from the database.

func (*DependencyManager) GetRateLimitEnforcerFactory

func (dm *DependencyManager) GetRateLimitEnforcerFactory() *ratelimit.EnforcerFactory

GetRateLimitEnforcerFactory returns the middleware factory that evaluates proxy-side RateLimit resources against in-flight requests (#223). Reads from the same in-memory cache that the Refresher (#219) populates. Construction is cheap; the heavy lifting happens per-request inside the round-tripper.

func (*DependencyManager) GetRateLimitFactory

func (dm *DependencyManager) GetRateLimitFactory() *ratelimit.Factory

func (*DependencyManager) GetRedisClient

func (dm *DependencyManager) GetRedisClient() apredis.Client

func (*DependencyManager) GetRootLogger

func (dm *DependencyManager) GetRootLogger() *slog.Logger

GetRootLogger returns the application-wide root slog.Logger, wrapped with the telemetry-aware handler from internal/aplog so every emitted record gains trace_id / span_id when in a traced context (and is fanned to the OTel logs pipeline when telemetry.signals.logs is on). Cached on first call — every other DM lookup that needs a logger derives from this one, so the wrap happens exactly once per process.

Force-initialises telemetry providers before wrapping so the OTel logs bridge picks up the live LoggerProvider regardless of call order in the service's Serve func.

func (*DependencyManager) GetSQLDB

func (dm *DependencyManager) GetSQLDB() *sql.DB

func (*DependencyManager) GetServiceId

func (dm *DependencyManager) GetServiceId() string

func (*DependencyManager) GetTelemetry

func (dm *DependencyManager) GetTelemetry() *aptelemetry.Providers

GetTelemetry returns the OTel providers for this service. When telemetry is disabled or unconfigured, the returned Providers are no-op implementations.

The first call lazily initialises the SDK; subsequent calls return the same Providers. Initialisation failure is panicked, matching the pattern used by other dependencies on this manager. Use ShutdownTelemetry to flush and tear down before exit.

func (*DependencyManager) GetWorkflowRuntime

func (dm *DependencyManager) GetWorkflowRuntime() *workflows.Runtime

func (*DependencyManager) RegisterAppMetricsPing

func (dm *DependencyManager) RegisterAppMetricsPing()

RegisterAppMetricsPing registers a ping for the app metrics service.

func (*DependencyManager) RegisterAsynqClientPing

func (dm *DependencyManager) RegisterAsynqClientPing()

RegisterAsynqClientPing registers a ping for the Asynq client.

func (*DependencyManager) RegisterDatabasePing

func (dm *DependencyManager) RegisterDatabasePing()

RegisterDatabasePing registers a ping for the database.

func (*DependencyManager) RegisterPing

func (dm *DependencyManager) RegisterPing(name string, fn PingFunc)

RegisterPing registers a named ping function for health checking.

func (*DependencyManager) RegisterRedisPing

func (dm *DependencyManager) RegisterRedisPing()

RegisterRedisPing registers a ping for Redis.

func (*DependencyManager) RegisterWorkflowRuntimePing

func (dm *DependencyManager) RegisterWorkflowRuntimePing()

func (*DependencyManager) RunPings

func (dm *DependencyManager) RunPings(ctx context.Context) (map[string]bool, bool)

RunPings runs all registered ping functions concurrently and returns a map of results and whether all pings succeeded.

func (*DependencyManager) ShutdownDatabase

func (dm *DependencyManager) ShutdownDatabase()

func (*DependencyManager) ShutdownTelemetry

func (dm *DependencyManager) ShutdownTelemetry()

ShutdownTelemetry flushes and tears down OTel providers if they were initialised. Safe to call multiple times. Bounded by aptelemetry.ShutdownTimeout.

func (*DependencyManager) ShutdownWorkflowRuntime

func (dm *DependencyManager) ShutdownWorkflowRuntime()

func (*DependencyManager) StartRateLimitRefresher

func (dm *DependencyManager) StartRateLimitRefresher(ctx context.Context) (stop func())

StartRateLimitRefresher boots the background goroutine that keeps the in-memory rate-limit cache fresh from the database. The returned stop function cancels the goroutine and waits for it to exit; api/admin-api callers should defer it.

Multiple calls within the same process are safe but only the first actually starts a goroutine — subsequent calls return a no-op stop.

type PingFunc

type PingFunc func(ctx context.Context) bool

PingFunc is a function that checks the health of a dependency. It returns true if the dependency is healthy.

Directories

Path Synopsis
swagger
Package swagger contains the Swagger documentation configuration
Package swagger contains the Swagger documentation configuration
api
swagger
Package swagger contains the Swagger documentation configuration
Package swagger contains the Swagger documentation configuration

Jump to

Keyboard shortcuts

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