Documentation
¶
Index ¶
- Constants
- Variables
- type GRPCProviderServer
- func (s *GRPCProviderServer) CheckEngine(ctx context.Context, req *protocol.CheckEngineRequest) (*protocol.CheckEngineResponse, error)
- func (s *GRPCProviderServer) DeleteModel(ctx context.Context, req *protocol.DeleteModelRequest) (*protocol.DeleteModelResponse, error)
- func (s *GRPCProviderServer) GetConfig(ctx context.Context, req *protocol.GetConfigRequest) (*protocol.GetConfigResponse, error)
- func (s *GRPCProviderServer) GetManifest(ctx context.Context, req *protocol.GetManifestRequest) (*protocol.GetManifestResponse, error)
- func (s *GRPCProviderServer) GetOperateStatus(ctx context.Context, req *protocol.GetOperateStatusRequest) (*protocol.GetOperateStatusResponse, error)
- func (s *GRPCProviderServer) GetRunningModels(ctx context.Context, req *protocol.GetRunningModelsRequest) (*protocol.GetRunningModelsResponse, error)
- func (s *GRPCProviderServer) GetVersion(ctx context.Context, req *protocol.GetVersionRequest) (*protocol.GetVersionResponse, error)
- func (s *GRPCProviderServer) HealthCheck(ctx context.Context, req *protocol.HealthCheckRequest) (*protocol.HealthCheckResponse, error)
- func (s *GRPCProviderServer) InitEnv(ctx context.Context, req *protocol.InitEnvRequest) (*protocol.InitEnvResponse, error)
- func (s *GRPCProviderServer) InstallEngine(ctx context.Context, req *protocol.InstallEngineRequest) (*protocol.InstallEngineResponse, error)
- func (s *GRPCProviderServer) InvokeService(ctx context.Context, req *protocol.InvokeServiceRequest) (*protocol.InvokeServiceResponse, error)
- func (s *GRPCProviderServer) InvokeServiceBidi(stream protocol.ProviderService_InvokeServiceBidiServer) error
- func (s *GRPCProviderServer) InvokeServiceStream(req *protocol.InvokeServiceRequest, ...) error
- func (s *GRPCProviderServer) ListModels(ctx context.Context, req *protocol.ListModelsRequest) (*protocol.ListModelsResponse, error)
- func (s *GRPCProviderServer) LoadModel(ctx context.Context, req *protocol.LoadModelRequest) (*protocol.LoadModelResponse, error)
- func (s *GRPCProviderServer) PullModel(ctx context.Context, req *protocol.PullModelRequest) (*protocol.PullModelResponse, error)
- func (s *GRPCProviderServer) PullModelStream(req *protocol.PullModelStreamRequest, ...) error
- func (s *GRPCProviderServer) RefreshAuth(ctx context.Context, req *protocol.RefreshAuthRequest) (*protocol.RefreshAuthResponse, error)
- func (s *GRPCProviderServer) SetAuth(ctx context.Context, req *protocol.SetAuthRequest) (*protocol.SetAuthResponse, error)
- func (s *GRPCProviderServer) SetOperateStatus(ctx context.Context, req *protocol.SetOperateStatusRequest) (*protocol.SetOperateStatusResponse, error)
- func (s *GRPCProviderServer) StartEngine(ctx context.Context, req *protocol.StartEngineRequest) (*protocol.StartEngineResponse, error)
- func (s *GRPCProviderServer) StopEngine(ctx context.Context, req *protocol.StopEngineRequest) (*protocol.StopEngineResponse, error)
- func (s *GRPCProviderServer) UnloadModel(ctx context.Context, req *protocol.UnloadModelRequest) (*protocol.UnloadModelResponse, error)
- func (s *GRPCProviderServer) UpgradeEngine(ctx context.Context, req *protocol.UpgradeEngineRequest) (*protocol.UpgradeEngineResponse, error)
- func (s *GRPCProviderServer) ValidateAuth(ctx context.Context, req *protocol.ValidateAuthRequest) (*protocol.ValidateAuthResponse, error)
- type LocalPluginProvider
- type PluginProvider
- type ProviderPlugin
- type RemotePluginProvider
Constants ¶
const PluginTypeProvider = "provider"
PluginTypeProvider is the identifier for Provider plugins. Used to register and look up plugins in PluginMap.
Variables ¶
var DefaultHandshake = PluginHandshake
DefaultHandshake is an alias of PluginHandshake for backward compatibility.
var PluginHandshake = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "AOG_PLUGIN",
MagicCookieValue: "aog-provider-plugin-v1",
}
PluginHandshake defines the plugin handshake configuration. Host and Plugin must use the same handshake configuration to communicate.
This is go-plugin's security mechanism to ensure only compatible plugins can be loaded.
var PluginMap = map[string]plugin.Plugin{ PluginTypeProvider: &ProviderPlugin{}, }
PluginMap defines the plugin type mapping.
This is the core mechanism of go-plugin:
- Host side uses this map to find and connect to plugins
- Plugin side uses this map to register services
CRITICAL: Host and Plugin MUST use the exact same PluginMap instance! This is why this definition must be in the SDK, not separately in Host and Plugin.
Functions ¶
This section is empty.
Types ¶
type GRPCProviderServer ¶
type GRPCProviderServer struct {
protocol.UnimplementedProviderServiceServer
BasePlugin PluginProvider
LocalPlugin LocalPluginProvider
RemotePlugin RemotePluginProvider
}
GRPCProviderServer is the gRPC server implementation on the plugin side.
func NewGRPCProviderServer ¶
func NewGRPCProviderServer(impl interface{}) *GRPCProviderServer
NewGRPCProviderServer creates a gRPC server.
The parameter can be any type that implements PluginProvider-related interfaces.
func (*GRPCProviderServer) CheckEngine ¶
func (s *GRPCProviderServer) CheckEngine(ctx context.Context, req *protocol.CheckEngineRequest) (*protocol.CheckEngineResponse, error)
CheckEngine checks if the engine is installed (Local plugin only).
func (*GRPCProviderServer) DeleteModel ¶
func (s *GRPCProviderServer) DeleteModel(ctx context.Context, req *protocol.DeleteModelRequest) (*protocol.DeleteModelResponse, error)
DeleteModel deletes a model (Local plugin only).
func (*GRPCProviderServer) GetConfig ¶
func (s *GRPCProviderServer) GetConfig(ctx context.Context, req *protocol.GetConfigRequest) (*protocol.GetConfigResponse, error)
GetConfig returns the engine configuration (Local plugin only).
func (*GRPCProviderServer) GetManifest ¶
func (s *GRPCProviderServer) GetManifest(ctx context.Context, req *protocol.GetManifestRequest) (*protocol.GetManifestResponse, error)
GetManifest returns the plugin metadata.
func (*GRPCProviderServer) GetOperateStatus ¶
func (s *GRPCProviderServer) GetOperateStatus(ctx context.Context, req *protocol.GetOperateStatusRequest) (*protocol.GetOperateStatusResponse, error)
GetOperateStatus returns the operational status.
func (*GRPCProviderServer) GetRunningModels ¶
func (s *GRPCProviderServer) GetRunningModels(ctx context.Context, req *protocol.GetRunningModelsRequest) (*protocol.GetRunningModelsResponse, error)
GetRunningModels returns all running models (Local plugin only).
func (*GRPCProviderServer) GetVersion ¶
func (s *GRPCProviderServer) GetVersion(ctx context.Context, req *protocol.GetVersionRequest) (*protocol.GetVersionResponse, error)
GetVersion returns the engine version (Local plugin only).
func (*GRPCProviderServer) HealthCheck ¶
func (s *GRPCProviderServer) HealthCheck(ctx context.Context, req *protocol.HealthCheckRequest) (*protocol.HealthCheckResponse, error)
HealthCheck performs a health check.
func (*GRPCProviderServer) InitEnv ¶
func (s *GRPCProviderServer) InitEnv(ctx context.Context, req *protocol.InitEnvRequest) (*protocol.InitEnvResponse, error)
InitEnv initializes environment variables (Local plugin only).
func (*GRPCProviderServer) InstallEngine ¶
func (s *GRPCProviderServer) InstallEngine(ctx context.Context, req *protocol.InstallEngineRequest) (*protocol.InstallEngineResponse, error)
InstallEngine installs the engine (Local plugin only).
func (*GRPCProviderServer) InvokeService ¶
func (s *GRPCProviderServer) InvokeService(ctx context.Context, req *protocol.InvokeServiceRequest) (*protocol.InvokeServiceResponse, error)
InvokeService invokes a plugin service.
func (*GRPCProviderServer) InvokeServiceBidi ¶
func (s *GRPCProviderServer) InvokeServiceBidi(stream protocol.ProviderService_InvokeServiceBidiServer) error
InvokeServiceBidi handles bidirectional streaming invocation
func (*GRPCProviderServer) InvokeServiceStream ¶
func (s *GRPCProviderServer) InvokeServiceStream(req *protocol.InvokeServiceRequest, stream protocol.ProviderService_InvokeServiceStreamServer) error
InvokeServiceStream performs server-side streaming invocation.
func (*GRPCProviderServer) ListModels ¶
func (s *GRPCProviderServer) ListModels(ctx context.Context, req *protocol.ListModelsRequest) (*protocol.ListModelsResponse, error)
ListModels lists all models (Local plugin only).
func (*GRPCProviderServer) LoadModel ¶
func (s *GRPCProviderServer) LoadModel(ctx context.Context, req *protocol.LoadModelRequest) (*protocol.LoadModelResponse, error)
LoadModel loads a model into memory (Local plugin only).
func (*GRPCProviderServer) PullModel ¶
func (s *GRPCProviderServer) PullModel(ctx context.Context, req *protocol.PullModelRequest) (*protocol.PullModelResponse, error)
PullModel pulls a model (Local plugin only).
func (*GRPCProviderServer) PullModelStream ¶
func (s *GRPCProviderServer) PullModelStream(req *protocol.PullModelStreamRequest, stream protocol.ProviderService_PullModelStreamServer) error
PullModelStream pulls a model with streaming (Local plugin only).
func (*GRPCProviderServer) RefreshAuth ¶
func (s *GRPCProviderServer) RefreshAuth(ctx context.Context, req *protocol.RefreshAuthRequest) (*protocol.RefreshAuthResponse, error)
RefreshAuth refreshes authentication information (Remote plugin only).
func (*GRPCProviderServer) SetAuth ¶
func (s *GRPCProviderServer) SetAuth(ctx context.Context, req *protocol.SetAuthRequest) (*protocol.SetAuthResponse, error)
SetAuth sets authentication information (Remote plugin only).
func (*GRPCProviderServer) SetOperateStatus ¶
func (s *GRPCProviderServer) SetOperateStatus(ctx context.Context, req *protocol.SetOperateStatusRequest) (*protocol.SetOperateStatusResponse, error)
SetOperateStatus sets the operational status.
func (*GRPCProviderServer) StartEngine ¶
func (s *GRPCProviderServer) StartEngine(ctx context.Context, req *protocol.StartEngineRequest) (*protocol.StartEngineResponse, error)
StartEngine starts the engine (Local plugin only).
func (*GRPCProviderServer) StopEngine ¶
func (s *GRPCProviderServer) StopEngine(ctx context.Context, req *protocol.StopEngineRequest) (*protocol.StopEngineResponse, error)
StopEngine stops the engine (Local plugin only).
func (*GRPCProviderServer) UnloadModel ¶
func (s *GRPCProviderServer) UnloadModel(ctx context.Context, req *protocol.UnloadModelRequest) (*protocol.UnloadModelResponse, error)
UnloadModel unloads models from memory (Local plugin only).
func (*GRPCProviderServer) UpgradeEngine ¶
func (s *GRPCProviderServer) UpgradeEngine(ctx context.Context, req *protocol.UpgradeEngineRequest) (*protocol.UpgradeEngineResponse, error)
UpgradeEngine upgrades the engine (Local plugin only).
func (*GRPCProviderServer) ValidateAuth ¶
func (s *GRPCProviderServer) ValidateAuth(ctx context.Context, req *protocol.ValidateAuthRequest) (*protocol.ValidateAuthResponse, error)
ValidateAuth validates authentication information (Remote plugin only).
type LocalPluginProvider ¶
type LocalPluginProvider = client.LocalPluginProvider
Use unified interfaces defined in the client package. This ensures plugins and clients use the same interface definitions to avoid type assertion failures.
type PluginProvider ¶
type PluginProvider = client.PluginProvider
Use unified interfaces defined in the client package. This ensures plugins and clients use the same interface definitions to avoid type assertion failures.
type ProviderPlugin ¶
type ProviderPlugin struct {
plugin.Plugin
// Impl is the actual provider implementation.
// Can be *adapter.BasePluginProvider, *adapter.LocalPluginAdapter or *adapter.RemotePluginAdapter.
Impl interface{}
}
ProviderPlugin implements the hashicorp/go-plugin.Plugin interface.
This is the core component of the Plugin SDK, responsible for:
- Registering gRPC services on the plugin side
- Creating gRPC clients on the host side
Plugin developers only need to create this object and pass it to plugin.Serve().
func NewProviderPlugin ¶
func NewProviderPlugin(impl interface{}) *ProviderPlugin
NewProviderPlugin creates a ProviderPlugin instance.
Parameters:
- impl: The actual plugin implementation (usually *adapter.LocalPluginAdapter or *adapter.RemotePluginAdapter)
Returns:
- *ProviderPlugin: A Plugin instance that can be passed to plugin.Serve()
func (*ProviderPlugin) GRPCClient ¶
func (p *ProviderPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
GRPCClient creates a gRPC client on the host side.
When AOG Core connects to a plugin, this method is called to create a client proxy. This method is automatically called by the go-plugin framework.
Returns a wrapped GRPCProviderClient that implements:
- client.PluginProvider
- client.LocalPluginProvider
- client.RemotePluginProvider
AOG Core can directly type-assert the return value to these interfaces.
func (*ProviderPlugin) GRPCServer ¶
func (p *ProviderPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
GRPCServer registers gRPC services on the plugin side.
When AOG Core starts the plugin process, this method is called to register its gRPC services. This method is automatically called by the go-plugin framework.
type RemotePluginProvider ¶
type RemotePluginProvider = client.RemotePluginProvider
Use unified interfaces defined in the client package. This ensures plugins and clients use the same interface definitions to avoid type assertion failures.