Documentation
¶
Overview ¶
Package grpc provides gRPC plugin implementations for the go-plugin framework. It includes interceptors for logging and the plugin wrapper types that bridge go-plugin's GRPCPlugin interface with ViewRA's proto services.
Index ¶
- func LoggingInterceptor(logger *slog.Logger) grpc.UnaryServerInterceptor
- func LoggingStreamInterceptor(logger *slog.Logger) grpc.StreamServerInterceptor
- type Enricher
- type EnricherPlugin
- type Factory
- func (f *Factory) GetBrokerID(brokerInfo interface{}) uint32
- func (f *Factory) NewEnricherGRPCPlugin() plugin.Plugin
- func (f *Factory) NewHostDataGRPCPlugin(impl manager.HostDataServer, logger *slog.Logger) plugin.Plugin
- func (f *Factory) NewHostPluginsGRPCPlugin(impl manager.HostPluginsServer, logger *slog.Logger) plugin.Plugin
- func (f *Factory) NewHostProgressGRPCPlugin(impl manager.HostProgressServer, logger *slog.Logger) plugin.Plugin
- func (f *Factory) NewHostRatingsGRPCPlugin(impl manager.HostRatingsServer, logger *slog.Logger) plugin.Plugin
- func (f *Factory) NewHostStorageGRPCPlugin(impl manager.HostStorageServer, pluginID string, logger *slog.Logger) plugin.Plugin
- func (f *Factory) NewHostWeatherGRPCPlugin(impl manager.HostWeatherServer, logger *slog.Logger) plugin.Plugin
- func (f *Factory) NewPluginCoreGRPCPlugin() plugin.Plugin
- func (f *Factory) NewPluginProviderGRPCPlugin() plugin.Plugin
- func (f *Factory) NewTrendingProviderGRPCPlugin() plugin.Plugin
- func (f *Factory) NewVectorSearchGRPCPlugin() plugin.Plugin
- type HostDataBrokerInfo
- type HostDataPlugin
- type HostPluginsBrokerInfo
- type HostPluginsPlugin
- type HostProgressBrokerInfo
- type HostProgressPlugin
- type HostRatingsBrokerInfo
- type HostRatingsPlugin
- type HostStorageBrokerInfo
- type HostStoragePlugin
- type HostWeatherBrokerInfo
- type HostWeatherPlugin
- type PluginCorePlugin
- type PluginProviderPlugin
- type TrendingProviderPlugin
- type VectorSearchPlugin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoggingInterceptor ¶
func LoggingInterceptor(logger *slog.Logger) grpc.UnaryServerInterceptor
LoggingInterceptor returns a gRPC unary server interceptor that logs all requests and errors for host services called by plugins.
func LoggingStreamInterceptor ¶
func LoggingStreamInterceptor(logger *slog.Logger) grpc.StreamServerInterceptor
LoggingStreamInterceptor returns a gRPC stream server interceptor that logs stream lifecycle events and errors for host services called by plugins.
Types ¶
type Enricher ¶
type Enricher struct {
// contains filtered or unexported fields
}
Enricher wraps a gRPC EnricherClient to implement the application Enricher interface. This allows external plugins (go-plugin processes) to be used as enrichers.
Since the Enricher interface now uses proto types directly, this wrapper is minimal - it just stores capabilities and delegates calls to the gRPC client.
func NewEnricher ¶
func NewEnricher(pluginID string, client pluginv1.EnricherClient, logger *slog.Logger) (*Enricher, error)
NewEnricher creates a new Enricher wrapping the given client.
func (*Enricher) Capabilities ¶
func (e *Enricher) Capabilities() enrichment.EnricherCapabilities
Capabilities implements enrichment.Enricher.
func (*Enricher) Enrich ¶
func (e *Enricher) Enrich(ctx context.Context, req *pluginv1.EnrichRequest) (*pluginv1.EnrichResponse, error)
Enrich implements enrichment.Enricher. Since we now use proto types directly, this is just a pass-through.
type EnricherPlugin ¶
type EnricherPlugin struct {
plugin.Plugin
// Impl is only used when serving (plugin side)
Impl pluginv1.EnricherServer
}
EnricherPlugin is the go-plugin implementation for the Enricher service.
func (*EnricherPlugin) GRPCClient ¶
func (p *EnricherPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*EnricherPlugin) GRPCServer ¶
func (p *EnricherPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type Factory ¶
type Factory struct{}
Factory implements the manager.PluginFactory interface. It creates go-plugin Plugin instances for the plugin manager.
func (*Factory) GetBrokerID ¶
GetBrokerID extracts the broker ID from a dispensed broker info struct.
func (*Factory) NewEnricherGRPCPlugin ¶
NewEnricherGRPCPlugin creates a new EnricherPlugin.
func (*Factory) NewHostDataGRPCPlugin ¶
func (f *Factory) NewHostDataGRPCPlugin(impl manager.HostDataServer, logger *slog.Logger) plugin.Plugin
NewHostDataGRPCPlugin creates a new HostDataPlugin. The impl parameter is a marker interface from manager package.
func (*Factory) NewHostPluginsGRPCPlugin ¶
func (f *Factory) NewHostPluginsGRPCPlugin(impl manager.HostPluginsServer, logger *slog.Logger) plugin.Plugin
NewHostPluginsGRPCPlugin creates a new HostPluginsPlugin. The impl parameter is a marker interface from manager package.
func (*Factory) NewHostProgressGRPCPlugin ¶
func (f *Factory) NewHostProgressGRPCPlugin(impl manager.HostProgressServer, logger *slog.Logger) plugin.Plugin
NewHostProgressGRPCPlugin creates a new HostProgressPlugin. The impl parameter is a marker interface from manager package.
func (*Factory) NewHostRatingsGRPCPlugin ¶
func (f *Factory) NewHostRatingsGRPCPlugin(impl manager.HostRatingsServer, logger *slog.Logger) plugin.Plugin
NewHostRatingsGRPCPlugin creates a new HostRatingsPlugin. The impl parameter is a marker interface from manager package.
func (*Factory) NewHostStorageGRPCPlugin ¶
func (f *Factory) NewHostStorageGRPCPlugin(impl manager.HostStorageServer, pluginID string, logger *slog.Logger) plugin.Plugin
NewHostStorageGRPCPlugin creates a new HostStoragePlugin. The impl parameter is a marker interface from manager package.
func (*Factory) NewHostWeatherGRPCPlugin ¶
func (f *Factory) NewHostWeatherGRPCPlugin(impl manager.HostWeatherServer, logger *slog.Logger) plugin.Plugin
NewHostWeatherGRPCPlugin creates a new HostWeatherPlugin. The impl parameter is a marker interface from manager package.
func (*Factory) NewPluginCoreGRPCPlugin ¶
NewPluginCoreGRPCPlugin creates a new PluginCorePlugin.
func (*Factory) NewPluginProviderGRPCPlugin ¶
NewPluginProviderGRPCPlugin creates a new PluginProviderPlugin.
func (*Factory) NewTrendingProviderGRPCPlugin ¶
NewTrendingProviderGRPCPlugin creates a new TrendingProviderPlugin for client-side dispensing. This is a client-only plugin - the plugin side serves TrendingProviderService, host side gets client.
func (*Factory) NewVectorSearchGRPCPlugin ¶
NewVectorSearchGRPCPlugin creates a new VectorSearchPlugin for client-side dispensing. This is a client-only plugin - the plugin side serves VectorSearch, host side gets client.
type HostDataBrokerInfo ¶
type HostDataBrokerInfo struct {
BrokerID uint32
}
HostDataBrokerInfo contains the broker ID for connecting to the host data service.
type HostDataPlugin ¶
HostDataPlugin is the go-plugin implementation for the HostData service. On the host side, this starts a gRPC server on a broker ID that the plugin can connect to.
func (*HostDataPlugin) GRPCClient ¶
func (p *HostDataPlugin) GRPCClient( ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn, ) (interface{}, error)
func (*HostDataPlugin) GRPCServer ¶
func (p *HostDataPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type HostPluginsBrokerInfo ¶
type HostPluginsBrokerInfo struct {
BrokerID uint32
}
HostPluginsBrokerInfo contains the broker ID for connecting to the host plugins service.
type HostPluginsPlugin ¶
HostPluginsPlugin is the go-plugin implementation for the HostPlugins service. On the host side, this starts a gRPC server on a broker ID that the plugin can connect to. This provides capability-based plugin discovery for inter-plugin communication.
func (*HostPluginsPlugin) GRPCClient ¶
func (p *HostPluginsPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*HostPluginsPlugin) GRPCServer ¶
func (p *HostPluginsPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type HostProgressBrokerInfo ¶
type HostProgressBrokerInfo struct {
BrokerID uint32
}
HostProgressBrokerInfo contains the broker ID for connecting to the host progress service.
type HostProgressPlugin ¶
type HostProgressPlugin struct {
plugin.Plugin
Impl pluginv1.HostProgressServer
Logger *slog.Logger
}
HostProgressPlugin is the go-plugin implementation for the HostProgress service. On the host side, this starts a gRPC server on a broker ID that the plugin can connect to. This provides read-only access to user watch progress for recommendations.
func (*HostProgressPlugin) GRPCClient ¶
func (p *HostProgressPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*HostProgressPlugin) GRPCServer ¶
func (p *HostProgressPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type HostRatingsBrokerInfo ¶
type HostRatingsBrokerInfo struct {
BrokerID uint32
}
HostRatingsBrokerInfo contains the broker ID for connecting to the host ratings service.
type HostRatingsPlugin ¶
HostRatingsPlugin is the go-plugin implementation for the HostRatings service. On the host side, this starts a gRPC server on a broker ID that the plugin can connect to. This provides read-only access to user ratings for recommendations.
func (*HostRatingsPlugin) GRPCClient ¶
func (p *HostRatingsPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*HostRatingsPlugin) GRPCServer ¶
func (p *HostRatingsPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type HostStorageBrokerInfo ¶
type HostStorageBrokerInfo struct {
BrokerID uint32
}
HostStorageBrokerInfo contains the broker ID for connecting to the host storage service.
type HostStoragePlugin ¶
type HostStoragePlugin struct {
plugin.Plugin
Impl pluginv1.HostStorageServer
PluginID string // The ID of the plugin that this storage is for
Logger *slog.Logger
}
HostStoragePlugin is the go-plugin implementation for the HostStorage service. On the host side, this starts a gRPC server on a broker ID that the plugin can connect to.
func (*HostStoragePlugin) GRPCClient ¶
func (p *HostStoragePlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*HostStoragePlugin) GRPCServer ¶
func (p *HostStoragePlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type HostWeatherBrokerInfo ¶
type HostWeatherBrokerInfo struct {
BrokerID uint32
}
HostWeatherBrokerInfo contains the broker ID for connecting to the host weather service.
type HostWeatherPlugin ¶
HostWeatherPlugin is the go-plugin implementation for the HostWeather service. On the host side, this starts a gRPC server on a broker ID that the plugin can connect to. This provides weather context for search query enrichment.
func (*HostWeatherPlugin) GRPCClient ¶
func (p *HostWeatherPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*HostWeatherPlugin) GRPCServer ¶
func (p *HostWeatherPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type PluginCorePlugin ¶
type PluginCorePlugin struct {
plugin.Plugin
// Impl is only used when serving (plugin side)
Impl pluginv1.PluginCoreServer
}
PluginCorePlugin is the go-plugin implementation for the PluginCore service. This is used by the host to communicate with plugins.
func (*PluginCorePlugin) GRPCClient ¶
func (p *PluginCorePlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*PluginCorePlugin) GRPCServer ¶
func (p *PluginCorePlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type PluginProviderPlugin ¶
PluginProviderPlugin is the go-plugin implementation for the PluginProvider service. This allows the host to call the plugin's provider methods (chat, embeddings, etc.). Provider plugins implement this service.
func (*PluginProviderPlugin) GRPCClient ¶
func (p *PluginProviderPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*PluginProviderPlugin) GRPCServer ¶
func (p *PluginProviderPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type TrendingProviderPlugin ¶
TrendingProviderPlugin is the go-plugin implementation for the TrendingProviderService. On the host side, this is used to dispense a client for calling the plugin's trending methods. The plugin serves this service; the host is a client only.
func (*TrendingProviderPlugin) GRPCClient ¶
func (p *TrendingProviderPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*TrendingProviderPlugin) GRPCServer ¶
func (p *TrendingProviderPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type VectorSearchPlugin ¶
VectorSearchPlugin is the go-plugin implementation for the VectorSearch service. On the host side, this is used to dispense a client for calling the plugin's VectorSearch methods. The plugin serves this service; the host is a client only.
func (*VectorSearchPlugin) GRPCClient ¶
func (p *VectorSearchPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*VectorSearchPlugin) GRPCServer ¶
func (p *VectorSearchPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error