ecluse:ecluse-runtime
Safe HaskellNone
LanguageGHC2021

Ecluse.Runtime.Env

Description

Process resources shared by serving and worker runtimes. The application owns their lifetime.

Synopsis

Composition root

data Env Source #

The composition-root record from which the whole effectful shell is reached.

Constructors

Env 

Fields

  • envServeAdmission :: ServeAdmission

    Share the metadata admission limit and waiting room across all mounts.

  • envMemoryMeter :: MemoryMeter

    The process-wide memory budget every serving mount pays into.

  • envQueue :: MirrorQueue

    Queue mirror work from serving requests.

  • envPublicClient :: ExchangeClient

    Validate public TLS peers for metadata and artifact requests.

  • envPublicControl :: PublicControl

    Shared cooldown and request observation for every public serve and worker read.

  • envPrivateClient :: ExchangeClient

    Validate private TLS peers while retaining their credential handling.

  • envDeadlines :: Deadlines

    The process's one sweeper, which both clients carry and every request's timeout runs on.

  • envMetadataCache :: MetadataCache

    Selected-version and assembled retention with transient full-read coalescing.

  • envLogEnv :: LogEnv

    Use the configured output format and minimum severity for structured logs.

  • envTelemetry :: Telemetry

    Emit spans and metrics when telemetry is enabled, otherwise do nothing.

  • envMetrics :: Metrics

    Process-wide metric instruments are inert when telemetry is disabled.

  • envDdContext :: DdContext

    Retain the resolved Datadog identity for per-line trace correlation.

  • envWorkerHeartbeat :: WorkerHeartbeat

    Track completed worker progress for liveness, separately from HTTP readiness.

newEnvWithAdmission :: ServeAdmission -> MemoryMeter -> MirrorQueue -> Manager -> Manager -> Deadlines -> MetadataCache -> LogEnv -> Telemetry -> WorkerHeartbeat -> IO Env Source #

Assemble process handles without opening a socket. Both clients carry the one sweeper and the one client-span tracing. Callers own the supplied resources.

withEnvWithAdmission :: MonadIO m => ServeAdmission -> MemoryMeter -> MirrorQueue -> Manager -> Manager -> Deadlines -> MetadataCache -> LogEnv -> Telemetry -> WorkerHeartbeat -> (Env -> m a) -> m a Source #

Run an action with borrowed process resources that require no additional release.

Runtime projections

serveRuntimeOf :: Env -> ServeRuntime Source #

Project serving capabilities without exposing the application environment to the core.

workerRuntimeOf :: WorkerPolicies -> Env -> WorkerRuntime Source #

Project worker capabilities with policies derived from the served mounts.

Worker heartbeat (re-exported from Ecluse.Core.Worker)