github.com/turingchain2020/turingchain@v1.1.21/pluginmgr/plugin.go (about)

     1  // Copyright Turing Corp. 2018 All Rights Reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package pluginmgr
     6  
     7  import (
     8  	"github.com/turingchain2020/turingchain/rpc/types"
     9  	typ "github.com/turingchain2020/turingchain/types"
    10  	wcom "github.com/turingchain2020/turingchain/wallet/common"
    11  	"github.com/spf13/cobra"
    12  )
    13  
    14  // Plugin plugin module struct
    15  type Plugin interface {
    16  	// 获取整个插件的包名,用以计算唯一值、做前缀等
    17  	GetName() string
    18  	// 获取插件中执行器名
    19  	GetExecutorName() string
    20  	// 初始化执行器时会调用该接口
    21  	InitExec(cfg *typ.TuringchainConfig)
    22  	InitWallet(wallet wcom.WalletOperate, sub map[string][]byte)
    23  	AddCmd(rootCmd *cobra.Command)
    24  	AddRPC(s types.RPCServer)
    25  }