MCPcopy Create free account
hub / github.com/33cn/chain33 / SetQueueClient

Method SetQueueClient

executor/executor.go:107–144  ·  view source on GitHub ↗

SetQueueClient set client queue, for recv msg

(qcli queue.Client)

Source from the content-addressed store, hash-verified

105
106// SetQueueClient set client queue, for recv msg
107func (exec *Executor) SetQueueClient(qcli queue.Client) {
108 exec.client = qcli
109 exec.client.Sub("execs")
110 var err error
111 exec.qclient, err = client.New(qcli, nil)
112 if err != nil {
113 panic(err)
114 }
115 types.AssertConfig(exec.client)
116 cfg := exec.client.GetConfig()
117 if cfg.IsPara() {
118 exec.grpccli, err = grpcclient.NewMainChainClient(cfg, "")
119 if err != nil {
120 panic(err)
121 }
122 }
123
124 //recv 消息的处理
125 go func() {
126 for msg := range exec.client.Recv() {
127 elog.Debug("exec recv", "msg", msg)
128 if msg.Ty == types.EventExecTxList {
129 go exec.procExecTxList(msg)
130 } else if msg.Ty == types.EventAddBlock {
131 go exec.procExecAddBlock(msg)
132 } else if msg.Ty == types.EventDelBlock {
133 go exec.procExecDelBlock(msg)
134 } else if msg.Ty == types.EventCheckTx {
135 go exec.procExecCheckTx(msg)
136 } else if msg.Ty == types.EventBlockChainQuery {
137 go exec.procExecQuery(msg)
138 } else if msg.Ty == types.EventUpgrade {
139 //执行升级过程中不允许执行其他的事件,这个事件直接不采用异步执行
140 exec.procUpgrade(msg)
141 }
142 }
143 }()
144}
145
146func (exec *Executor) procUpgrade(msg *queue.Message) {
147 var kvset types.LocalDBSet

Callers

nothing calls this directly

Calls 14

procExecTxListMethod · 0.95
procExecAddBlockMethod · 0.95
procExecDelBlockMethod · 0.95
procExecCheckTxMethod · 0.95
procExecQueryMethod · 0.95
procUpgradeMethod · 0.95
NewFunction · 0.92
AssertConfigFunction · 0.92
NewMainChainClientFunction · 0.92
IsParaMethod · 0.80
SubMethod · 0.65
GetConfigMethod · 0.65

Tested by

no test coverage detected