grpc

package
v0.0.0-...-1e0776f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 10 Imported by: 0

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

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

Enrich implements enrichment.Enricher. Since we now use proto types directly, this is just a pass-through.

func (*Enricher) Stage

func (e *Enricher) Stage() string

Stage implements enrichment.Enricher.

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 NewFactory

func NewFactory() *Factory

NewFactory creates a new plugin factory.

func (*Factory) GetBrokerID

func (f *Factory) GetBrokerID(brokerInfo interface{}) uint32

GetBrokerID extracts the broker ID from a dispensed broker info struct.

func (*Factory) NewEnricherGRPCPlugin

func (f *Factory) NewEnricherGRPCPlugin() plugin.Plugin

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

func (f *Factory) NewPluginCoreGRPCPlugin() plugin.Plugin

NewPluginCoreGRPCPlugin creates a new PluginCorePlugin.

func (*Factory) NewPluginProviderGRPCPlugin

func (f *Factory) NewPluginProviderGRPCPlugin() plugin.Plugin

NewPluginProviderGRPCPlugin creates a new PluginProviderPlugin.

func (*Factory) NewTrendingProviderGRPCPlugin

func (f *Factory) NewTrendingProviderGRPCPlugin() plugin.Plugin

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

func (f *Factory) NewVectorSearchGRPCPlugin() plugin.Plugin

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

type HostDataPlugin struct {
	plugin.Plugin
	Impl   pluginv1.HostDataServer
	Logger *slog.Logger
}

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

type HostPluginsPlugin struct {
	plugin.Plugin
	Impl   pluginv1.HostPluginsServer
	Logger *slog.Logger
}

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

type HostRatingsPlugin struct {
	plugin.Plugin
	Impl   pluginv1.HostRatingsServer
	Logger *slog.Logger
}

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

type HostWeatherPlugin struct {
	plugin.Plugin
	Impl   pluginv1.HostWeatherServer
	Logger *slog.Logger
}

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

type PluginProviderPlugin struct {
	plugin.Plugin
}

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

type TrendingProviderPlugin struct {
	plugin.Plugin
}

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

type VectorSearchPlugin struct {
	plugin.Plugin
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL