From 7791c78c580d131216d6f56445fb8559c38189fa Mon Sep 17 00:00:00 2001 From: "Frank.R.Wu" Date: Thu, 24 Mar 2022 12:51:14 +0800 Subject: [PATCH] feat(agent-backend): add event publishing prune CMActions; add NodeCenterClientController.publishEventFromCenter --- .../java/org/bdware/server/action/CMActions.java | 12 ------------ .../client/NodeCenterClientController.java | 9 ++++++++- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/bdware/server/action/CMActions.java b/src/main/java/org/bdware/server/action/CMActions.java index d1ee020..9e22d12 100644 --- a/src/main/java/org/bdware/server/action/CMActions.java +++ b/src/main/java/org/bdware/server/action/CMActions.java @@ -21,9 +21,7 @@ import org.bdware.server.GRPCPool; import org.bdware.server.GlobalConf; import org.bdware.server.action.p2p.MasterClientTCPAction; import org.bdware.server.trustedmodel.AgentManager; -import org.bdware.server.trustedmodel.ContractExecutor; import org.bdware.server.trustedmodel.KillUnitContractInfo; -import org.bdware.server.trustedmodel.SelfAdaptiveShardingExecutor; import org.bdware.server.ws.ContractManagerFrameHandler; import org.bdware.units.NetworkManager; 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) public void listAllContractProcess(JsonObject args, ResultCallback resultCallback) { diff --git a/src/main/java/org/bdware/server/nodecenter/client/NodeCenterClientController.java b/src/main/java/org/bdware/server/nodecenter/client/NodeCenterClientController.java index 6c84d24..3e59ff9 100644 --- a/src/main/java/org/bdware/server/nodecenter/client/NodeCenterClientController.java +++ b/src/main/java/org/bdware/server/nodecenter/client/NodeCenterClientController.java @@ -12,6 +12,7 @@ import org.bdware.sc.conn.ByteUtil; import org.bdware.sc.conn.ResultCallback; import org.bdware.sc.db.CMTables; import org.bdware.sc.db.KeyValueDBUtil; +import org.bdware.sc.event.REvent; import org.bdware.sc.units.MultiContractMeta; import org.bdware.sc.util.JsonUtil; import org.bdware.server.GlobalConf; @@ -51,7 +52,6 @@ public class NodeCenterClientController implements NodeCenterConn { ReceiveFileThread receiveFileThread = new ReceiveFileThread(); public NodeCenterClientController(String nodeID) { - this.nodeID = nodeID; this.neighbors = new NetNeighbors(); } @@ -226,6 +226,13 @@ public class NodeCenterClientController implements NodeCenterConn { 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) public void requestReadMe(JsonObject jo, ResultCallback cb) throws IOException { JsonObject resp = new JsonObject();