pub struct Worker { /* private fields */ }Expand description
Background worker that polls the API and executes workflows.
Implementations§
Source§impl Worker
impl Worker
Sourcepub fn capabilities(&self) -> &WorkerCapabilities
pub fn capabilities(&self) -> &WorkerCapabilities
What this worker asks the API for: the workflows it registered, sorted, and the tags it carries, sorted and deduplicated.
§Examples
use std::sync::Arc;
use ironflow_core::providers::claude::ClaudeCodeProvider;
use ironflow_worker::WorkerBuilder;
let worker = WorkerBuilder::new("http://localhost:3000", "token")
.provider(Arc::new(ClaudeCodeProvider::new()))
.tags(["gpu"])
.build()?;
assert_eq!(worker.capabilities().tags, vec!["gpu".to_string()]);Sourcepub async fn run(&self) -> Result<(), WorkerError>
pub async fn run(&self) -> Result<(), WorkerError>
Run the worker loop until a shutdown signal (SIGTERM/SIGINT) is received.
On shutdown, the worker stops picking new runs and waits for all in-flight executions to complete before returning.
§Errors
Returns WorkerError if the polling loop encounters an unrecoverable error.
With the prometheus feature and a
metrics_addr, returns
WorkerError::Internal before polling if the exporter cannot be built
(including when the address cannot be bound, for instance because it is
already in use) or a metrics recorder is already installed in the process.
Auto Trait Implementations§
impl !Freeze for Worker
impl !RefUnwindSafe for Worker
impl !UnwindSafe for Worker
impl Send for Worker
impl Sync for Worker
impl Unpin for Worker
impl UnsafeUnpin for Worker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more