pub struct ContractNetManager { /* private fields */ }Expand description
Contract-Net Protocol manager
Implementations§
Source§impl ContractNetManager
impl ContractNetManager
Sourcepub fn with_strategy(strategy: BidEvaluationStrategy) -> Self
pub fn with_strategy(strategy: BidEvaluationStrategy) -> Self
Create with a specific evaluation strategy
Sourcepub fn subscribe(&self) -> Receiver<ContractMessage>
pub fn subscribe(&self) -> Receiver<ContractMessage>
Get a receiver for protocol messages
Sourcepub async fn generate_task_id(&self) -> String
pub async fn generate_task_id(&self) -> String
Generate a unique task ID
Sourcepub async fn announce_task(&self, announcement: TaskAnnouncement) -> String
pub async fn announce_task(&self, announcement: TaskAnnouncement) -> String
Announce a task for bidding
Sourcepub async fn receive_bid(&self, bid: TaskBid) -> Result<(), String>
pub async fn receive_bid(&self, bid: TaskBid) -> Result<(), String>
Process a bid from an agent
Sourcepub async fn award_task(&self, task_id: &str) -> Option<String>
pub async fn award_task(&self, task_id: &str) -> Option<String>
Evaluate bids and award task to winner
Sourcepub async fn accept_award(
&self,
task_id: &str,
agent_id: &str,
) -> Result<(), String>
pub async fn accept_award( &self, task_id: &str, agent_id: &str, ) -> Result<(), String>
Record acceptance of an award
Sourcepub async fn decline_award(
&self,
task_id: &str,
agent_id: &str,
reason: &str,
) -> Result<(), String>
pub async fn decline_award( &self, task_id: &str, agent_id: &str, reason: &str, ) -> Result<(), String>
Record decline of an award
Sourcepub async fn complete_task(
&self,
task_id: &str,
agent_id: &str,
success: bool,
result: Option<String>,
) -> Result<(), String>
pub async fn complete_task( &self, task_id: &str, agent_id: &str, success: bool, result: Option<String>, ) -> Result<(), String>
Record task completion
Sourcepub async fn get_task_status(&self, task_id: &str) -> Option<TaskStatus>
pub async fn get_task_status(&self, task_id: &str) -> Option<TaskStatus>
Get task status
Sourcepub async fn get_pending_tasks(&self) -> Vec<TaskAnnouncement>
pub async fn get_pending_tasks(&self) -> Vec<TaskAnnouncement>
Get all pending tasks
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ContractNetManager
impl !RefUnwindSafe for ContractNetManager
impl Send for ContractNetManager
impl Sync for ContractNetManager
impl Unpin for ContractNetManager
impl UnsafeUnpin for ContractNetManager
impl UnwindSafe for ContractNetManager
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