shared

package
v0.0.0-...-075d4b0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	OnLoad(config string) ([]byte, error)                                      // 加载
	OnUnload(config string) ([]byte, error)                                    // 取消启用
	OnInstall(config string) ([]byte, error)                                   // 安装插件
	OnUninstall(config string) ([]byte, error)                                 // 卸载插件
	OnStart(config string) ([]byte, error)                                     // HL 启动
	OnStop(config string) ([]byte, error)                                      // HL 停止
	Interaction(config string, function string, args []string) (string, error) // 前后端交互
	UIFramework(config string) ([]byte, error)                                 // UI框架

}

插件可调用接口

type GRPCClient

type GRPCClient struct {
	// contains filtered or unexported fields
}

GRPCClient is an implementation of KV that talks over RPC.

func (*GRPCClient) Interaction

func (m *GRPCClient) Interaction(pluginInterface string, function string, args []string) (string, error)

func (*GRPCClient) OnInstall

func (m *GRPCClient) OnInstall(pluginInterface string) ([]byte, error)

func (*GRPCClient) OnLoad

func (m *GRPCClient) OnLoad(pluginInterface string) ([]byte, error)

func (*GRPCClient) OnStart

func (m *GRPCClient) OnStart(pluginInterface string) ([]byte, error)

func (*GRPCClient) OnStop

func (m *GRPCClient) OnStop(pluginInterface string) ([]byte, error)

func (*GRPCClient) OnUninstall

func (m *GRPCClient) OnUninstall(pluginInterface string) ([]byte, error)

func (*GRPCClient) OnUnload

func (m *GRPCClient) OnUnload(pluginInterface string) ([]byte, error)

func (*GRPCClient) UIFramework

func (m *GRPCClient) UIFramework(pluginInterface string) ([]byte, error)

type GRPCPlugin

type GRPCPlugin struct {
	plugin.Plugin
	Impl API
}

gRPC 配置

func (*GRPCPlugin) GRPCClient

func (p *GRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

gRPC Client 配置

func (*GRPCPlugin) GRPCServer

func (p *GRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

gRPC Server 配置

type GRPCServer

type GRPCServer struct {
	// This is the real implementation
	Impl API
}

Here is the gRPC server that GRPCClient talks to.

func (*GRPCServer) Interaction

func (*GRPCServer) OnInstall

func (m *GRPCServer) OnInstall(ctx context.Context, req *proto.EventsRequest) (*proto.EventsResponse, error)

func (*GRPCServer) OnLoad

func (*GRPCServer) OnStart

func (*GRPCServer) OnStop

func (*GRPCServer) OnUninstall

func (m *GRPCServer) OnUninstall(ctx context.Context, req *proto.EventsRequest) (*proto.EventsResponse, error)

func (*GRPCServer) OnUnload

func (*GRPCServer) UIFramework

func (m *GRPCServer) UIFramework(ctx context.Context, req *proto.EventsRequest) (*proto.EventsResponse, error)

type Plugin

type Plugin struct {
	Impl API
}

netRPC 配置

func (*Plugin) Client

func (*Plugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

netRPC Client 配置

func (*Plugin) Server

func (p *Plugin) Server(*plugin.MuxBroker) (interface{}, error)

netRPC Server 配置

type PluginInterface

type PluginInterface struct {
	Config          string
	EnvironmentInfo struct {
		Platform string
		Arch     string
	}
}

传入数据

type RPCClient

type RPCClient struct {
	// contains filtered or unexported fields
}

RPCClient is an implementation of KV that talks over RPC.

func (*RPCClient) Interaction

func (m *RPCClient) Interaction(pluginInterface string, function string, args []string) (string, error)

func (*RPCClient) OnInstall

func (m *RPCClient) OnInstall(pluginInterface string) ([]byte, error)

func (*RPCClient) OnLoad

func (m *RPCClient) OnLoad(pluginInterface string) ([]byte, error)

func (*RPCClient) OnStart

func (m *RPCClient) OnStart(pluginInterface string) ([]byte, error)

func (*RPCClient) OnStop

func (m *RPCClient) OnStop(pluginInterface string) ([]byte, error)

func (*RPCClient) OnUninstall

func (m *RPCClient) OnUninstall(pluginInterface string) ([]byte, error)

func (*RPCClient) OnUnload

func (m *RPCClient) OnUnload(pluginInterface string) ([]byte, error)

func (*RPCClient) UIFramework

func (m *RPCClient) UIFramework(pluginInterface string) ([]byte, error)

type RPCServer

type RPCServer struct {
	Impl API
}

Here is the RPC server that RPCClient talks to, conforming to the requirements of net/rpc

func (*RPCServer) Interaction

func (m *RPCServer) Interaction(args map[string]interface{}, resp *string) error

func (*RPCServer) OnInstall

func (m *RPCServer) OnInstall(pluginInterface string, resp *[]byte) error

func (*RPCServer) OnLoad

func (m *RPCServer) OnLoad(pluginInterface string, resp *[]byte) error

func (*RPCServer) OnStart

func (m *RPCServer) OnStart(pluginInterface string, resp *[]byte) error

func (*RPCServer) OnStop

func (m *RPCServer) OnStop(pluginInterface string, resp *[]byte) error

func (*RPCServer) OnUninstall

func (m *RPCServer) OnUninstall(pluginInterface string, resp *[]byte) error

func (*RPCServer) OnUnload

func (m *RPCServer) OnUnload(pluginInterface string, resp *[]byte) error

func (*RPCServer) UIFramework

func (m *RPCServer) UIFramework(pluginInterface string, resp *[]byte) error

Jump to

Keyboard shortcuts

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