MCPcopy Create free account
hub / github.com/dagger/dagger / SpecificClientAttachableConn

Method SpecificClientAttachableConn

engine/server/session.go:1965–1993  ·  view source on GitHub ↗
(ctx context.Context, clientID string, opts core.SpecificClientAttachableConnOpts)

Source from the content-addressed store, hash-verified

1963}
1964
1965func (srv *Server) SpecificClientAttachableConn(ctx context.Context, clientID string, opts core.SpecificClientAttachableConnOpts) (*grpc.ClientConn, bool, error) {
1966 client, err := srv.clientFromContext(ctx)
1967 if err != nil {
1968 return nil, false, err
1969 }
1970
1971 var caller engineutil.SessionCaller
1972 if opts.IfAvailable {
1973 var ok bool
1974 caller, ok = client.daggerSession.attachables.Lookup(clientID)
1975 if !ok {
1976 return nil, false, nil
1977 }
1978 } else {
1979 caller, err = client.getClientCaller(ctx, clientID)
1980 if err != nil {
1981 return nil, false, fmt.Errorf("failed to get session attachable caller for client %q: %w", clientID, err)
1982 }
1983 if caller == nil {
1984 return nil, false, fmt.Errorf("session attachable caller for client %q was nil", clientID)
1985 }
1986 }
1987
1988 conn := caller.Conn()
1989 if conn == nil {
1990 return nil, false, fmt.Errorf("session attachable conn for client %q was nil", clientID)
1991 }
1992 return conn, true, nil
1993}
1994
1995func (srv *Server) sessionMainClientConn(ctx context.Context, sess *daggerSession) (*grpc.ClientConn, error) {
1996 _ = ctx

Callers

nothing calls this directly

Calls 3

clientFromContextMethod · 0.95
ConnMethod · 0.95
LookupMethod · 0.45

Tested by

no test coverage detected