MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / fetch

Method fetch

flow-rs/src/node/port.rs:152–169  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

150 }
151
152 pub async fn fetch(&self) -> Result<(u64, Receiver)> {
153 let fut: Vec<_> = self
154 .brokers
155 .values()
156 .map(|x| x.fetch::<DynConns>())
157 .collect();
158 if let Ok(mut conns) = select_ok(fut).await {
159 let conn = conns.outputs.remove(&self.target).unwrap_or_else(|| {
160 panic!(
161 "port {} not found in graph {:?}",
162 self.target,
163 self.brokers.keys()
164 )
165 });
166 return Ok((conns.name, conn));
167 }
168 Err(anyhow!("broker is closed"))
169 }
170
171 pub async fn fetch_with_cache(&mut self) -> &mut HashMap<u64, Receiver> {
172 if self.cache.is_empty() {

Callers 2

startMethod · 0.45
fetch_with_cacheMethod · 0.45

Calls 2

select_okFunction · 0.85
removeMethod · 0.80

Tested by

no test coverage detected