Documentation
¶
Index ¶
- Variables
- type PluginOption
- func WithCustomLogger(logger hclog.Logger) PluginOption
- func WithLogger(level hclog.Level) PluginOption
- func WithServiceName(serviceName string) PluginOption
- func WithServiceVersion(serviceVersion string) PluginOption
- func WithTestConfig(testConfig *plugin.ServeTestConfig) PluginOption
- func WithTracing() PluginOption
- func WithTracingErrorHandler(errHandler func(err error)) PluginOption
- type RouterPlugin
Constants ¶
This section is empty.
Variables ¶
var PluginMapName = "grpc_datasource"
PluginMapName is the name of the plugin in the plugin map.
var RouterPluginHandshakeConfig = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "GRPC_DATASOURCE_PLUGIN",
MagicCookieValue: "GRPC_DATASOURCE_PLUGIN",
}
HandshakeConfig is the handshake config for the plugin.
Functions ¶
This section is empty.
Types ¶
type PluginOption ¶
type PluginOption func(*RouterPlugin)
func WithCustomLogger ¶
func WithCustomLogger(logger hclog.Logger) PluginOption
WithCustomLogger sets the logger to the provided logger. This is useful for when you want to use a custom logger. For example, when you want to use a custom logger for the plugin.
func WithLogger ¶
func WithLogger(level hclog.Level) PluginOption
WithLogger configures a plugin logger at the provided level. The `level` parameter is the level of the logger.
func WithServiceName ¶
func WithServiceName(serviceName string) PluginOption
WithServiceName sets the service name for the plugin.
func WithServiceVersion ¶
func WithServiceVersion(serviceVersion string) PluginOption
WithServiceVersion sets the service version for the plugin.
func WithTestConfig ¶
func WithTestConfig(testConfig *plugin.ServeTestConfig) PluginOption
func WithTracing ¶
func WithTracing() PluginOption
WithTracing enables tracing for the plugin. This includes creating a tracing interceptor
func WithTracingErrorHandler ¶
func WithTracingErrorHandler(errHandler func(err error)) PluginOption
WithTracingErrorHandler sets the tracing error handler for the plugin.
type RouterPlugin ¶
func NewRouterPlugin ¶
func NewRouterPlugin(registrationfunc func(*grpc.Server), opts ...PluginOption) (*RouterPlugin, error)
func (*RouterPlugin) GRPCClient ¶
func (p *RouterPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, cc *grpc.ClientConn) (interface{}, error)
GRPCClient is the interface that is implemented to serve/connect to a plugin over gRPC.
func (*RouterPlugin) GRPCServer ¶
func (p *RouterPlugin) GRPCServer(_ *plugin.GRPCBroker, server *grpc.Server) error
GRPCPlugin is the interface that is implemented to serve/connect to a plugin over gRPC.
func (*RouterPlugin) Serve ¶
func (r *RouterPlugin) Serve()