Skip to main content

Crate autumn_harvest

Crate autumn_harvest 

Source
Expand description

Durable workflow orchestration engine core.

Re-exports§

pub use admission_gate::AdmissionGate;
pub use admission_gate::AdmissionGateCache;
pub use admission_gate::AdmissionGateId;
pub use admission_gate::AdmissionGateView;
pub use admission_gate::GateMode;
pub use admission_gate::GateScope;
pub use admission_gate::MAX_ACTIVE_GATES;
pub use admission_gate::ProducerContractEntry;
pub use admission_gate::ProducerGateStatus;
pub use admission_gate::StartProducer;
pub use admission_gate::check_admission;
pub use admission_gate::global_admission_gate_cache;
pub use admission_gate::producer_contract;
pub use admission_gate::set_global_admission_gate_cache;
pub use analyzer::AnalyzerRule;
pub use analyzer::AnalyzerWarning;
pub use analyzer::ExcessiveRetriesRule;
pub use analyzer::HistoryAnalyzer;
pub use analyzer::LargePayloadRule;
pub use analyzer::SuspiciousTimerRule;
pub use builder::BuiltHarvest;
pub use builder::HarvestBuilder;
pub use builder::HarvestBuilderError;
pub use builder::StickyRoutingConfig;
pub use builder::WorkerConfig;
pub use cache::CachedWorkflowState;
pub use cache::WorkflowCache;
pub use calendar::BackfillSlot;
pub use calendar::create_calendar;
pub use calendar::delete_calendar;
pub use calendar::get_calendar;
pub use calendar::list_calendars;
pub use calendar::load_exclusions_for_calendar;
pub use calendar::plan_backfill_with_calendar;
pub use calendar::preview_schedule_firings;
pub use calendar::replace_calendar_exclusions;
pub use calendar::Calendar;
pub use calendar::ScheduleFirePreview;
pub use calendar::apply_skip_policy;
pub use calendar::calendar_excludes_weekends;
pub use calendar::is_excluded_date;
pub use canary::CANARY_ACTIVITY_NAME;
pub use canary::CANARY_WORKFLOW_NAME_PREFIX;
pub use canary::is_canary_workflow;
pub use canary::is_reserved_canary_name;
pub use completion_trigger::CompletionTrigger;
pub use completion_trigger::ConditionGate;
pub use completion_trigger::InputMapping;
pub use completion_trigger::MAX_CONDITION_DEPTH;
pub use completion_trigger::MAX_CONDITION_IN_VALUES;
pub use completion_trigger::MAX_CONDITION_NODES;
pub use completion_trigger::TerminalState;
pub use completion_trigger::TriggerCondition;
pub use completion_trigger::gate_stored_condition;
pub use context::ActivityContext;
pub use context::AutoHeartbeatGuard;
pub use context::DEFAULT_CONTINUE_AS_NEW_DEADLINE_FRACTION;
pub use context::DEFAULT_HISTORY_CONTINUE_AS_NEW_THRESHOLD;
pub use context::DEFAULT_SESSION_ACQUISITION_TIMEOUT;
pub use context::MutexGuard;
pub use context::MutexHandle;
pub use context::RaceBuilder;
pub use context::RaceWinner;
pub use context::Session;
pub use context::SessionOptions;
pub use context::TimerHandle;
pub use context::TimerOutcome;
pub use context::WorkflowCommand;
pub use context::WorkflowContext;
pub use context::WorkflowExecutionInfo;
pub use context::WorkflowHistoryPolicy;
pub use context::is_reserved_session_activity_name;
pub use critical_path::CriticalPathAnalyzer;
pub use critical_path::CriticalPathResult;
pub use dag::DagBuildError;
pub use dag::DagBuilder;
pub use dag::DagCondition;
pub use dag::DagDefinition;
pub use dag::DagDispatchDecision;
pub use dag::DagInputBinding;
pub use dag::DagMapTaskRef;
pub use dag::DagMergeSource;
pub use dag::DagSignalGate;
pub use dag::DagTask;
pub use dag::DagTaskRef;
pub use dag::GateTimeoutAction;
pub use dag_export::export_dot;
pub use dag_export::export_mermaid;
pub use dag_export::export_mermaid_with_critical_path;
pub use dag_linter::DagLinter;
pub use dag_linter::DagRule;
pub use dag_linter::DagWarning;
pub use dag_linter::ExcessiveParallelismRule;
pub use dag_linter::MissingRetryPolicyRule;
pub use dag_linter::MissingTimeoutRule;
pub use det_check::DetCheckReport;
pub use det_check::DetFinding;
pub use det_check::DetLocation;
pub use det_check::DetSeverity;
pub use det_check::DetSuppression;
pub use det_check::check_dir;
pub use det_check::check_file;
pub use det_check::check_paths;
pub use det_check::check_source;
pub use diagnostic::DiagnosticReport;
pub use diagnostic::SimulatorResultExt;
pub use error::HarvestError;
pub use error::HarvestResult;
pub use error::TimeoutType;
pub use event::SideEffectKind;
pub use event::WorkflowEvent;
pub use executor::WorkflowOutcome;
pub use executor::run_workflow;
pub use guardrail::GuardrailFinding;
pub use guardrail::GuardrailSuppression;
pub use guardrail::GuardrailSuppressionError;
pub use guardrail::RuleCategory;
pub use guardrail::RuleEntry;
pub use guardrail::Severity;
pub use guardrail::catalog as guardrail_catalog;
pub use guardrail::rule_by_id as guardrail_rule_by_id;
pub use handle::StartedWorkflowHandle;
pub use handle::WorkflowHandle;
pub use handle::WorkflowHandleClient;
pub use handle::WorkflowResult;
pub use handle::WorkflowResultState;
pub use handle::start_or_load_workflow_execution_with_handle;
pub use handle_typed::TypedSignalWithStartOptions;
pub use handle_typed::TypedStartOptions;
pub use handle_typed::TypedUpdateWithStartOptions;
pub use handle_typed::TypedWorkflowHandle;
pub use handle_typed::TypedWorkflowResult;
pub use history_export::DEFAULT_HISTORY_EXPORT_MAX_BYTES;
pub use history_export::HISTORY_EXPORT_SCHEMA;
pub use history_export::HISTORY_EXPORT_VERSION;
pub use history_export::HistoryExportDocument;
pub use history_export::HistoryExportError;
pub use history_export::HistoryExportRequest;
pub use history_export::HistoryExportSizeLimit;
pub use history_export::HistoryExportStatus;
pub use history_export::HistoryPayloadPolicy;
pub use history_export::export_history;
pub use history_export::export_mermaid_sequence;
pub use info::ActivityHandlerFn;
pub use info::ActivityInfo;
pub use info::DagInfo;
pub use info::InterfaceHandlerRecord;
pub use info::QueryHandlerFn;
pub use info::QueryHandlerInfo;
pub use info::SignalHandlerInfo;
pub use info::UpdateHandlerFn;
pub use info::UpdateHandlerInfo;
pub use info::UpdateValidatorFn;
pub use info::WorkflowHandlerFn;
pub use info::WorkflowInfo;
pub use info::WorkflowInterfaceRecord;
pub use interceptor::ActivityInterceptor;
pub use interceptor::ActivityInterceptorFuture;
pub use interceptor::ActivityInterceptorNext;
pub use interceptor::ActivityInvocation;
pub use mutex::DEFAULT_MUTEX_LEASE_TTL;
pub use mutex::MutexGrantOutcome;
pub use mutex::MutexWakeTarget;
pub use mutex::effective_mutex_lease_ttl;
pub use mutex::set_mutex_lease_ttl;
pub use payload_codec::CodecError;
pub use payload_codec::IdentityCodec;
pub use payload_codec::LossyDecodeOutcome;
pub use payload_codec::PayloadCodec;
pub use payload_codec::PayloadCodecs;
pub use payload_codec::UNDECODABLE_MARKER_KEY;
pub use payload_codec::UNDECODABLE_REASON_CODEC_ERROR;
pub use payload_codec::UNDECODABLE_REASON_INVALID_BASE64;
pub use payload_codec::UNDECODABLE_REASON_INVALID_JSON;
pub use payload_codec::UNDECODABLE_REASON_UNKNOWN_CODEC;
pub use payload_codec::undecodable_marker;
pub use payload_store::OffloadedRef;
pub use payload_store::PayloadOffloader;
pub use payload_store::PayloadStore;
pub use payload_store::PayloadStoreError;
pub use payload_store::PayloadStoreFuture;
pub use policy::validate_schedule;
pub use policy::CatchupPolicy;
pub use policy::MapFailurePolicy;
pub use policy::OverlapPolicy;
pub use policy::RetryPolicy;
pub use policy::Schedule;
pub use policy::SkipPolicy;
pub use policy::TaskStatus;
pub use policy::TriggerRule;
pub use policy::WorkflowSchedule;
pub use pool::HarvestPoolConfig;
pub use pool::compute_pool_sizes;
pub use query::QueryRegistry;
pub use replay::ChildOrTimerMatch;
pub use replay::DEADLINE_PROBE_SIDE_EFFECT_NAME;
pub use replay::HistoryMatch;
pub use replay::HistoryMatcher;
pub use replay::MutexGrantMatch;
pub use replay::PatchMarkerMatch;
pub use replay::SagaMarkerMatch;
pub use replay::SideEffectNowMatch;
pub use replay::SignalOrTimerMatch;
pub use replay::TimerFireMatch;
pub use reset::BatchResetItem;
pub use reset::BatchResetOutcome;
pub use reset::ResetInvalidPoint;
pub use reset::ResetPlan;
pub use reset::ResetPoint;
pub use reset::ResetResult;
pub use reset::ResetSignalReapplyPolicy;
pub use reset::ResetSkipReason;
pub use reset::ResetUnresolvedSideEffect;
pub use reset::WorkflowResetError;
pub use reset::WorkflowResetRequest;
pub use reset::preview_workflow_reset;
pub use reset::reset_workflow_execution;
pub use reset::resolve_batch_reset_one;
pub use reset::resolve_reset_point;
pub use reset::validate_reset_point;
pub use retention::ArchiverFuture;
pub use retention::HistoryArchiver;
pub use retention::LegalHoldOutcome;
pub use retention::RetentionConfig;
pub use retention::legal_hold_active;
pub use retention::RetentionMonitor;
pub use retention::RetentionRuntime;
pub use retention::RetentionStatus;
pub use retention::RetentionTickResult;
pub use run_chain::RunChainRecord;
pub use run_chain::RunChainResponse;
pub use run_chain::RunChainRow;
pub use run_chain::assemble_run_chain;
pub use run_chain::outcome_for_state;
pub use saga::Saga;
pub use schedule_decision::record_decision_graceful;
pub use scheduler::DagCatalog;
pub use scheduler::RegisteredDag;
pub use scheduler::SchedulerMonitor;
pub use scheduler::SchedulerRuntime;
pub use scheduler::compile_dag_catalog;
pub use scheduler::register_schedules;
pub use scheduler::register_workflow_schedules;
pub use scheduler::tick_once;
pub use scheduler::trigger_unified_dag;
pub use shard::ShardRouter;
pub use shard::ShardedDbPool;
pub use signal_handler::SignalHandlerRegistry;
pub use simulator::SimulatorResult;
pub use simulator::WorkflowSimulator;
pub use telemetry::ActivityStatus;
pub use telemetry::MetricsRecorder;
pub use telemetry::NoOpMetrics;
pub use telemetry::NoOpPropagator;
pub use telemetry::TelemetryConfig;
pub use telemetry::TelemetryConfigBuilder;
pub use telemetry::TraceContextCarrier;
pub use telemetry::TraceContextPropagator;
pub use telemetry::USER_METRIC_PREFIX;
pub use telemetry::UserMetricError;
pub use telemetry::UserMetrics;
pub use telemetry::WebhookOutcome;
pub use telemetry::WorkflowStatus;
pub use telemetry::validate_user_metric;
pub use timeline::SlowestStep;
pub use timeline::StepKind;
pub use timeline::StepOutcome;
pub use timeline::Timeline;
pub use timeline::TimelineEventRow;
pub use timeline::TimelineRollup;
pub use timeline::TimelineStep;
pub use timeline::derive_timeline;
pub use types::ActivityExecId;
pub use types::BuildId;
pub use types::DeploymentName;
pub use types::ExecutionId;
pub use types::ExternalActivityToken;
pub use types::ExternalAwaitId;
pub use types::ExternalCancelId;
pub use types::ExternalSignalId;
pub use types::ParentClosePolicy;
pub use types::Priority;
pub use types::SessionId;
pub use types::ShardId;
pub use types::StartSource;
pub use types::TimerId;
pub use types::UpdateId;
pub use types::WorkerId;
pub use types::WorkflowId;
pub use types::WorkflowIdConflictPolicy;
pub use types::WorkflowIdReusePolicy;
pub use update::UpdateRegistry;
pub use version_usage::VersionExecutionStateGroup;
pub use version_usage::VersionUsageFilters;
pub use version_usage::VersionUsageShardRow;
pub use version_usage::load_version_usage;
pub use webhook_trigger::WebhookCtx;
pub use webhook_trigger::WebhookHandlerError;
pub use webhook_trigger::WebhookHandlerFn;
pub use webhook_trigger::WebhookTarget;
pub use webhook_trigger::WebhookTriggerInfo;
pub use webhook_trigger::validate_webhook_triggers;
pub use diesel;
pub use diesel_async;
pub use serde_json;
pub use serde;
pub use chrono;
pub use uuid;

Modules§

admission_gate
Admission gate primitive for incident-response operators (issue #377). Admission gate primitive for incident-response operators (issue #377).
analyzer
History analyzer and linter. Workflow history analyzer and linter.
api_token
Pure token-secret helpers shared by the mint route and the CLI (issue #942). Pure token-secret helpers for the management API (issue #942).
audit
Audit trail for management API mutations (issue #158). Management API audit trail (issue #158).
batch
Batch operations for fleet-wide workflow cancel/terminate/signal (issue #102). Batch operations for fleet-wide workflow management (issue #102).
batch_start
Batch workflow start types: caps and per-item request/result structs (issue #357). Batch workflow start types (issue #357).
build_routing
Worker build-id routing for safe rolling deploys (issue #171). Worker build-id routing for safe rolling deploys (issue #171).
builder
Fluent API for registering workflows, activities, and configuring the worker.
cache
LRU cache for suspended workflow states.
calendar
Calendar-aware schedule filtering: named exclusion sets, skip policies, and schedule preview generation (issue #337). Calendar-aware schedule filtering for business-day and holiday-skip jobs.
canary
Built-in synthetic liveness canary (issue #796).
circuit_breaker
Per-activity circuit breaker that fast-fails dispatch during downstream outages (issue #369). Per-activity circuit breaker that fast-fails dispatch during downstream outages (issue #369).
completion_callback
Durable completion callbacks (issue #605).
completion_trigger
concurrency
Per-key concurrency limits for tenant fair-share scheduling (issue #247). Per-key concurrency limits for tenant fair-share scheduling (issue #247).
context
Execution contexts passed to workflow and activity functions.
critical_path
Critical Path Analyzer for DAG Definitions.
dag
DAG definition primitives for Harvest.
dag_export
Export format types for Directed Acyclic Graphs (DAGs) representing workflows. Visualization exporters for DAG definitions.
dag_linter
DAG configuration analyzer and linter.
debounce
Debounced workflow starts — collapse trigger bursts into one run (issue #499). Debounced workflow starts — collapse trigger bursts into one run (issue #499).
det_check
Deterministic workflow guardrails: static source-level check for replay-breaking patterns. Deterministic workflow guardrails.
diagnostic
Diagnostic reporting for simulated workflow executions.
effective_config
Effective runtime-configuration introspection (issue #695).
eligibility
erase
Targeted PII erasure for completed workflow executions (issue #495).
error
Error types for the harvest engine.
event
Event types for the workflow event-sourcing engine.
event_batch
Event-batched workflow starts — fold many triggers into one batched run (issue #518).
executor
Workflow executor – runs a single workflow function through replay + live execution.
external_task
External activity task management — token-based async completion.
failure
Typed activity failure surface for structured error classification.
guardrail
Deterministic workflow guardrail rule catalog (issue #173). Deterministic workflow guardrail rule catalog (issue #173).
handle
In-process workflow result handles for request/response embedders.
handle_typed
Type-safe client handle wrappers and start options for compile-time-safe workflows.
history_export
Export workflow event histories to replay fixtures and Mermaid diagrams.
info
Registration types returned by macro-generated companion functions.
interceptor
Activity execution interceptors (issue #680): an ordered middleware chain wrapping every activity execution on the worker (regular + local). Activity execution interceptors (issue #680).
mutex
Durable mutual-exclusion locks for workflow code (ctx.mutex, issue #691). Durable mutual-exclusion locks for workflow code (issue #691).
payload_codec
Interfaces for transforming event payloads before they are persisted.
payload_store
Large-payload offloading to external storage via claim-check (issue #524).
poison_pill
Poison-pill task quarantine (Phase 4, issue #367).
policy
Retry policies, trigger rules, and scheduling types.
pool
Database pool configuration with separate pools and shared ceiling.
prelude
Convenient glob import for autumn-harvest users.
query
Types and definitions for querying workflow state and metadata. Query registry and dispatch for read-only workflow state inspection (issue #234).
replay
Replay engine for deterministic workflow re-execution.
reset
Workflow reset and fork recovery primitives.
retention
Time-based retention janitor for completed workflow history.
run_chain
Continue-as-new run-chain assembly (issue #701). Continue-as-new run-chain assembly (issue #701).
saga
Saga compensation helper for workflow code.
schedule_decision
scheduler
DAG scheduler and runtime execution.
sessions
Worker session fleet-side registry and pure decision functions (issue #606). Worker sessions (issue #606): co-locate an activity pipeline on one worker.
shard
Shard routing and per-shard database pools.
signal_handler
Signal handler registry for push-based reactive signal handling (issue #546). Signal handler registry for push-based reactive signal handling (issue #546).
simulator
Workflow simulator for local, determinism-safe testing.
slot_tuner
Adaptive worker dispatch-slot tuner (issue #548). Adaptive worker dispatch-slot tuner (issue #548).
start_idempotency
Request-scoped idempotency keys for plain workflow starts (issue #808). Request-scoped idempotency keys for plain workflow starts (issue #808).
telemetry
OpenTelemetry integration: trace-context propagation and metrics. OpenTelemetry integration surface for autumn-harvest.
throttle
Workflow-start throttle — pace admissions, defer the excess (issue #607). Workflow-start throttle — pace admissions, defer the excess (issue #607).
timeline
Per-execution timeline read model (issue #739). Per-execution timeline read model (issue #739).
types
Core identity types for the workflow engine.
update
Update handler registry for the workflow Update primitive (issue #140).
usage
Read-only per-tenant/per-workflow usage aggregation (issue #596).
version_gate_retirement
Read-only retirement-check query for recorded workflow version-gate markers.
version_usage
Read-only inventory for recorded workflow version-gate markers.
webhook_trigger
Inbound HTTP webhook trigger descriptors (issue #344).
workers
Worker fleet registry — liveness tracking, heartbeat, and fleet queries.

Macros§

cfg_db
Embedded migrations for the harvest engine schema.

Structs§

AuditRecord
A single management API audit record (issue #158).
CancelledWorkflowExecution
Result of a workflow cancellation request.
ConcurrencyKeyStats
Live stats for a single (concurrency_key, task_type) pair.
EventHistory
Loaded event history for a single workflow execution.
NewAuditRecord
Insert struct for recording a new audit event.
PausedWorkflowExecution
Result of a workflow pause request.
QueueScalingSignal
Live scaling signals for a task queue.
QueueTaskCounts
Helper struct for queue task counts.
ResolvedRun
A single candidate run resolved for a (workflow_name, workflow_id) pair on one shard (issue #805).
ResumedWorkflowExecution
Result of a workflow resume request.
ScheduleRunQuery
Filters + keyset cursor for list_schedule_runs (issue #534).
ScheduleRunRow
One row of the per-schedule run-history listing (issue #534).
ScheduleRunStateCount
A (state, count) pair from the per-schedule cadence summary (issue #534).
SignalWithStartOutcome
Result of a signal_with_start_workflow_execution call.
SignalWithStartParams
Parameters for the atomic signal_with_start primitive.
StartWorkflowParams
Parameters for starting a workflow execution.
StartedWorkflowExecution
Result of an idempotent workflow start attempt.
UpdateWithStartOutcome
Result of an update_with_start_workflow_execution call.
UpdateWithStartParams
Parameters for the atomic update_with_start primitive.
WorkflowCountQuery
Filters + grouping dimensions for the grouped workflow-count snapshot (issue #544).
WorkflowCountRow
One grouped count row, either raw from a single shard or already summed across shards (issue #544).
WorkflowTypeNonTerminalCount

Enums§

AwaitMode
Whether a child workflow was spawned in await or detached mode.
IdempotentStartOutcome
Outcome of start_or_load_workflow_execution_idempotent (issue #808).
WorkflowCountDimension
Dimension to group GET /workflows/count results by (issue #544).

Constants§

MIGRATIONS
ORIGIN_BACKFILL
Origin marker for a run created by a schedule backfill (issue #534).
ORIGIN_MANUAL_TRIGGER
Origin marker for an ad-hoc operator trigger-now fire of a schedule (issue #534).
ORIGIN_SCHEDULED
Origin marker for a normal scheduler-tick fire (issue #534).

Functions§

auto_resume_expired_pauses
Auto-resume executions that have been paused longer than max_pause_duration (issue #383, bounded pause).
cancel_workflow_execution
Cancel a running workflow execution.
count_workflow_executions_grouped
Count workflow executions grouped by the requested dimensions on one shard (issue #544).
list_schedule_runs
List the executions a schedule launched, newest-slot-first (issues #534, #762).
non_terminal_counts_by_workflow_name
Count non-terminal workflow executions grouped by workflow_name on one shard.
parse_byte_size
Parse a human-readable byte-size string like "2MiB", "256KiB", "4MB".
parse_instant
pause_workflow_execution
Pause a running workflow execution (issue #383).
queue_task_counts
Return backlog, in-flight, and scheduled task counts per queue on this shard.
resolve_execution_id_by_workflow_id
Resolve the best “latest run” for (workflow_name, workflow_id) on ONE shard (issue #805).
resume_workflow_execution
Resume a paused workflow execution (issue #383).
schedule_run_state_summary
Count a schedule’s scheduled-origin runs by terminal state (issue #534).
select_resolved_run
Pick the single best “latest run” from per-shard candidates (issue #805).
signal_with_start_workflow_execution
Errors
signal_with_start_workflow_execution_with_metrics
Errors
start_or_load_workflow_execution
Start a workflow execution or load the existing one, applying the caller’s WorkflowIdReusePolicy when a duplicate (workflow_name, workflow_id) collision occurs.
start_or_load_workflow_execution_idempotent
Start a workflow with request-scoped idempotency (issue #808).
start_or_load_workflow_execution_with_metrics
terminate_workflow_execution
Hard-finalize a workflow execution to TERMINATED regardless of its current live state.
update_with_start_workflow_execution
Atomically start or attach to a workflow and admit one update.
update_with_start_workflow_execution_with_metrics