Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions hyperactor/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
//! ```

use std::collections::HashMap;
use std::collections::HashSet;
use std::fmt;
use std::marker::PhantomData;
use std::str::FromStr;
Expand Down Expand Up @@ -121,7 +122,7 @@ pub enum HostError {
/// routing, as described in this module's documentation.
#[derive(Debug)]
pub struct Host<M> {
procs: HashMap<String, ChannelAddr>,
procs: HashSet<String>,
frontend_addr: ChannelAddr,
backend_addr: ChannelAddr,
router: DialMailboxRouter,
Expand Down Expand Up @@ -159,7 +160,7 @@ impl<M: ProcManager> Host<M> {
);

let host = Host {
procs: HashMap::new(),
procs: HashSet::new(),
frontend_addr,
backend_addr,
router,
Expand Down Expand Up @@ -203,7 +204,7 @@ impl<M: ProcManager> Host<M> {
name: String,
config: M::Config,
) -> Result<(ProcId, ActorRef<ManagerAgent<M>>), HostError> {
if self.procs.contains_key(&name) {
if self.procs.contains(&name) {
return Err(HostError::ProcExists(name));
}

Expand Down Expand Up @@ -250,7 +251,7 @@ impl<M: ProcManager> Host<M> {
})?;

self.router.bind(proc_id.clone().into(), addr.clone());
self.procs.insert(name, addr);
self.procs.insert(name);

Ok((proc_id, agent_ref))
}
Expand Down Expand Up @@ -1190,7 +1191,6 @@ pub mod testing {
use crate::Context;
use crate::Handler;
use crate::OncePortRef;
use crate::RemoteSpawn;

/// Just a simple actor, available in both the bootstrap binary as well as
/// hyperactor tests.
Expand Down Expand Up @@ -1555,7 +1555,7 @@ mod tests {

let (pid, agent) = host.spawn("ok".into(), ()).await.expect("must succeed");
assert_eq!(agent.actor_id().proc_id(), &pid);
assert!(host.procs.contains_key("ok"));
assert!(host.procs.contains("ok"));
}

#[tokio::test]
Expand Down