SetQueueClient set client queue, for recv msg
(qcli queue.Client)
| 105 | |
| 106 | // SetQueueClient set client queue, for recv msg |
| 107 | func (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 | |
| 146 | func (exec *Executor) procUpgrade(msg *queue.Message) { |
| 147 | var kvset types.LocalDBSet |
nothing calls this directly
no test coverage detected