Hub 维护 nodeID → 连接 的注册表,并实现 NodeAgentServer。
| 89 | |
| 90 | // Hub 维护 nodeID → 连接 的注册表,并实现 NodeAgentServer。 |
| 91 | type Hub struct { |
| 92 | nodev1.UnimplementedNodeAgentServer |
| 93 | |
| 94 | logger *slog.Logger |
| 95 | pushHandler PushHandler |
| 96 | peerExtractor PeerExtractor |
| 97 | onNodeConnected func(nodeID, peerIP string) |
| 98 | |
| 99 | deadConnTimeout time.Duration |
| 100 | reaperInterval time.Duration |
| 101 | |
| 102 | mu sync.RWMutex |
| 103 | conns map[string]*conn |
| 104 | |
| 105 | metrics *metrics |
| 106 | } |
| 107 | |
| 108 | type conn struct { |
| 109 | hub *Hub |
nothing calls this directly
no outgoing calls
no test coverage detected