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

Struct MultiPushHandler

internal/nodehub/multihandler.go:19–24  ·  view source on GitHub ↗

MultiPushHandler 是一个把 PushHandler 各事件分发到多个独立闭包的复合实现。 nodehub 的 PushHandler 是单一接口,但实际有多个业务模块需要消费不同事件 (self-sync 关心 OnHello、SSE bridge 关心 OnLog/OnTracerouteHop、usage 接收器关心 OnUsagePush)。MultiPushHandler 提供一个零依赖的扇出装配点: hub := nodehub.New(nodehub.Options{ PushHandler: &nodehub.MultiPushHandler{

Source from the content-addressed store, hash-verified

17//
18// 任意字段为 nil 时该事件 no-op(OnUsagePush 返回 nil 触发 ack)。
19type MultiPushHandler struct {
20 HelloHandler func(nodeID string, body []byte)
21 UsagePushHandler func(nodeID string, seq uint64, body []byte) error
22 LogHandler func(nodeID, reqID string, body []byte)
23 TracerouteHopHandler func(nodeID, reqID string, body []byte)
24}
25
26var _ PushHandler = (*MultiPushHandler)(nil)
27

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected