MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / publish

Method publish

crates/opencode-core/src/bus.rs:47–68  ·  view source on GitHub ↗
(&self, def: &BusEventDef, properties: serde_json::Value)

Source from the content-addressed store, hash-verified

45 }
46
47 pub async fn publish(&self, def: &BusEventDef, properties: serde_json::Value) {
48 tracing::info!(event_type = def.event_type, "publishing event");
49
50 let event = BusEvent {
51 event_type: def.event_type.to_string(),
52 properties: properties.clone(),
53 };
54
55 let _ = self.tx.send(event.clone());
56
57 let subscribers = self.subscribers.read().await;
58 if let Some(subs) = subscribers.get(def.event_type) {
59 for sub in subs {
60 (sub.callback)(def.event_type, properties.clone());
61 }
62 }
63
64 let wildcard = self.wildcard_subscribers.read().await;
65 for sub in wildcard.iter() {
66 (sub.callback)(def.event_type, properties.clone());
67 }
68 }
69
70 pub async fn subscribe<F>(&self, def: &BusEventDef, callback: F) -> u64
71 where

Callers 6

summarizeFunction · 0.80
publish_eventMethod · 0.80
setMethod · 0.80
processMethod · 0.80
updateMethod · 0.80

Calls 4

readMethod · 0.80
cloneMethod · 0.45
sendMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected