Skip to content

API Reference

A navigable index of the Dory SDK's public surface, grouped by area. Each entry gives a one-line purpose, the signature, and a link to the topic page with full detail. Names without an explicit module are exported from the top-level dory package.

Core

See Core Concepts.

Symbol Signature Purpose
BaseProcessor BaseProcessor(context) Base class for processors; auto-wires resilience, telemetry, and publish().
ExecutionContext ExecutionContext(...) Runtime context; config() is a method, plus run_loop(interval=N).
DoryApp DoryApp().run(ProcessorClass) Entry point that boots and runs a processor.
DoryConfig DoryConfig(startup_timeout_sec=30, shutdown_timeout_sec=30, health_port=8080, state_backend="configmap", log_level="INFO") Typed config schema — see Configuration.

BaseProcessor.publish(event_type, location, payload, *, headers=None, exchange=None) — publish a result event; see Output & Events.

State

See State Management.

Symbol Signature Purpose
stateful stateful(default) Class-attribute descriptor auto-saved/restored across migration.
StatefulVar StatefulVar Type of a stateful-declared variable.
StateManager dory.migration.StateManager Coordinates save/restore against a backend.
StateSerializer dory.migration.StateSerializer Serializes/deserializes versioned state.
ConfigMapStore dory.migration.ConfigMapStore Kubernetes ConfigMap backend (async).
S3Store dory.migration.S3Store S3 backend.
S3Config dory.migration.S3Config S3 backend configuration.

Edge

See Edge & Failover. Node-level failover is the orchestrator's job — Orchestrator edge failover.

Symbol Signature Purpose
FencingManager FencingManager(config: FencingConfig | None = None) Epoch-based fencing lock (no app_name).
FencingConfig FencingConfig(acquire_timeout_sec=10.0, lock_ttl_sec=60.0, refresh_interval_sec=15.0, backend="redis", redis_url=None, key_prefix="dory:fencing") Fencing settings.
FencingToken FencingToken(processor_id, node_id, epoch, acquired_at, token_id) Held lock; is_valid(current_epoch).
RoleManager RoleManager(processor_id, node_id, fencing_config=None, start_as_standby=False) PRIMARY/STANDBY state machine; takes a fencing_config.
ProcessorRole enum INITIALIZING, PRIMARY, STANDBY, DRAINING, FENCED, STOPPED.
RoleTransition dataclass Record of a role change.
HeartbeatManager HeartbeatManager(config: HeartbeatConfig | None = None) Liveness reporter; .status is a property.
HeartbeatConfig HeartbeatConfig(orchestrator_url=None, interval_sec=10.0, ...) Heartbeat settings.
ConnectivityStatus enum Connectivity verdict reported by HeartbeatManager.status.
EdgeHealthReporter EdgeHealthReporter(heartbeat_manager=None, role_manager=None) Aggregates edge health.

Edge errors: FencingError (base), FenceViolation (token went stale mid-operation), StaleEpochError (raised by validate_or_raise).

Resilience

See Resilience.

Symbol Purpose
CircuitBreaker Fail-fast wrapper around a flaky dependency.
CircuitState CLOSED / OPEN / HALF_OPEN.
CircuitOpenError Raised when calling through an open breaker.
retry_with_backoff Retry a coroutine with exponential backoff.
RetryPolicy Retry configuration (attempts, delays).
RetryBudget Caps total retries to avoid retry storms.

Errors

See Core Concepts.

Symbol Purpose
DoryError Base exception for all SDK errors.
DoryStartupError Startup failed (e.g. state restore timeout).
DoryShutdownError Graceful shutdown failed.
DoryStateError State save/restore failure.
DoryConfigError Invalid configuration.

Simple API

For minimal processors. See Getting Started.

Symbol Module Purpose
processor dory.simple Decorator that turns a function into a processor.
state dory.simple Declare a auto-persisted variable (state(default)).
run_processor dory.simple Run a decorated processor.
from dory.simple import processor, state, run_processor

counter = state(0)

@processor
async def tick(ctx):
    async for _ in ctx.run_loop(interval=1):
        counter.value += 1

Note

The package version is dory.__version__. Output, auth, and geo helpers live under dory.output, dory.auth.oauth2, and dory.geo.geolocalizer — see Output & Events and Edge & Failover.