hyperactor/testing/
ids.rs1use crate::channel::ChannelAddr;
15use crate::channel::ChannelTransport;
16use crate::reference;
17
18pub fn test_proc_id(name: &str) -> reference::ProcId {
20 reference::ProcId::with_name(
21 ChannelAddr::any(ChannelTransport::Local),
22 format!("test_{name}"),
23 )
24}
25
26pub fn test_proc_id_with_addr(addr: ChannelAddr, name: &str) -> reference::ProcId {
28 reference::ProcId::with_name(addr, format!("test_{name}"))
29}
30
31pub fn test_actor_id(proc_name: &str, actor_name: &str) -> reference::ActorId {
33 test_proc_id(proc_name).actor_id(actor_name, 0)
34}
35
36pub fn test_actor_id_with_pid(proc_name: &str, actor_name: &str, pid: usize) -> reference::ActorId {
38 test_proc_id(proc_name).actor_id(actor_name, pid)
39}
40
41pub fn test_port_id(proc_name: &str, actor_name: &str, port: u64) -> reference::PortId {
43 reference::PortId::new(test_actor_id(proc_name, actor_name), port)
44}
45
46pub fn test_port_id_with_pid(
48 proc_name: &str,
49 actor_name: &str,
50 pid: usize,
51 port: u64,
52) -> reference::PortId {
53 reference::PortId::new(test_actor_id_with_pid(proc_name, actor_name, pid), port)
54}