MCPcopy Create free account
hub / github.com/clouditor/clouditor / NewRPCConnection

Function NewRPCConnection

api/connection.go:73–81  ·  view source on GitHub ↗

NewRPCConnection creates a new [RPCConnection] to the target using the specified function that creates a new client.

(target string, newClientFunc func(cc grpc.ClientConnInterface) T, opts ...grpc.DialOption)

Source from the content-addressed store, hash-verified

71
72// NewRPCConnection creates a new [RPCConnection] to the target using the specified function that creates a new client.
73func NewRPCConnection[T any](target string, newClientFunc func(cc grpc.ClientConnInterface) T, opts ...grpc.DialOption) *RPCConnection[T] {
74 conn := &RPCConnection[T]{
75 Target: target,
76 Opts: opts,
77 }
78 conn.Client = newClientFunc(conn)
79
80 return conn
81}
82
83// ForceReconnect drops the established gRPC client conn and forces a re-connect at the next client call.
84func (conn *RPCConnection[T]) ForceReconnect() {

Calls

no outgoing calls