Configuration & Runtime Engine
The Motion Engine (console: Cores; tree: core/) is the runtime engine identity for the data plane: a single process that owns runtime state, execution scheduling, and persistence projection for streams, tasks, and connectors. It is not “just an API server”—the embedded control plane (padas-api on Axum + Rustls, /api/v1/*) orchestrates the same runtime topology the hot path executes. StreamRouter moves events through buffers; an optional WAL subscriber provides runtime durability; tasks are execution units on that graph; connectors are ingress/egress boundaries. Operators reason in API-driven orchestration terms (streams.json, tasks.json, connectors.json under [api.persistence].config_dir) while the engine reconciles registry persistence with live runtime reconciliation after restarts.
Related: REST API Reference · Motion Engine TOML · Monitoring · Streams · Security — runtime operational security reference · Troubleshooting & Logs · Glossary · Cores
Overview
The Motion Engine is the long-running runtime engine that materializes an execution graph from registry objects:
| Subsystem | Implementation-aware role |
|---|---|
| StreamRouter | Per-stream routing fabric: buffer transitions, backpressure modes, and fan-out to subscribers—including the optional WAL subscriber path. |
| Runtime scheduling | Workers, virtual shards, and task/connector lifecycle map to OS-level execution; there is no out-of-process “pipeline scheduler” for product pipelines. |
| WAL subscriber behavior | WAL is a router subscriber writing segmented data under [core.wal].path; lagging consumers can hybrid-read from WAL per [core.subscriber.lag] (see Glossary → Consumer lag). |
| Runtime execution graph | Sources → stream buffers → (optional WAL) → task PDL → sink streams / connector sinks; one single-process runtime graph. |
| Task orchestration | Tasks subscribe to source streams, run PDL in processing or detection mode, manage aggregation state, and route outputs—execution unit semantics. |
| Connector lifecycle | Start/stop/restart via /api/v1/connectors maps to connector runtime threads/async work—runtime lifecycle tied to the same process. |
| Embedded API orchestration | Axum router under [api].prefix (default /api/v1) mutates runtime state and persists registry JSON without a sidecar control plane. |
| Runtime persistence projection | streams.json, tasks.json, connectors.json are the on-disk persistence projection of API-managed objects; startup registry reconciliation reloads them into the runtime engine. |
Why the engine is not just an API server: the REST surface is the embedded control plane for runtime coordination; disabling or mis-sizing the engine does not leave a “headless API”—it leaves a broken streaming runtime.
Why pipelines are runtime compositions: a pipeline in product language is not a standalone service—it is realized as runtime objects (streams, tasks, connectors) under one scheduler inside this single-process runtime graph.
Runtime state synchronization: UI and automation drive desired state through /api/v1/*; the process applies changes, persists registry files, and reflects status on …/status routes—runtime state and config state (see Runtime persistence model) must stay aligned across rolling restarts and reload semantics.
Runtime role
In runtime topology terms, the engine is the single-process runtime that executes workloads described by:
- Streams — stream transport: named channels with buffers, retention, optional WAL, and HTTP produce/consume surfaces. Stream topology realization is “which routers exist and how they connect.”
- Tasks — execution units: subscriptions to source streams, PDL queries, concurrency limits, aggregation windows, and sinks (processing vs detection modes).
- Connectors — ingress/egress boundaries: sources pump events into streams; sinks drain tasks or streams per connector class semantics (class-specific backpressure / drop policies—Glossary → Connector class).
Runtime graph realization: there is no separate “pipeline microservice”—the pipeline is not a standalone service; it is pipeline realized as runtime objects sharing runtime coordination, IO, and persistence ownership in one address space.
Runtime object ownership: the process owns buffers, WAL segments under [core.wal], task internal state, and connector handles—execution isolation is cooperative (caps, modes), not separate JVMs per pipeline.
Persistence recovery: on start, registry JSON plus padas.toml / padas.default.toml drive startup orchestration: restore routers, replay or resume consumers per offset and WAL policy, then serve /api/v1/*.
Shutdown guarantees: bounded by [core].shutdown_timeout_secs; for clean runtime lifecycle, drain or pause ingest before SIGTERM in production so sink delivery and WAL flush windows can complete.
Motion Engine responsibilities
| Responsibility | Where it lives | Operational notes |
|---|---|---|
| Runtime coordination | Engine + [core] | Workers, shards, startup/shutdown timeouts; virtual shard count affects hashing and parallelism—profile before raising. |
| Stream lifecycle | Engine + streams.json | Create/update/delete, pause/resume/restart; per-stream WAL and buffer overlays via API or persisted registry. |
| Stream durability behavior | [core.stream.wal], [core.wal], WAL subscriber | WAL segments + retention; sync_writes trades latency for durability; high-throughput profiles sometimes disable per-stream WAL—explicit runtime durability trade-off (Glossary → WAL). |
| Consumer recovery | StreamRouter + offsets + [core.subscriber.lag] | Execution scheduling resumes from persisted offsets; hybrid WAL reads when lag exceeds threshold / timeout_ms. |
| Task execution | [core.task], tasks.json | Execution state management for PDL, aggregation cleanup/watermarks ([core.task.aggregation.*]); overlays in task JSON vs padas.toml must be reconciled before change windows (Glossary → Watermark, Tasks). |
| Connector execution | connectors.json + connector runtime | Start/stop/restart mirrors tasks; runtime lifecycle and backpressure are class-specific. |
| Execution state management | In-process task/agg state + registry | Restart clears hot state; recovery depends on replay behavior and window definitions. |
| Persistence ownership | [api.persistence].config_dir, core.data_dir, WAL path | Registry vs WAL vs instance UUID paths—stateful paths must stay stable across VM migration. |
| Embedded control plane | [api], Axum, /api/v1/* | API-driven orchestration; GET/PATCH /api/v1/config reads and edits a fixed allowlist of padas.toml keys. Every other key is a file edit plus systemctl restart. |
| Process config admin | GET/PATCH /api/v1/config | Send validate_only: true first in automation. Keys off the allowlist return 400 and the file is unchanged. |
| Metrics / internal streams | [observability], GET /api/v1/metrics | Internal/system streams (e.g. _padas_metrics) feed observability—observability implications on hot path when metrics level is high. |
| Runtime API protection | [api.auth], service-account JSON | Axum runtime auth middleware when enabled—see Service-account authentication and Security. |
Configuration file
Hierarchy
Config layering is fixed: padas.default.toml (immutable vendor defaults) → operator padas.toml → environment overrides (e.g. PADAS_HOME). Runtime precedence: later layers override earlier for the same keys. Treat padas.default.toml as read-only baseline; keep deployment portability overrides in padas.toml beside it under $PADAS_HOME/core/etc/ (platform $PADAS_HOME=/opt/padas; core/ is the engine tree). Stateful paths (data_dir, WAL, [api.persistence].config_dir) belong in operator config so reload behavior and backups stay consistent.
Remote edits vs restart: PATCH /api/v1/config merges a small allowlist into operator padas.toml (never padas.default.toml) and applies it in-process:
| Keys | Apply |
|---|---|
observability.logging.level | Hot — the live log filter changes immediately. RUST_LOG, when set, wins only at process start. |
lookup.enabled, lookup.http_url, lookup.grpc_addr, lookup.binding_poll_interval_secs, lookup.tls.verify_cert, lookup.tls.ca_file | Reload — the lookup client is swapped and running tasks are retargeted. |
[core.auth] client id, client secret, token_url, jwks_url, issuer, ca_file, outbound audiences and scopes | Reload — token manager and inbound validator are swapped. |
The response lists which keys were hot, reloaded, or restart_required. PATCH never exits the process. Listen address, TLS, data/WAL paths, lookup.cache_path, and subscriber settings are not on the allowlist: edit padas.toml and run sudo systemctl restart padas-core in a maintenance window. There is no POST /api/v1/system/reload. Full doc: Motion Engine TOML.
Minimal lab profile (TLS and auth off)
Use only on trusted localhost. Auth-disabled operational risks: with [api.auth].enabled = false, /api/v1/* is unauthenticated runtime API exposure—never on shared networks (Security).
[api]
host = "127.0.0.1"
[api.tls]
enabled = false
[api.auth]
enabled = false
Production-oriented API bind and transport
[api]
enabled = true
host = "0.0.0.0"
port = 8999
prefix = "/api/v1"
[api.tls]
enabled = true
cert_file = "/var/lib/padas/etc/api.crt"
key_file = "/var/lib/padas/etc/api.key"
[api.cors]
enabled = true
allowed_origins = "https://padas-ui.example.com"
allow_credentials = false
allowed_methods = "GET,POST,PUT,DELETE,OPTIONS"
allowed_headers = "Content-Type,Authorization"
preflight_max_age_secs = 3600
Service-account authentication (summary)
When [api.auth].enabled = true, the engine requires Authorization: Bearer <token> on routes under /api/v1/, including /health and /metrics. Token material for direct API clients lives in JSON at [api.auth].service_account_token_file (default $PADAS_HOME/core/data/security/service-account.token in the engine tree). The console uses enrollment credentials separately—see Security. TLS is configured under [api.tls].
Registry persistence (API-managed objects)
[api.persistence]
config_dir = "/var/lib/padas/data/registry"
streams_registry_file = "streams.json"
tasks_registry_file = "tasks.json"
connectors_registry_file = "connectors.json"
backup_enabled = true
backup_dir = "/var/lib/padas/data/registry/backups"
max_backups = 10
Runtime projection: config_dir holds the authoritative persistence projection of API-managed streams/tasks/connectors—the registry durability operators backup. Reconciliation behavior: on startup the engine loads JSON and aligns runtime state with disk; runtime drift implications appear when manual file edits disagree with last API write or when restores are partial.
Backup strategy: snapshot config_dir with backup_enabled rotation and external volume backup—restore expectations include restarting the engine so registry reconciliation runs against a consistent trio of files. Persistence ownership is split: registry JSON for config state, WAL/data dirs for runtime durability and task windows—restore one without the other at your own risk.