UNPKG

arvo-xstate

Version:

This package allows you to use xstate Actors and State Machines to act as orchestrators in an Arvo Event Driven System

29 lines (28 loc) 1.34 kB
import { ArvoOrchestrator } from '.'; import type { ICreateArvoOrchestrator } from './types'; /** * Creates a new Arvo orchestrator instance with default components. * For custom components, use ArvoOrchestrator constructor directly. * * @param config - Orchestrator configuration * @param config.memory - State persistence interface for storing machine states * @param config.executionunits - Cost units for execution tracking * @param config.machines - Array of state machines to manage. Their resource locking flags determine orchestrator's locking behavior * @returns Configured ArvoOrchestrator instance with default registry and execution engine * * @remarks * The orchestrator's resource locking is enabled if any machine requires it. Locking is needed when: * - Machine contains parallel states where multiple states can be active simultaneously * - Race conditions need to be prevented in concurrent processing * - State consistency must be maintained across distributed executions * * @example * ```typescript * const orchestrator = createArvoOrchestrator({ * memory: new MyMemoryImplementation(), * executionunits: 1, * machines: [machineA, machineB] * }); * ``` */ export declare const createArvoOrchestrator: ({ executionunits, memory, machines, }: ICreateArvoOrchestrator) => ArvoOrchestrator;