diff --git a/build.gradle b/build.gradle index 91413e9..e21a840 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { apply from: '../spotless.gradle' group = "org.bdware.sc" -version = "1.9.7" +version = "1.9.9" tasks.withType(JavaCompile) { // options.compilerArgs << '-Xlint:none' // options.compilerArgs << '-Xlint:deprecation' << "-Werror" @@ -51,7 +51,7 @@ dependencies { implementation 'com.sun.mail:javax.mail:1.6.2' implementation 'com.squareup.okhttp3:okhttp:4.9.1' implementation 'org.bdware.bdcontract:sdk-java:1.0.2' - implementation 'org.bdware.doip:doip-audit-tool:1.3.5' + implementation 'org.bdware.doip:doip-audit-tool:1.3.6' implementation 'org.bdware.doip:doip-sdk:1.4.9' implementation fileTree(dir: 'lib', include: '*.jar') testImplementation 'junit:junit:4.13.2' diff --git a/src/main/java/org/bdware/sc/compiler/ap/Fork.java b/src/main/java/org/bdware/sc/compiler/ap/Fork.java new file mode 100644 index 0000000..970e06b --- /dev/null +++ b/src/main/java/org/bdware/sc/compiler/ap/Fork.java @@ -0,0 +1,23 @@ +package org.bdware.sc.compiler.ap; + +import org.bdware.sc.bean.ForkInfo; +import org.bdware.sc.bean.RouteInfo; +import org.bdware.sc.compiler.AnnotationProcessor; +import org.bdware.sc.node.AnnotationNode; +import org.bdware.sc.node.ContractNode; +import org.bdware.sc.node.FunctionNode; +import org.bdware.sc.node.InterfaceNode; + +public class Fork extends AnnotationProcessor { + @Override + public void processFunction(AnnotationNode anno, ContractNode contractNode, + FunctionNode functionNode) { + functionNode.setForkInfo(ForkInfo.create(anno, contractNode)); + } + + @Override + public void processInterface(AnnotationNode anno, ContractNode contractNode, + InterfaceNode interfaceNode) { + interfaceNode.setForkInfo(ForkInfo.create(anno, contractNode)); + } +} diff --git a/src/main/java/org/bdware/sc/server/DoipClusterServer.java b/src/main/java/org/bdware/sc/server/DoipClusterServer.java index 17e45ae..b1b06e7 100644 --- a/src/main/java/org/bdware/sc/server/DoipClusterServer.java +++ b/src/main/java/org/bdware/sc/server/DoipClusterServer.java @@ -91,13 +91,14 @@ public class DoipClusterServer extends DoipServerImpl { JsonObject methodRouteInfoMap = new JsonObject(); // doipOperationName和对应的routeFunctionName的对应关系,存储方式为doipOperationName: routeFunctionName JsonObject methodJoinInfoMap = new JsonObject(); + JsonObject methodForkInfoMap = new JsonObject(); // 所有Router中用得到的函数(例如Route函数和Route函数依赖的相关函数) JsonObject functions = new JsonObject(); // 维护RouteInfo,将RouteInfo和doipOperationName的映射关系,以及所有Router中用得到的函数都维护好 // TODO 移除这部分逻辑? - cn.maintainRouteJoinInfo(methodRouteInfoMap, methodJoinInfoMap, functions); + cn.maintainRouteJoinInfo(methodRouteInfoMap, methodJoinInfoMap, methodForkInfoMap, functions); if (clusterInfo != null) repoHandleValues.add("clusterInfo", clusterInfo); if (functions.size() > 0) @@ -106,6 +107,8 @@ public class DoipClusterServer extends DoipServerImpl { repoHandleValues.add("routeInfo", methodRouteInfoMap); if (methodJoinInfoMap.size() > 0) repoHandleValues.add("joinInfo", methodJoinInfoMap); + if (methodForkInfoMap.size() > 0) + repoHandleValues.add("forkInfo", methodForkInfoMap); repoInfo.handleValues.addProperty("cluster", repoHandleValues.toString()); String updateRepoInfoRes = repoIrpClient.reRegister(repoInfo); if (updateRepoInfoRes.equals("success")) { diff --git a/src/test/java/org/bdware/analysis/DataBaseProcess.java b/src/test/java/org/bdware/analysis/DataBaseProcess.java index a641b31..075e4e7 100644 --- a/src/test/java/org/bdware/analysis/DataBaseProcess.java +++ b/src/test/java/org/bdware/analysis/DataBaseProcess.java @@ -1,7 +1,18 @@ package org.bdware.analysis; +import org.bdware.sc.boundry.utils.RocksDBUtil; +import org.rocksdb.RocksIterator; + public class DataBaseProcess { + private static RocksDBUtil db; + public static void main(String[] args) { + db = RocksDBUtil.loadDB("abc",false); + RocksIterator iter = db.newIterator(); + iter.seekToFirst();; + for (;iter.isValid();){ + db.getNext(iter); + } // long timeJava; // try { // // start a process before