Documentation
¶
Index ¶
- Variables
- type AppchainGRPCPlugin
- type Client
- type GRPCClient
- func (g *GRPCClient) Bind(kern Kernel)
- func (g *GRPCClient) CommitCallback(_ *pb.IBTP) error
- func (g *GRPCClient) GetCallbackMeta() (map[string]uint64, error)
- func (g *GRPCClient) GetIBTP() chan *pb.IBTP
- func (g *GRPCClient) GetInMessage(from string, idx uint64) ([][]byte, error)
- func (g *GRPCClient) GetInMeta() (map[string]uint64, error)
- func (g *GRPCClient) GetOutMessage(to string, idx uint64) (*pb.IBTP, error)
- func (g *GRPCClient) GetOutMeta() (map[string]uint64, error)
- func (g *GRPCClient) GetReceipt(ibtp *pb.IBTP) (*pb.IBTP, error)
- func (g *GRPCClient) ID() string
- func (g *GRPCClient) IncreaseInMeta(original *pb.IBTP) (*pb.IBTP, error)
- func (g *GRPCClient) Initialize(configPath string, ID string, extra []byte) error
- func (g *GRPCClient) Name() string
- func (g *GRPCClient) RollbackIBTP(ibtp *pb.IBTP, srcChain bool) (*pb.RollbackIBTPResponse, error)
- func (g *GRPCClient) Start() error
- func (g *GRPCClient) Stop() error
- func (g *GRPCClient) SubmitIBTP(ibtp *pb.IBTP) (*pb.SubmitIBTPResponse, error)
- func (g *GRPCClient) Type() string
- type GRPCServer
- func (s *GRPCServer) CommitCallback(_ context.Context, _ *pb.IBTP) (*pb.Empty, error)
- func (s *GRPCServer) GetCallbackMeta(context.Context, *pb.Empty) (*pb.GetMetaResponse, error)
- func (s *GRPCServer) GetIBTP(_ *pb.Empty, conn pb.AppchainPlugin_GetIBTPServer) error
- func (s *GRPCServer) GetInMessage(_ context.Context, req *pb.GetInMessageRequest) (*pb.GetInMessageResponse, error)
- func (s *GRPCServer) GetInMeta(context.Context, *pb.Empty) (*pb.GetMetaResponse, error)
- func (s *GRPCServer) GetOutMessage(_ context.Context, req *pb.GetOutMessageRequest) (*pb.IBTP, error)
- func (s *GRPCServer) GetOutMeta(context.Context, *pb.Empty) (*pb.GetMetaResponse, error)
- func (s *GRPCServer) GetReceipt(_ context.Context, ibtp *pb.IBTP) (*pb.IBTP, error)
- func (s *GRPCServer) IncreaseInMeta(_ context.Context, in *pb.IBTP) (*pb.IBTP, error)
- func (s *GRPCServer) Initialize(_ context.Context, req *pb.InitializeRequest) (*pb.Empty, error)
- func (s *GRPCServer) Name(context.Context, *pb.Empty) (*pb.NameResponse, error)
- func (s *GRPCServer) RollbackIBTP(_ context.Context, req *pb.RollbackIBTPRequest) (*pb.RollbackIBTPResponse, error)
- func (s *GRPCServer) Start(context.Context, *pb.Empty) (*pb.Empty, error)
- func (s *GRPCServer) Stop(context.Context, *pb.Empty) (*pb.Empty, error)
- func (s *GRPCServer) SubmitIBTP(_ context.Context, ibtp *pb.IBTP) (*pb.SubmitIBTPResponse, error)
- func (s *GRPCServer) Type(context.Context, *pb.Empty) (*pb.TypeResponse, error)
- type Kernel
- type Launcher
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Handshake = plugin.HandshakeConfig{ ProtocolVersion: 4, MagicCookieKey: "SIDECAR_APPCHAIN_PLUGIN", MagicCookieValue: "SIDECAR", } PluginName = "chain33-client" )
Handshake is a common handshake that is shared by plugin and host.
View Source
var PluginMap = map[string]plugin.Plugin{ PluginName: &AppchainGRPCPlugin{}, }
插件进程在启动时设置Plugins,即ServeConfig中设置Plugins时,会指明其实现者; 宿主机进程在启动时也设置Plugins,即ClientConfig中设置Plugins时,不需要指明其实现者。 PluginMap is the map of plugins we can dispense.
Functions ¶
This section is empty.
Types ¶
type AppchainGRPCPlugin ¶
type AppchainGRPCPlugin struct { plugin.Plugin // 要嵌入(net/rpc)插件接口,是反射的作用。整个接口体需要实现:GRPCPlugin、plugin.Plugin两个接口,而plugin.Plugin并没有使用,嵌入进去即可。 // Concrete implementation, written in Go. This is only used for plugins // that are written in Go. Impl Client }
插件实现 This is the implementation of plugin.GRPCPlugin so we can serve/consume this.
func (*AppchainGRPCPlugin) GRPCClient ¶
func (p *AppchainGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*AppchainGRPCPlugin) GRPCServer ¶
func (p *AppchainGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
GRPCPlugin实现
type Client ¶
type Client interface { Launcher Bind(kern Kernel) // Initialize initialize plugin client Initialize(configPath string, ID string, extra []byte) error // GetIBTP gets an interchain ibtp channel generated by client GetIBTP() chan *pb.IBTP // SubmitIBTP submits the interchain ibtp to appchain SubmitIBTP(*pb.IBTP) (*pb.SubmitIBTPResponse, error) // RollbackIBTP rollbacks the interchain ibtp to appchain RollbackIBTP(ibtp *pb.IBTP, isSrcChain bool) (*pb.RollbackIBTPResponse, error) // increase in meta without actually executing it IncreaseInMeta(ibtp *pb.IBTP) (*pb.IBTP, error) // GetOutMessage gets interchain ibtp by index and target chain_id from broker contract GetOutMessage(to string, idx uint64) (*pb.IBTP, error) // GetInMessage gets receipt by index and source chain_id GetInMessage(from string, idx uint64) ([][]byte, error) // GetOutMeta gets an index map, which implicates the greatest index of // ingoing interchain txs for each source chain GetInMeta() (map[string]uint64, error) // GetOutMeta gets an index map, which implicates the greatest index of // outgoing interchain txs for each receiving chain GetOutMeta() (map[string]uint64, error) // GetReceiptMeta gets an index map, which implicates the greatest index of // executed callback txs for each receiving chain GetCallbackMeta() (map[string]uint64, error) // CommitCallback is a callback function when get receipt from link33 success CommitCallback(ibtp *pb.IBTP) error // GetReceipt gets receipt of an executed IBTP GetReceipt(ibtp *pb.IBTP) (*pb.IBTP, error) // Name gets name of blockchain from plugin Name() string // Type gets type of blockchain from plugin Type() string // ID ID() string }
Client defines the interface that interacts with appchain
func CreateClient ¶
type GRPCClient ¶
GRPCClient 实现了Client接口。此实现只是将请求转发给gRPC服务处理,通过gRPC客户端转发请求给插件进程 GRPCClient is an implementation of Client that talks over RPC.
func (*GRPCClient) Bind ¶
func (g *GRPCClient) Bind(kern Kernel)
func (*GRPCClient) CommitCallback ¶
func (g *GRPCClient) CommitCallback(_ *pb.IBTP) error
func (*GRPCClient) GetCallbackMeta ¶
func (g *GRPCClient) GetCallbackMeta() (map[string]uint64, error)
func (*GRPCClient) GetIBTP ¶
func (g *GRPCClient) GetIBTP() chan *pb.IBTP
func (*GRPCClient) GetInMessage ¶
func (g *GRPCClient) GetInMessage(from string, idx uint64) ([][]byte, error)
func (*GRPCClient) GetOutMessage ¶
func (*GRPCClient) GetOutMeta ¶
func (g *GRPCClient) GetOutMeta() (map[string]uint64, error)
func (*GRPCClient) GetReceipt ¶
func (*GRPCClient) ID ¶
func (g *GRPCClient) ID() string
func (*GRPCClient) IncreaseInMeta ¶
func (*GRPCClient) Initialize ¶
func (g *GRPCClient) Initialize(configPath string, ID string, extra []byte) error
func (*GRPCClient) Name ¶
func (g *GRPCClient) Name() string
func (*GRPCClient) RollbackIBTP ¶
func (g *GRPCClient) RollbackIBTP(ibtp *pb.IBTP, srcChain bool) (*pb.RollbackIBTPResponse, error)
func (*GRPCClient) Start ¶
func (g *GRPCClient) Start() error
func (*GRPCClient) Stop ¶
func (g *GRPCClient) Stop() error
func (*GRPCClient) SubmitIBTP ¶
func (g *GRPCClient) SubmitIBTP(ibtp *pb.IBTP) (*pb.SubmitIBTPResponse, error)
func (*GRPCClient) Type ¶
func (g *GRPCClient) Type() string
type GRPCServer ¶
type GRPCServer struct {
Impl Client
}
实现 AppchainPluginServer接口,具体逻辑委托给业务接口Client的实现。主要是给插件进程使用。 ---- gRPC Server domain ----
func (*GRPCServer) CommitCallback ¶
func (*GRPCServer) GetCallbackMeta ¶
func (s *GRPCServer) GetCallbackMeta(context.Context, *pb.Empty) (*pb.GetMetaResponse, error)
func (*GRPCServer) GetIBTP ¶
func (s *GRPCServer) GetIBTP(_ *pb.Empty, conn pb.AppchainPlugin_GetIBTPServer) error
func (*GRPCServer) GetInMessage ¶
func (s *GRPCServer) GetInMessage(_ context.Context, req *pb.GetInMessageRequest) (*pb.GetInMessageResponse, error)
func (*GRPCServer) GetInMeta ¶
func (s *GRPCServer) GetInMeta(context.Context, *pb.Empty) (*pb.GetMetaResponse, error)
func (*GRPCServer) GetOutMessage ¶
func (s *GRPCServer) GetOutMessage(_ context.Context, req *pb.GetOutMessageRequest) (*pb.IBTP, error)
func (*GRPCServer) GetOutMeta ¶
func (s *GRPCServer) GetOutMeta(context.Context, *pb.Empty) (*pb.GetMetaResponse, error)
func (*GRPCServer) GetReceipt ¶
func (*GRPCServer) IncreaseInMeta ¶
func (*GRPCServer) Initialize ¶
func (s *GRPCServer) Initialize(_ context.Context, req *pb.InitializeRequest) (*pb.Empty, error)
func (*GRPCServer) Name ¶
func (s *GRPCServer) Name(context.Context, *pb.Empty) (*pb.NameResponse, error)
func (*GRPCServer) RollbackIBTP ¶
func (s *GRPCServer) RollbackIBTP(_ context.Context, req *pb.RollbackIBTPRequest) (*pb.RollbackIBTPResponse, error)
func (*GRPCServer) SubmitIBTP ¶
func (s *GRPCServer) SubmitIBTP(_ context.Context, ibtp *pb.IBTP) (*pb.SubmitIBTPResponse, error)
func (*GRPCServer) Type ¶
func (s *GRPCServer) Type(context.Context, *pb.Empty) (*pb.TypeResponse, error)
Directories
¶
Path | Synopsis |
---|---|
Package mock_client is a generated GoMock package.
|
Package mock_client is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.