Struct Swarm

Source
pub struct Swarm { /* private fields */ }
Expand description

Swarm orchestrator

Implementations§

Source§

impl Swarm

Source

pub fn new(config: SwarmConfig) -> Self

Create a new swarm orchestrator

Source

pub fn register_agent(&mut self, agent: DynamicAgent) -> Result<()>

Register an agent with the swarm

Source

pub fn unregister_agent(&mut self, agent_id: &AgentId) -> Result<()>

Remove an agent from the swarm

Source

pub fn submit_task(&mut self, task: Task) -> Result<()>

Submit a task to the swarm

Source

pub async fn distribute_tasks(&mut self) -> Result<Vec<(TaskId, AgentId)>>

Assign tasks to agents based on distribution strategy

Source

pub fn agent_statuses(&self) -> HashMap<AgentId, AgentStatus>

Get the status of all agents

Source

pub fn task_queue_size(&self) -> usize

Get the current task queue size

Source

pub fn assigned_tasks_count(&self) -> usize

Get assigned tasks count

Source

pub fn get_agent(&self, agent_id: &AgentId) -> Option<&DynamicAgent>

Get agent by ID

Source

pub fn get_agent_mut(&mut self, agent_id: &AgentId) -> Option<&mut DynamicAgent>

Get mutable agent by ID

Source

pub async fn start_all_agents(&mut self) -> Result<()>

Start all agents

Source

pub async fn shutdown_all_agents(&mut self) -> Result<()>

Shutdown all agents

Source

pub fn metrics(&self) -> SwarmMetrics

Get swarm metrics

Auto Trait Implementations§

§

impl Freeze for Swarm

§

impl !RefUnwindSafe for Swarm

§

impl Send for Swarm

§

impl Sync for Swarm

§

impl Unpin for Swarm

§

impl !UnwindSafe for Swarm

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.