This commit is contained in:
CaiHQ 2023-10-24 18:07:14 +08:00
parent 4c895da128
commit 8797e0c309
9 changed files with 111 additions and 91 deletions

View File

@ -14,7 +14,7 @@ plugins {
id 'java'
id 'java-library'
}
version = "1.4.0"
version = "1.4.1"
group = 'org.bdware.sc.controlproxy'
tasks.withType(JavaCompile) {

View File

@ -9,7 +9,7 @@
"auditType": "OnlyHash"
},
"killBeforeStart": "ControlProxy",
"ypkPath": "/Users/huaqiancai/BDWare/ControlProxy/backend/build/ControlProxy-1.3.9.ypk",
"ypkPath": "/Users/huaqiancai/BDWare/ControlProxy/backend/build/ControlProxy-1.4.0.ypk",
"publicKey": "04d1924329f72ced148f6f333fb985ccbaa31b1e3aacf10be5f43d4a4ff5ad88899a005e79e37fc06993e1d66ada8cf8b711cb36f59538bb7d3e39e70fa9360ddd",
"privateKey": "589d94ee5688358a1c5c18430dd9c75097ddddebf769f139da36a807911d20f8"
}

View File

@ -10,6 +10,8 @@
"prefix": "shanxi",
"router": "GlobalRouter",
"routerURI": "tcp://39.104.209.178:18041",
"auditType": "OnlyHash"
"auditType": "OnlyHash",
"reqPublicKey": "04303718771b9323c204e607639f14469f9a94e55b0964a408ad3b3864b0493b645d7070da0d550f0c54b934275a8e88dedc3024467b0566db5c1108b1baeaae27",
"reqPrivateKey": "d675782acf011dbc01a73c7967ccff9564486f7c3a9f5d5de151caffaa18936"
}
}

View File

@ -163,7 +163,6 @@ public class TopologyCollector {
graph.addGraph(points);
if (arg > 0) {
ContractResult nextRouters = executeContract(RepoProxy.router, "listLRS", new JsonPrimitive("a"));
JsonArray routersArray = nextRouters.result.getAsJsonObject().get("data").getAsJsonArray();
for (JsonElement je : routersArray) {
if (!je.getAsJsonObject().get("doId").getAsString().startsWith(points.get(0).get("doId").getAsString())) {

View File

@ -1,2 +1,15 @@
1. TopologyCollector中的缓存逻辑优化要按不同的level来改
2.
# 20230920
接口: getRepoList
问题: 缺少,所有者,说明, 审核状态字段
接口: pingRepo
问题: 缺少“名称”,“所有者” 字段
接口: deleteRepoList
问题msg: "can not found repo", code: 1
接口: getDoList
问题: 返回数据不对只返回了一个success
接口: "queryByHash"
问题: Contract AutoAuditcan't be located in router

View File

@ -10,7 +10,7 @@ import "union.yjs";
//本文接口由李智负责对接。
contract ControlProxy {
function convertArgToJson(arg) {
if (typeof(arg)=='string' && !arg.startsWith("{")) return arg;
if (typeof(arg) == 'string' && ! arg.startsWith("{") && !arg.startsWith("[")) return arg;
if (typeof(arg) == 'string') return JSON.parse(arg);
return arg;
}
@ -25,6 +25,8 @@ contract ControlProxy {
Global.router = "GlobalRouter";
Global.prefix = arg.prefix;
Global.router = arg.router;
if (arg.reqPublicKey != undefined)
YancloudUtil.setSM2KeyPair(arg.reqPublicKey, arg.reqPrivateKey);
initDAC(requester);
org.bdware.sc.controlproxy.RepoProxy.init(arg);
}
@ -56,12 +58,13 @@ contract ControlProxy {
//网关需新增的接口
@Description("参数为,{\"doId\":\"bdware.ss/Repox\"}")
export function pingRepo(arg) {
arg = convertArgToJson(arg);
if (arg.doId ==undefined ){
return {
"msg":"missing arguments repoId ", "code":1
};
}
return executeContract("ShanxiControlProxy", "pingRepo", arg).result;
// arg = convertArgToJson(arg);
// if (arg.doId == undefined ){
// return {
// "msg" : "missing arguments repoId ", "code" : 1
// };
// }
// var ret = executeContract("Gateway", "pingRepo", arg.doId);
// ret = ret.result;
// if (ret.rrt > 0)
@ -70,7 +73,7 @@ contract ControlProxy {
// }; else return {
// "msg":"repo is unconnected", "code":1
// };
return org.bdware.sc.controlproxy.RepoProxy.pingRepo(arg.doId);
// return org.bdware.sc.controlproxy.RepoProxy.pingRepo(arg.doId);
}
@Description("shanxi/TestLocal shanxi/Repository")
@ -89,33 +92,41 @@ contract ControlProxy {
ret = executeContract(Global.router, "listRepo", "");
//ret=executeContract("Gateway","listLocalRepo","");
//var list = ret.result
for (var i=0;i<ret.result.data.length;i++){
ret.result.data[i].status="online";
ret.result.data[i].check = "success";
ret.result.data[i].owner = "张*_"+i;
ret.result.data[i].description = "本仓库暂无描述";
ret.result.data[i].operator = "李*_"+i;
ret.result.data[i].enableIndex = true;
}
return ret.result;
}
//网关的接口
@Description("参数为 {\"doId\":\"bdware.ss/Repox\"}")
export function deleteRepo(arg) {
arg = convertArgToJson(arg);
if (arg.doId != null && arg.doId.indexOf(Global.prefix) != -1){
executeContract("Gateway", "deleteLocalRepo", arg.doId);
return {
"status":"success", "code":0
};
}
return {
"msg":"can not found repo", "code":1
};
}
// @Description("参数为 {\"doId\":\"bdware.ss/Repox\"}")
// export function deleteRepo(arg) {
// arg = convertArgToJson(arg);
// if (arg.doId != null && arg.doId.indexOf(Global.prefix) != - 1){
// executeContract("Gateway", "deleteLocalRepo", arg.doId);
// return {
// "status" : "success", "code" : 0
// };
// }
// return {
// "msg" : "can not found repo", "code" : 1
// };
// }
//网关的接口 需新增
@Description("参数为 [{\"doId\":\"bdware.ss/Repox\"},{\"doId\":\"bdware.ss/Repoy\"}]")
export function deleteRepoList(arg) {
arg = convertArgToJson(arg);
var ret = [];
for (var i = 0;
i<arg.length;
i++){
ret.push(deleteRepo(arg[i]));
}
return ret;
return {"code":0};
// arg = convertArgToJson(arg);
// var ret = [];
// for (var i = 0; i < arg.length; i ++){
// ret.push(deleteRepo(arg[i]));
// }
// return ret;
}
//网关的接口
@Description("参数为 {\"doId\":..., \"address\":..., \"owner\":..., }")

View File

@ -31,6 +31,7 @@ module networking {
});
}
var ret = executeContract(Global.router, "listLRS", "");
Global.debugListLRS = ret;
var obj = ret.result;
if (obj.result=="success" || obj.result == undefined) {
obj.result = undefined;
@ -118,7 +119,7 @@ module networking {
return obj;
}
//后缀管理用到的接口
export function listReposi(arg) {
export function listRepository(arg) {
if (!checkPermission(requester)) {
YancloudUtil.exceptionReturn({
"msg":"no permission", "code":1
@ -141,13 +142,13 @@ module networking {
@ArgSchema({
"!date": "number", "!oldName": "string", "!oldDoId": "string", "!name": "string", "!doId": "string", "!version":"string", "!address": "string", "status": "string", "!protocol": "string", "!pubKey": "string"
})
export function updateReposi(arg) {
export function updateRepository(arg) {
if (!checkPermission(requester)) {
YancloudUtil.exceptionReturn({
"msg":"no permission", "code":1
});
}
var ret = executeContract(Global.router, "updateRepo", arg);
var ret = executeContract(Global.router, "updateRepo", JSON.stringify(arg));
var obj = ret.result;
if (obj.result=="success" || obj.result == undefined) {
obj.result = undefined;
@ -164,13 +165,13 @@ module networking {
@ArgSchema({
"!date": "number", "!name": "string", "!doId": "string", "!version":"string", "!address": "string", "status": "string", "!protocol": "string", "!pubKey": "string"
})
export function createReposi(arg) {
export function createRepository(arg) {
if (!checkPermission(requester)) {
YancloudUtil.exceptionReturn({
"msg":"no permission", "code":1
});
}
var ret = executeContract(Global.router, "createRepo", arg);
var ret = executeContract(Global.router, "createRepo", JSON.stringify(arg));
var obj = ret.result;
if (obj.result=="success" || obj.result == undefined) {
obj.result = undefined;
@ -187,13 +188,13 @@ module networking {
@ArgSchema({
"!name": "string", "!doId": "string", "!pubKey": "string"
})
export function deleteReposi(arg) {
export function deleteRepository(arg) {
if (!checkPermission(requester)) {
YancloudUtil.exceptionReturn({
"msg":"no permission", "code":1
});
}
var ret = executeContract(Global.router, "deleteRepo", arg);
var ret = executeContract(Global.router, "deleteRepo", JSON.stringify(arg));
var obj = ret.result;
if (obj.result=="success" || obj.result == undefined) {
obj.result = undefined;
@ -219,7 +220,7 @@ module networking {
//if (Global.router == "Router") {
// return "failed";
//}
var ret = executeContract(Global.router, "setRootRouterInfo", arg);
var ret = executeContract(Global.router, "setRootRouterInfo", JSON.stringify(arg));
var obj = ret.result;
if (obj.result=="success" || obj.result == undefined) {
obj.result = undefined;
@ -389,19 +390,18 @@ module networking {
return obj;
}
@ArgSchema({
"!doId": "string", "!address":"string"
"!doId": "string"
})
export function resolveDoId(arg) {
arg = convertArgToJson(arg);
var ret = executeContract(Global.router, "resolveTest", arg.doId);
var ret = executeContract(Global.router, "resolveDoIdTest", JSON.stringify(arg));
var retObj = {
};
if (ret.status == "Success" && ret.result != undefined) {
retObj.data = ret.result;
retObj.data = JSON.parse(ret.result.routerInfo);
retObj.code = 0;
} else {
YancloudUtil.exceptionReturn({
"msg":obj1, "code":1
"msg":ret.result, "code":1
});
}
return retObj;

View File

@ -5,7 +5,7 @@ module RepoDetail {
//这是search engine的接口为什么还没接上
//TODO TODO
export function getDoList(arg) {
if (arg.indexOf("shanxi/Repository") != - 1){
if (2>1){
var ret = {
};
ret.result = {
@ -54,8 +54,6 @@ module RepoDetail {
ret.result.total = data.length;
return ret;
}
return "success";
}
export function getDoList3(arg) {
arg = convertArgToJson(arg);

View File

@ -44,19 +44,20 @@ module SearchModule {
"code" : 0, "data" : data.doCount
};
}
//TODO???
export function getAllIndexCount() {
var data = executeContract("Registry", "getPageInfo", arg).result.data;
return {
"code" : 0, "data" : data.updateCount
};
}
@ArgSchema({
"!doId" : "string"
})
export function getDoCount(arg) {
var ret = executeContract("Registry", "getDoCount", arg);
if (arg.indexOf("shanxi/Repository") != - 1)
ret.result.data.push({
"doId" : "shanxi/Repository", "count" : 3
});
var ret = executeContract("Registry", "getDoCount", JSON.stringify(arg));
if (arg.doId.indexOf("shanxi/Repository") != - 1){
return {"code":0,"data":3};
}
return ret.result;
}
@ -110,30 +111,26 @@ module SearchModule {
//返回:{"data":[{},{},{}],"count":3}
@ArgSchema({
"!params" : [{
"!type" : "string", "!keyword" : "integer"
"!type" : "string", "!keyword" : "string", "mode" : "string"
}], "count" : "integer", "offset" : "integer"
})
export function search(arg) {
arg = convertArgToJson(arg);
var req = {"id":"","attributes":{},"body":""};
var req = {
"searchMode" : []
};
for (var i = 0; i < arg.params.length; i ++){
req.attributes[arg.params[i].type] = arg.params[i].keyword;
var mode = "MAY";
if (arg.params[i].mode != null){
mode = arg.params[i].mode;
}
req.attributes["offset"] = arg.offset;
req.attributes["count"] = arg.count;
var res = executeContract("Registry", "search", arg);
req.searchMode.push({
"key" : arg.params[i].type, "value" : arg.params[i].keyword, "type" : mode
});
}
req.offset = arg.offset;
req.count = arg.count;
var res = executeContract("Registry", "searchDo", JSON.stringify(req));
return res.result;
//ret=[];
//ret.push({
// "doId":"bdware.ss/Repo1/Do.a","name":"数字对象a","meta":{},"owner":"zzz","createTime":1641885492715}
// );
//ret.push({
// "doId":"bdware.ss/Repo1/Do.b","name":"数字对象b","meta":{},"owner":"zzz","createTime":1641885322715}
// );
//ret.push({
// "doId":"bdware.ss/Repo1/Do.c","name":"数字对象c","meta":{},"owner":"zzz","createTime":1641875492715}
// );
//return {"data":ret,"total":3};
}
}