mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-14 06:57:31 +00:00
all: construct new System values with an event bus pre-populated
Although, at the moment, we do not yet require an event bus to be present, as we start to add more pieces we will want to ensure it is always available. Add a new constructor and replace existing uses of new(tsd.System) throughout. Update generated files for import changes. Updates #15160 Change-Id: Ie5460985571ade87b8eac8b416948c7f49f0f64b Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
This commit is contained in:

committed by
M. J. Fromberger

parent
6b8bbb4c37
commit
ffb22ee353
@@ -72,6 +72,14 @@ type System struct {
|
||||
userMetricsRegistry usermetric.Registry
|
||||
}
|
||||
|
||||
// NewSystemWithEventBus constructs a new otherwise-empty system with a
|
||||
// freshly-constructed event bus populated.
|
||||
func NewSystemWithEventBus() *System {
|
||||
sys := new(System)
|
||||
sys.Set(eventbus.New())
|
||||
return sys
|
||||
}
|
||||
|
||||
// NetstackImpl is the interface that *netstack.Impl implements.
|
||||
// It's an interface for circular dependency reasons: netstack.Impl
|
||||
// references LocalBackend, and LocalBackend has a tsd.System.
|
||||
|
Reference in New Issue
Block a user