MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / PushEvent

Method PushEvent

internal/nodeagent/session.go:106–124  ·  view source on GitHub ↗

PushEvent 实现 Sender。

(reqID, event string, body []byte, seq uint64)

Source from the content-addressed store, hash-verified

104
105// PushEvent 实现 Sender。
106func (s *session) PushEvent(reqID, event string, body []byte, seq uint64) error {
107 if event == "" {
108 return errors.New("nodeagent: PushEvent event is empty")
109 }
110 // 对 usage_push,预先注册 ack 等待槽(即使调用方不 WaitAck 也无副作用)。
111 if event == "usage_push" && seq != 0 {
112 s.mu.Lock()
113 if _, ok := s.acks[seq]; !ok {
114 s.acks[seq] = make(chan struct{})
115 }
116 s.mu.Unlock()
117 }
118 return s.sendRaw(&nodev1.NodeMessage{
119 Id: reqID,
120 Event: event,
121 Body: body,
122 Seq: seq,
123 })
124}
125
126// WaitAck 实现 Sender。
127func (s *session) WaitAck(ctx context.Context, seq uint64) error {

Callers

nothing calls this directly

Calls 1

sendRawMethod · 0.95

Tested by

no test coverage detected