Skip to main content

Setup

Registers the CacheService handler on the SetupContext mux. This function requires sc.DB and sc.DataStore to be set by the standalone binary, runs database migrations, sets up OpenTelemetry providers and interceptors, and adds a ready check for the database and data store.

def Setup(
ctx: context.Context,
sc: *app.SetupContext
) - > error

Registers the CacheService handler on the SetupContext mux. This function initializes the CacheService, runs necessary database migrations, sets up OpenTelemetry for tracing and metrics, and adds a readiness check to ensure database and data store connectivity. Callers use this to integrate the CacheService into their application's setup process.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for controlling cancellation and timeouts during the setup process.
sc*app.SetupContextThe application setup context, which must have sc.DB (database connection) and sc.DataStore (data storage client) initialized. It is used to register the CacheService handler and add readiness checks.

Returns

TypeDescription
errorAn error if any setup step fails, such as migration failures, OpenTelemetry registration issues, or interceptor creation errors.