Documentation
¶
Index ¶
- Constants
- func AddServiceDiscoveryCallback(serviceName string, ...)
- func Discover(ctx context.Context) error
- func GetSocketFolderPath() string
- func SocketDial(ctx context.Context, socket string, additionalOpts ...grpc.DialOption) (*grpc.ClientConn, error)
- type GRPCClient
- type GRPCConnectionDialer
- type GRPCConnector
Constants ¶
const (
SocketFolderEnvVar = "DAPR_COMPONENTS_SOCKETS_FOLDER"
)
Variables ¶
This section is empty.
Functions ¶
func AddServiceDiscoveryCallback ¶
func AddServiceDiscoveryCallback(serviceName string, callbackFunc func(name string, dialer GRPCConnectionDialer))
AddServiceDiscoveryCallback adds a callback function that should be called when the given service was discovered.
func Discover ¶
Discover discover the pluggable components and callback the service discovery with the given component name and grpc dialer.
func GetSocketFolderPath ¶
func GetSocketFolderPath() string
GetSocketFolderPath returns the shared unix domain socket folder path
func SocketDial ¶
func SocketDial(ctx context.Context, socket string, additionalOpts ...grpc.DialOption) (*grpc.ClientConn, error)
SocketDial creates a grpc connection using the given socket.
Types ¶
type GRPCClient ¶
type GRPCClient interface { // Ping is for liveness purposes. Ping(ctx context.Context, in *proto.PingRequest, opts ...grpc.CallOption) (*proto.PingResponse, error) }
GRPCClient is any client that supports common pluggable grpc operations.
type GRPCConnectionDialer ¶
type GRPCConnector ¶
type GRPCConnector[TClient GRPCClient] struct { // Context is the component shared context Context context.Context // Cancel is used for cancelling inflight requests Cancel context.CancelFunc // Client is the proto client. Client TClient // contains filtered or unexported fields }
GRPCConnector is a connector that uses underlying gRPC protocol for common operations.
func NewGRPCConnector ¶
func NewGRPCConnector[TClient GRPCClient](socket string, factory func(grpc.ClientConnInterface) TClient) *GRPCConnector[TClient]
NewGRPCConnector creates a new grpc connector for the given client factory and socket.
func NewGRPCConnectorWithDialer ¶
func NewGRPCConnectorWithDialer[TClient GRPCClient](dialer GRPCConnectionDialer, factory func(grpc.ClientConnInterface) TClient) *GRPCConnector[TClient]
NewGRPCConnectorWithDialer creates a new grpc connector for the given client factory and dialer.
func (*GRPCConnector[TClient]) Close ¶
func (g *GRPCConnector[TClient]) Close() error
Close closes the underlying gRPC connection and cancel all inflight requests.
func (*GRPCConnector[TClient]) Dial ¶
func (g *GRPCConnector[TClient]) Dial(name string) error
Dial opens a grpcConnection and creates a new client instance.
func (*GRPCConnector[TClient]) Ping ¶
func (g *GRPCConnector[TClient]) Ping() error
Ping pings the grpc component. It uses "WaitForReady" avoiding failing in transient failures.