pub struct Executor {
pub id: String,
pub owner: String,
pub current_supervisor: String,
/* private fields */
}Expand description
An executor that processes tasks.
Fields§
§id: StringUnique identifier
owner: StringOwner supervisor
current_supervisor: StringCurrent controlling supervisor (may differ if borrowed)
Implementations§
Source§impl Executor
impl Executor
Sourcepub fn from_config(config: ExecutorConfig) -> Self
pub fn from_config(config: ExecutorConfig) -> Self
Create from full config.
Sourcepub async fn state(&self) -> ExecutorState
pub async fn state(&self) -> ExecutorState
Get current state.
Sourcepub async fn is_borrowed(&self) -> bool
pub async fn is_borrowed(&self) -> bool
Check if borrowed.
Sourcepub async fn set_borrowed(
&self,
to_supervisor: String,
lease_id: String,
expires_at: DateTime<Utc>,
)
pub async fn set_borrowed( &self, to_supervisor: String, lease_id: String, expires_at: DateTime<Utc>, )
Set state to borrowed.
Sourcepub async fn return_to_owner(&mut self)
pub async fn return_to_owner(&mut self)
Return to owner.
Sourcepub async fn increment_completed(&self)
pub async fn increment_completed(&self)
Increment completed tasks.
Sourcepub async fn increment_failed(&self)
pub async fn increment_failed(&self)
Increment failed tasks.
Sourcepub fn capabilities(&self) -> &HashSet<Capability>
pub fn capabilities(&self) -> &HashSet<Capability>
Get capabilities.
Sourcepub fn has_capability(&self, cap: Capability) -> bool
pub fn has_capability(&self, cap: Capability) -> bool
Check if has capability.
Sourcepub fn llm_config(&self) -> &LLMConfig
pub fn llm_config(&self) -> &LLMConfig
Get LLM config.
Sourcepub async fn execute(
&self,
system_prompt: &str,
user_prompt: &str,
) -> Result<ExecutionResult, ExecutionError>
pub async fn execute( &self, system_prompt: &str, user_prompt: &str, ) -> Result<ExecutionResult, ExecutionError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Executor
impl !RefUnwindSafe for Executor
impl Send for Executor
impl Sync for Executor
impl Unpin for Executor
impl UnsafeUnpin for Executor
impl !UnwindSafe for Executor
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