mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: rename Coordinator to CoordinatorV1 (#11222)
Renames the tailnet.Coordinator to represent both v1 and v2 APIs, so that we can use this interface for the main atomic pointer. Part of #10532
This commit is contained in:
+5
-10
@@ -27,6 +27,11 @@ import (
|
||||
// └──────────────────┘ └────────────────────┘ └───────────────────┘ └──────────────────┘
|
||||
// Coordinators have different guarantees for HA support.
|
||||
type Coordinator interface {
|
||||
CoordinatorV1
|
||||
CoordinatorV2
|
||||
}
|
||||
|
||||
type CoordinatorV1 interface {
|
||||
// ServeHTTPDebug serves a debug webpage that shows the internal state of
|
||||
// the coordinator.
|
||||
ServeHTTPDebug(w http.ResponseWriter, r *http.Request)
|
||||
@@ -143,16 +148,6 @@ func NewCoordinator(logger slog.Logger) Coordinator {
|
||||
}
|
||||
}
|
||||
|
||||
// NewCoordinatorV2 constructs a new in-memory connection coordinator. This
|
||||
// coordinator is incompatible with multiple Coder replicas as all node data is
|
||||
// in-memory.
|
||||
func NewCoordinatorV2(logger slog.Logger) CoordinatorV2 {
|
||||
return &coordinator{
|
||||
core: newCore(logger.Named(LoggerName)),
|
||||
closedChan: make(chan struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
// coordinator exchanges nodes with agents to establish connections entirely in-memory.
|
||||
// The Enterprise implementation provides this for high-availability.
|
||||
// ┌──────────────────┐ ┌────────────────────┐ ┌───────────────────┐ ┌──────────────────┐
|
||||
|
||||
@@ -357,7 +357,7 @@ func TestCoordinator_AgentUpdateWhileClientConnects(t *testing.T) {
|
||||
func TestCoordinator_BidirectionalTunnels(t *testing.T) {
|
||||
t.Parallel()
|
||||
logger := slogtest.Make(t, nil).Leveled(slog.LevelDebug)
|
||||
coordinator := tailnet.NewCoordinatorV2(logger)
|
||||
coordinator := tailnet.NewCoordinator(logger)
|
||||
ctx := testutil.Context(t, testutil.WaitShort)
|
||||
test.BidirectionalTunnels(ctx, t, coordinator)
|
||||
}
|
||||
@@ -365,7 +365,7 @@ func TestCoordinator_BidirectionalTunnels(t *testing.T) {
|
||||
func TestCoordinator_GracefulDisconnect(t *testing.T) {
|
||||
t.Parallel()
|
||||
logger := slogtest.Make(t, nil).Leveled(slog.LevelDebug)
|
||||
coordinator := tailnet.NewCoordinatorV2(logger)
|
||||
coordinator := tailnet.NewCoordinator(logger)
|
||||
ctx := testutil.Context(t, testutil.WaitShort)
|
||||
test.GracefulDisconnectTest(ctx, t, coordinator)
|
||||
}
|
||||
@@ -373,7 +373,7 @@ func TestCoordinator_GracefulDisconnect(t *testing.T) {
|
||||
func TestCoordinator_Lost(t *testing.T) {
|
||||
t.Parallel()
|
||||
logger := slogtest.Make(t, nil).Leveled(slog.LevelDebug)
|
||||
coordinator := tailnet.NewCoordinatorV2(logger)
|
||||
coordinator := tailnet.NewCoordinator(logger)
|
||||
ctx := testutil.Context(t, testutil.WaitShort)
|
||||
test.LostTest(ctx, t, coordinator)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user