MCPcopy Index your code
hub / github.com/coder/coder / NewInMemoryCoordinatorClient

Function NewInMemoryCoordinatorClient

tailnet/controllers.go:612–629  ·  view source on GitHub ↗

NewInMemoryCoordinatorClient creates a coordination client that uses channels to connect to a local Coordinator. (The typical alternative is a DRPC-based client.)

(
	logger slog.Logger,
	clientID uuid.UUID,
	auth CoordinateeAuth,
	coordinator Coordinator,
)

Source from the content-addressed store, hash-verified

610// NewInMemoryCoordinatorClient creates a coordination client that uses channels to connect to a
611// local Coordinator. (The typical alternative is a DRPC-based client.)
612func NewInMemoryCoordinatorClient(
613 logger slog.Logger,
614 clientID uuid.UUID,
615 auth CoordinateeAuth,
616 coordinator Coordinator,
617) CoordinatorClient {
618 logger = logger.With(slog.F("client_id", clientID))
619 c := &inMemoryCoordClient{logger: logger}
620 c.ctx, c.cancel = context.WithCancel(context.Background())
621
622 // use the background context since we will depend exclusively on closing the req channel to
623 // tell the coordinator we are done.
624 c.reqs, c.resps = coordinator.Coordinate(context.Background(),
625 clientID, fmt.Sprintf("inmemory%s", clientID),
626 auth,
627 )
628 return c
629}
630
631type DERPMapSetter interface {
632 SetDERPMap(derpMap *tailcfg.DERPMap)

Callers 4

DialMethod · 0.92
TestInMemoryCoordinationFunction · 0.92
TestAgent_UpdatedDERPFunction · 0.92
setupAgentWithSecretsFunction · 0.92

Calls 1

CoordinateMethod · 0.65

Tested by 3

TestInMemoryCoordinationFunction · 0.74
TestAgent_UpdatedDERPFunction · 0.74
setupAgentWithSecretsFunction · 0.74