pub struct WasmindContext {
pub tx: Sender<MessageEnvelope>,
pub actor_executors: HashMap<String, Arc<dyn ActorExecutor + 'static>>,
pub scope_tracking: Arc<Mutex<HashMap<Scope, HashSet<String>>>>,
pub scope_parents: Arc<Mutex<HashMap<Scope, Option<Scope>>>>,
pub engine: Engine,
}Expand description
Shared context for the Wasmind system that enables agent spawning
Fields§
§tx: Sender<MessageEnvelope>Broadcast channel for all messages
actor_executors: HashMap<String, Arc<dyn ActorExecutor + 'static>>Registry of available actors mapped by logical name
scope_tracking: Arc<Mutex<HashMap<Scope, HashSet<String>>>>Track which actors are expected in each scope Arc<Mutex<>> for concurrent access from spawn_agent calls
scope_parents: Arc<Mutex<HashMap<Scope, Option<Scope>>>>Track parent-child relationships between scopes Arc<Mutex<>> for concurrent access from spawn_agent calls
engine: EngineGlobal WASM engine for compilation and management of wasm modules
Implementations§
Source§impl WasmindContext
impl WasmindContext
pub fn new<T>(actors: Vec<T>) -> Selfwhere
T: ActorExecutor + 'static,
Sourcepub fn add_actor<T>(&mut self, actor: T)where
T: ActorExecutor + 'static,
pub fn add_actor<T>(&mut self, actor: T)where
T: ActorExecutor + 'static,
Add an individual actor of any type that implements ActorExecutor
Sourcepub async fn spawn_agent<S: AsRef<str> + Debug>(
&self,
actor_ids: &[S],
agent_name: String,
parent_scope: Option<Scope>,
) -> WasmindResult<Scope>
pub async fn spawn_agent<S: AsRef<str> + Debug>( &self, actor_ids: &[S], agent_name: String, parent_scope: Option<Scope>, ) -> WasmindResult<Scope>
Spawn a new agent with the specified actors in a new scope
Sourcepub async fn spawn_agent_in_scope<S: AsRef<str> + Debug>(
&self,
actor_names: &[S],
scope: Scope,
agent_name: String,
parent_scope: Option<Scope>,
) -> WasmindResult<()>
pub async fn spawn_agent_in_scope<S: AsRef<str> + Debug>( &self, actor_names: &[S], scope: Scope, agent_name: String, parent_scope: Option<Scope>, ) -> WasmindResult<()>
Spawn a new agent with the specified actors in a specific scope
Sourcepub fn broadcast_common_message<T>(&self, message: T) -> WasmindResult<()>where
T: Message,
pub fn broadcast_common_message<T>(&self, message: T) -> WasmindResult<()>where
T: Message,
Broadcast a common message to all actors
Sourcepub fn broadcast(&self, message_envelope: MessageEnvelope) -> WasmindResult<()>
pub fn broadcast(&self, message_envelope: MessageEnvelope) -> WasmindResult<()>
Broadcasts a message to all actors
Sourcepub fn get_parent_scope(&self, scope: Scope) -> Option<Scope>
pub fn get_parent_scope(&self, scope: Scope) -> Option<Scope>
Get the parent scope for a given scope Returns None if the scope has no parent (root scope)
Trait Implementations§
Source§impl Clone for WasmindContext
impl Clone for WasmindContext
Source§fn clone(&self) -> WasmindContext
fn clone(&self) -> WasmindContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for WasmindContext
impl !RefUnwindSafe for WasmindContext
impl Send for WasmindContext
impl Sync for WasmindContext
impl Unpin for WasmindContext
impl !UnwindSafe for WasmindContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more