Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
share
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张振华
share
Commits
fe2fa98f
Commit
fe2fa98f
authored
Nov 13, 2018
by
张振华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor
parent
8648121e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
执行器框架的调用过程示意.md
执行器框架的调用过程示意.md
+26
-0
No files found.
执行器框架的调用过程示意.md
0 → 100644
View file @
fe2fa98f

## 1.执行器初始化时注册到全局map中被后续业务处理逻辑调用
全局map:registedExecDriver
每个执行器的init函数中,会调用dapp.Register接口,向registedExecDriver进行注册。
当需要使用执行器时,需调用dapp.LoadDriverAllow(最终调用dapp.LoadDriver)来创建执行器对象。
## 2.查询接口
以GetAddrOverview为例,会触发Executor来调用LoadDriver得到对应的执行器,并执行该执行器对应的Query_XXX方法。
## 3.生成区块
当blockchain模块调用到execBlock时,ExecTx函数会通过EventExecTxList消息触发Executor来调用LoadDriver得到对应的执行器,并执行该执行器对应的Exec_XXX方法,具体调用哪一个方法,根据交易中的action信息来定。
当blockchain模块调用到AddTxs时,getLocalKV函数会通过EventAddBlock消息触发Executor来调用LoadDriver得到对应的执行器,并执行该执行器对应的ExecLocal_XXX方法,具体调用哪一个方法,根据交易中的action信息来定。
## 4.删除区块
当blockchain模块调用到disconnectBlock时,DelTxs函数中的getDelLocalKV函数会通过EventDelBlock消息触发Executor来调用LoadDriver得到对应的执行器,并执行该执行器对应的ExecDelLocal_xxx方法,具体调用哪一个方法,根据交易中的action信息来定。
通过上述几个主要过程的调用流程逻辑梳理,基本可以看清楚Chain33各模块之间是如何配合完成灵活抽象的执行器框架的几个主要接口调用的。
执行器框架的设计,使用了go的反射机制,通过类的层次关系设计,实现了抽象灵活可插拔的编程模式,使合约开发者可以重点关注合约逻辑的实现,而不用过多分心到其他模块的内部实现细节。
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment