server

package
v0.0.0-...-b58e781 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const PluginTypeProvider = "provider"

PluginTypeProvider is the identifier for Provider plugins. Used to register and look up plugins in PluginMap.

Variables

View Source
var DefaultHandshake = PluginHandshake

DefaultHandshake is an alias of PluginHandshake for backward compatibility.

View Source
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.

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

CheckEngine checks if the engine is installed (Local plugin only).

func (*GRPCProviderServer) DeleteModel

DeleteModel deletes a model (Local plugin only).

func (*GRPCProviderServer) GetConfig

GetConfig returns the engine configuration (Local plugin only).

func (*GRPCProviderServer) GetManifest

GetManifest returns the plugin metadata.

func (*GRPCProviderServer) GetOperateStatus

GetOperateStatus returns the operational status.

func (*GRPCProviderServer) GetRunningModels

GetRunningModels returns all running models (Local plugin only).

func (*GRPCProviderServer) GetVersion

GetVersion returns the engine version (Local plugin only).

func (*GRPCProviderServer) HealthCheck

HealthCheck performs a health check.

func (*GRPCProviderServer) InitEnv

InitEnv initializes environment variables (Local plugin only).

func (*GRPCProviderServer) InstallEngine

InstallEngine installs the engine (Local plugin only).

func (*GRPCProviderServer) InvokeService

InvokeService invokes a plugin service.

func (*GRPCProviderServer) InvokeServiceBidi

InvokeServiceBidi handles bidirectional streaming invocation

func (*GRPCProviderServer) InvokeServiceStream

InvokeServiceStream performs server-side streaming invocation.

func (*GRPCProviderServer) ListModels

ListModels lists all models (Local plugin only).

func (*GRPCProviderServer) LoadModel

LoadModel loads a model into memory (Local plugin only).

func (*GRPCProviderServer) PullModel

PullModel pulls a model (Local plugin only).

func (*GRPCProviderServer) PullModelStream

PullModelStream pulls a model with streaming (Local plugin only).

func (*GRPCProviderServer) RefreshAuth

RefreshAuth refreshes authentication information (Remote plugin only).

func (*GRPCProviderServer) SetAuth

SetAuth sets authentication information (Remote plugin only).

func (*GRPCProviderServer) SetOperateStatus

SetOperateStatus sets the operational status.

func (*GRPCProviderServer) StartEngine

StartEngine starts the engine (Local plugin only).

func (*GRPCProviderServer) StopEngine

StopEngine stops the engine (Local plugin only).

func (*GRPCProviderServer) UnloadModel

UnloadModel unloads models from memory (Local plugin only).

func (*GRPCProviderServer) UpgradeEngine

UpgradeEngine upgrades the engine (Local plugin only).

func (*GRPCProviderServer) ValidateAuth

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.

Jump to

Keyboard shortcuts

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