mirror of
https://gitee.com/BDWare/agent-backend
synced 2025-01-10 01:44:14 +00:00
feat(agent-backend): add event publishing
prune CMActions; add NodeCenterClientController.publishEventFromCenter
This commit is contained in:
parent
90cdabfa92
commit
7791c78c58
@ -21,9 +21,7 @@ import org.bdware.server.GRPCPool;
|
|||||||
import org.bdware.server.GlobalConf;
|
import org.bdware.server.GlobalConf;
|
||||||
import org.bdware.server.action.p2p.MasterClientTCPAction;
|
import org.bdware.server.action.p2p.MasterClientTCPAction;
|
||||||
import org.bdware.server.trustedmodel.AgentManager;
|
import org.bdware.server.trustedmodel.AgentManager;
|
||||||
import org.bdware.server.trustedmodel.ContractExecutor;
|
|
||||||
import org.bdware.server.trustedmodel.KillUnitContractInfo;
|
import org.bdware.server.trustedmodel.KillUnitContractInfo;
|
||||||
import org.bdware.server.trustedmodel.SelfAdaptiveShardingExecutor;
|
|
||||||
import org.bdware.server.ws.ContractManagerFrameHandler;
|
import org.bdware.server.ws.ContractManagerFrameHandler;
|
||||||
import org.bdware.units.NetworkManager;
|
import org.bdware.units.NetworkManager;
|
||||||
import org.bdware.units.function.CommunicationManager;
|
import org.bdware.units.function.CommunicationManager;
|
||||||
@ -533,16 +531,6 @@ public class CMActions implements OnHashCallback {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Action(async = true, userPermission = 0)
|
|
||||||
public void checkBlocks(JsonObject args, final ResultCallback rcb) {
|
|
||||||
ContractExecutor executor = CMActions.manager.getExecutor(args.get("contractID").getAsString());
|
|
||||||
try {
|
|
||||||
ReplyUtil.simpleReply(rcb, "onCheckBlocks", ((SelfAdaptiveShardingExecutor) executor).checkCache());
|
|
||||||
} catch (Exception e) {
|
|
||||||
ReplyUtil.simpleReply(rcb, "onCheckBlocks", "error! " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 节点管理者
|
// 节点管理者
|
||||||
@Action(userPermission = 1L << 19)
|
@Action(userPermission = 1L << 19)
|
||||||
public void listAllContractProcess(JsonObject args, ResultCallback resultCallback) {
|
public void listAllContractProcess(JsonObject args, ResultCallback resultCallback) {
|
||||||
|
@ -12,6 +12,7 @@ import org.bdware.sc.conn.ByteUtil;
|
|||||||
import org.bdware.sc.conn.ResultCallback;
|
import org.bdware.sc.conn.ResultCallback;
|
||||||
import org.bdware.sc.db.CMTables;
|
import org.bdware.sc.db.CMTables;
|
||||||
import org.bdware.sc.db.KeyValueDBUtil;
|
import org.bdware.sc.db.KeyValueDBUtil;
|
||||||
|
import org.bdware.sc.event.REvent;
|
||||||
import org.bdware.sc.units.MultiContractMeta;
|
import org.bdware.sc.units.MultiContractMeta;
|
||||||
import org.bdware.sc.util.JsonUtil;
|
import org.bdware.sc.util.JsonUtil;
|
||||||
import org.bdware.server.GlobalConf;
|
import org.bdware.server.GlobalConf;
|
||||||
@ -51,7 +52,6 @@ public class NodeCenterClientController implements NodeCenterConn {
|
|||||||
ReceiveFileThread receiveFileThread = new ReceiveFileThread();
|
ReceiveFileThread receiveFileThread = new ReceiveFileThread();
|
||||||
|
|
||||||
public NodeCenterClientController(String nodeID) {
|
public NodeCenterClientController(String nodeID) {
|
||||||
|
|
||||||
this.nodeID = nodeID;
|
this.nodeID = nodeID;
|
||||||
this.neighbors = new NetNeighbors();
|
this.neighbors = new NetNeighbors();
|
||||||
}
|
}
|
||||||
@ -226,6 +226,13 @@ public class NodeCenterClientController implements NodeCenterConn {
|
|||||||
LOGGER.info("update " + info.size() + " contracts in node center");
|
LOGGER.info("update " + info.size() + " contracts in node center");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Action(async = true)
|
||||||
|
public void publishEventFromCenter(JsonObject jo, ResultCallback rcb) {
|
||||||
|
if (jo.has("event")) {
|
||||||
|
CMActions.manager.deliverEvent(JsonUtil.fromJson(jo.get("event").getAsString(), REvent.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Action(async = true)
|
@Action(async = true)
|
||||||
public void requestReadMe(JsonObject jo, ResultCallback cb) throws IOException {
|
public void requestReadMe(JsonObject jo, ResultCallback cb) throws IOException {
|
||||||
JsonObject resp = new JsonObject();
|
JsonObject resp = new JsonObject();
|
||||||
|
Loading…
Reference in New Issue
Block a user