pub trait ProcManager {
type Handle: ProcHandle;
// Required methods
fn transport(&self) -> ChannelTransport;
fn spawn<'life0, 'async_trait>(
&'life0 self,
proc_id: ProcId,
forwarder_addr: ChannelAddr,
) -> Pin<Box<dyn Future<Output = Result<Self::Handle, HostError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
A trait describing a manager of procs, responsible for bootstrapping
procs on a host, and managing their lifetimes. The manager spawns an
Agent
-typed actor on each proc, responsible for managing the proc.
Required Associated Types§
Sourcetype Handle: ProcHandle
type Handle: ProcHandle
Concrete handle type this manager returns.
Required Methods§
Sourcefn transport(&self) -> ChannelTransport
fn transport(&self) -> ChannelTransport
The preferred transport for this ProcManager.
In practice this will be ChannelTransport::Local
for testing, and ChannelTransport::Unix
for external
processes.
Sourcefn spawn<'life0, 'async_trait>(
&'life0 self,
proc_id: ProcId,
forwarder_addr: ChannelAddr,
) -> Pin<Box<dyn Future<Output = Result<Self::Handle, HostError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn spawn<'life0, 'async_trait>(
&'life0 self,
proc_id: ProcId,
forwarder_addr: ChannelAddr,
) -> Pin<Box<dyn Future<Output = Result<Self::Handle, HostError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Spawn a new proc with the provided proc id. The proc should use the provided forwarder address for messages destined outside of the proc. The returned address accepts messages destined for the proc.
An agent actor is also spawned, and the corresponding actor ref is returned.
Implementors§
Source§impl<A> ProcManager for ProcessProcManager<A>
impl<A> ProcManager for ProcessProcManager<A>
type Handle = ProcessHandle<A>
Source§impl<A, S, F> ProcManager for LocalProcManager<S>
Local, in-process ProcManager.
impl<A, S, F> ProcManager for LocalProcManager<S>
Local, in-process ProcManager.
Type bounds:
A: Actor + Referable + Binds<A>
Actor
: the agent actually runs inside the proc.Referable
: callers holdActorRef<A>
to the agent; this bound is required for typed remote refs.Binds<A>
: lets the runtime wire the agent’s message ports.
F: Future<Output = anyhow::Result<ActorHandle<A>>> + Send
: the spawn closure returns a Send future (wetokio::spawn
it).S: Fn(Proc) -> F + Sync
: the factory can be called from concurrent contexts.
Result handle is LocalHandle<A>
(whose Agent = A
via ProcHandle
).