| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Runtime.Env
Description
The composition root: the single record every effectful component is reached through, and
the one place backend choice is resolved. Each handle it holds is an opaque record of functions
whose closures already capture their backend's private state, so no cloud SDK appears here and
nothing downstream inspects which backend it got. That is what keeps an adapter from importing
back into this module. It also carries the http-client Manager the data plane shares. The
single-process proxy and the split deployment both wire up here and nowhere else. Consumers
read it through a projection: serveRuntimeOf per request, workerRuntimeOf for the worker.
Synopsis
- data Env = Env {
- envServeAdmission :: ServeAdmission
- envMemoryMeter :: MemoryMeter
- envQueue :: MirrorQueue
- envManager :: Manager
- envPrivateManager :: Manager
- envMetadataCache :: MetadataCache
- envLogEnv :: LogEnv
- envTelemetry :: Telemetry
- envMetrics :: Metrics
- envDdContext :: DdContext
- envWorkerHeartbeat :: WorkerHeartbeat
- newEnvWithAdmission :: ServeAdmission -> MemoryMeter -> MirrorQueue -> Manager -> Manager -> MetadataCache -> LogEnv -> Telemetry -> WorkerHeartbeat -> IO Env
- withEnvWithAdmission :: MonadIO m => ServeAdmission -> MemoryMeter -> MirrorQueue -> Manager -> Manager -> MetadataCache -> LogEnv -> Telemetry -> WorkerHeartbeat -> (Env -> m a) -> m a
- serveRuntimeOf :: Env -> ServeRuntime
- workerRuntimeOf :: WorkerPolicies -> Env -> WorkerRuntime
- data WorkerHeartbeat
- newWorkerHeartbeat :: IO WorkerHeartbeat
- recordPoll :: WorkerHeartbeat -> UTCTime -> IO ()
- lastPoll :: WorkerHeartbeat -> IO (Maybe UTCTime)
Composition root
The composition-root record from which the whole effectful shell is reached.
Constructors
| Env | |
Fields
| |
newEnvWithAdmission :: ServeAdmission -> MemoryMeter -> MirrorQueue -> Manager -> Manager -> MetadataCache -> LogEnv -> Telemetry -> WorkerHeartbeat -> IO Env Source #
withEnvWithAdmission :: MonadIO m => ServeAdmission -> MemoryMeter -> MirrorQueue -> Manager -> Manager -> MetadataCache -> LogEnv -> Telemetry -> WorkerHeartbeat -> (Env -> m a) -> m a Source #
Assemble an Env and run an action in its scope, the scope the server and worker run in.
The root borrows every resource it holds, so it has nothing to release and needs no bracket.
Runtime projections
serveRuntimeOf :: Env -> ServeRuntime Source #
Project the ServeRuntime the serve path closes over, built per request at dispatch.
The core pipeline reads its backends through it without depending on this application Env.
workerRuntimeOf :: WorkerPolicies -> Env -> WorkerRuntime Source #
Project the WorkerRuntime the mirror worker closes over. WorkerPolicies is an argument
because it derives from the served mounts, and the worker re-runs it through the serve gate.
Worker heartbeat (re-exported from Ecluse.Core.Worker)
data WorkerHeartbeat #
recordPoll :: WorkerHeartbeat -> UTCTime -> IO () #