mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-29 07:09:33 +00:00
util/eventbus: add debugger methods to list pub/sub types
This lets debug tools list the types that clients are wielding, so that they can build a dataflow graph and other debugging views. Updates #15160 Signed-off-by: David Anderson <dave@tailscale.com>
This commit is contained in:
committed by
Dave Anderson
parent
e71e95b841
commit
346a35f612
@@ -59,6 +59,20 @@ func (c *Client) peekSubscribeState() *subscribeState {
|
||||
return c.sub
|
||||
}
|
||||
|
||||
func (c *Client) publishTypes() []reflect.Type {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
ret := make([]reflect.Type, 0, len(c.pub))
|
||||
for pub := range c.pub {
|
||||
ret = append(ret, pub.publishType())
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (c *Client) subscribeTypes() []reflect.Type {
|
||||
return c.peekSubscribeState().subscribeTypes()
|
||||
}
|
||||
|
||||
func (c *Client) subscribeState() *subscribeState {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user