pluginmgr

package
v6.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package pluginmgr 插件管理模块,负责插件初始化等功能

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCmd

func AddCmd(rootCmd *cobra.Command)

AddCmd add Command for plugin

func AddRPC

func AddRPC(s types.RPCServer)

AddRPC add Rpc

func HasExec

func HasExec(name string) bool

HasExec check is have the name exec

func InitExec

func InitExec(sub map[string][]byte)

InitExec init exec

func InitWallet

func InitWallet(wallet wcom.WalletOperate, sub map[string][]byte)

InitWallet init wallet plugin

func Register

func Register(p Plugin)

Register Register plugin

Types

type Plugin

type Plugin interface {
	// 获取整个插件的包名,用以计算唯一值、做前缀等
	GetName() string
	// 获取插件中执行器名
	GetExecutorName() string
	// 初始化执行器时会调用该接口
	InitExec(sub map[string][]byte)
	InitWallet(wallet wcom.WalletOperate, sub map[string][]byte)
	AddCmd(rootCmd *cobra.Command)
	AddRPC(s types.RPCServer)
}

Plugin plugin module struct

type PluginBase

type PluginBase struct {
	Name     string
	ExecName string
	RPC      func(name string, s types.RPCServer)
	Exec     func(name string, sub []byte)
	Wallet   func(walletBiz wcom.WalletOperate, sub []byte)
	Cmd      func() *cobra.Command
}

PluginBase plugin module base struct

func (*PluginBase) AddCmd

func (p *PluginBase) AddCmd(rootCmd *cobra.Command)

AddCmd add Command for plugin cli

func (*PluginBase) AddRPC

func (p *PluginBase) AddRPC(c types.RPCServer)

AddRPC add Rpc for plugin

func (*PluginBase) GetExecutorName

func (p *PluginBase) GetExecutorName() string

GetExecutorName 获取插件中执行器名

func (*PluginBase) GetName

func (p *PluginBase) GetName() string

GetName 获取整个插件的包名,用以计算唯一值、做前缀等

func (*PluginBase) InitExec

func (p *PluginBase) InitExec(sub map[string][]byte)

InitExec init exec

func (*PluginBase) InitWallet

func (p *PluginBase) InitWallet(walletBiz wcom.WalletOperate, sub map[string][]byte)

InitWallet init wallet plugin

Jump to

Keyboard shortcuts

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