feat(wfe-core): add models, traits, and error types
Core domain models: WorkflowInstance, ExecutionPointer, WorkflowDefinition, WorkflowStep, Event, EventSubscription, ScheduledCommand, ExecutionError, LifecycleEvent, PollEndpointConfig. All serde-serializable. Provider traits: PersistenceProvider (composite of WorkflowRepository, EventRepository, SubscriptionRepository, ScheduledCommandRepository), DistributedLockProvider, QueueProvider, SearchIndex, LifecyclePublisher, WorkflowMiddleware, StepMiddleware, WorkflowRegistry. StepBody trait with StepExecutionContext for workflow step implementations. WorkflowData marker trait (blanket impl for Serialize + DeserializeOwned).
This commit is contained in:
13
wfe-core/src/traits/queue.rs
Normal file
13
wfe-core/src/traits/queue.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
use async_trait::async_trait;
|
||||
|
||||
use crate::models::QueueType;
|
||||
|
||||
/// Queue provider for distributing workflow execution across workers.
|
||||
#[async_trait]
|
||||
pub trait QueueProvider: Send + Sync {
|
||||
async fn queue_work(&self, id: &str, queue: QueueType) -> crate::Result<()>;
|
||||
async fn dequeue_work(&self, queue: QueueType) -> crate::Result<Option<String>>;
|
||||
fn is_dequeue_blocking(&self) -> bool;
|
||||
async fn start(&self) -> crate::Result<()>;
|
||||
async fn stop(&self) -> crate::Result<()>;
|
||||
}
|
||||
Reference in New Issue
Block a user