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

Function New

coderd/aibridged/aibridged.go:53–75  ·  view source on GitHub ↗
(ctx context.Context, pool Pooler, rpcDialer Dialer, logger slog.Logger, tracer trace.Tracer)

Source from the content-addressed store, hash-verified

51}
52
53func New(ctx context.Context, pool Pooler, rpcDialer Dialer, logger slog.Logger, tracer trace.Tracer) (*Server, error) {
54 if rpcDialer == nil {
55 return nil, xerrors.Errorf("nil rpcDialer given")
56 }
57
58 ctx, cancel := context.WithCancel(ctx)
59 daemon := &Server{
60 logger: logger,
61 tracer: tracer,
62 clientDialer: rpcDialer,
63 clientCh: make(chan DRPCClient),
64 lifecycleCtx: ctx,
65 cancelFn: cancel,
66 initConnectionCh: make(chan struct{}),
67
68 requestBridgePool: pool,
69 }
70
71 daemon.wg.Add(1)
72 go daemon.connect()
73
74 return daemon, nil
75}
76
77// Connect establishes a connection to coderd.
78func (s *Server) connect() {

Callers 8

newTestServerFunction · 0.92
TestRoutingFunction · 0.92
newAIBridgeDaemonFunction · 0.92
TestIntegrationFunction · 0.92
startTestAIBridgeDaemonFunction · 0.92

Calls 3

connectMethod · 0.95
AddMethod · 0.65
ErrorfMethod · 0.45

Tested by 7

newTestServerFunction · 0.74
TestRoutingFunction · 0.74
TestIntegrationFunction · 0.74
startTestAIBridgeDaemonFunction · 0.74