service

package
v0.0.0-...-b536b1f Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 21 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) 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) AutoMigrateLogStorageService

func (dm *DependencyManager) AutoMigrateLogStorageService()

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) 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) GetLogStorageService

func (dm *DependencyManager) GetLogStorageService() *request_log.StorageService

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

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) 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) RegisterLogStoragePing

func (dm *DependencyManager) RegisterLogStoragePing()

RegisterLogStoragePing registers a ping for the log storage service.

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) 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) 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) 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