mirror of
https://gitee.com/BDWare/cm
synced 2025-01-10 01:44:04 +00:00
update logs
This commit is contained in:
parent
cdf94fc50d
commit
8efc164d99
@ -139,18 +139,15 @@ public class ContractClient {
|
|||||||
String strEvent = get.syncGet("", "getDeclaredEvents", "");
|
String strEvent = get.syncGet("", "getDeclaredEvents", "");
|
||||||
LOGGER.debug("event: " + strEvent);
|
LOGGER.debug("event: " + strEvent);
|
||||||
contractMeta.declaredEvents = JsonUtil.fromJson(strEvent,
|
contractMeta.declaredEvents = JsonUtil.fromJson(strEvent,
|
||||||
new TypeToken<Map<String, REventSemantics>>() {
|
new TypeToken<Map<String, REventSemantics>>() {}.getType());
|
||||||
}.getType());
|
|
||||||
LOGGER.info("initProps ---- position-----3");
|
LOGGER.info("initProps ---- position-----3");
|
||||||
contractMeta.dependentContracts =
|
contractMeta.dependentContracts =
|
||||||
JsonUtil.fromJson(get.syncGet("", "getDependentContracts", ""),
|
JsonUtil.fromJson(get.syncGet("", "getDependentContracts", ""),
|
||||||
new TypeToken<Set<String>>() {
|
new TypeToken<Set<String>>() {}.getType());
|
||||||
}.getType());
|
|
||||||
LOGGER.info("initProps ---- position-----4");
|
LOGGER.info("initProps ---- position-----4");
|
||||||
contractMeta.exportedFunctions =
|
contractMeta.exportedFunctions =
|
||||||
JsonUtil.fromJson(get.syncGet("", "getExportedFunctions", ""),
|
JsonUtil.fromJson(get.syncGet("", "getExportedFunctions", ""),
|
||||||
new TypeToken<List<FunctionDesp>>() {
|
new TypeToken<List<FunctionDesp>>() {}.getType());
|
||||||
}.getType());
|
|
||||||
contractMeta.logDetail = new HashMap<>();
|
contractMeta.logDetail = new HashMap<>();
|
||||||
for (FunctionDesp func : contractMeta.exportedFunctions) {
|
for (FunctionDesp func : contractMeta.exportedFunctions) {
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder();
|
||||||
@ -180,8 +177,7 @@ public class ContractClient {
|
|||||||
|
|
||||||
String anno = get.syncGet("", "getAnnotations", "");
|
String anno = get.syncGet("", "getAnnotations", "");
|
||||||
contractMeta.annotations =
|
contractMeta.annotations =
|
||||||
JsonUtil.fromJson(anno, new TypeToken<List<AnnotationNode>>() {
|
JsonUtil.fromJson(anno, new TypeToken<List<AnnotationNode>>() {}.getType());
|
||||||
}.getType());
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// supoort contract process before version 0.70
|
// supoort contract process before version 0.70
|
||||||
@ -265,7 +261,7 @@ public class ContractClient {
|
|||||||
pbParameters.toArray(result);
|
pbParameters.toArray(result);
|
||||||
Constructor<ProcessBuilder> pbc =
|
Constructor<ProcessBuilder> pbc =
|
||||||
ProcessBuilder.class.getDeclaredConstructor(String[].class);
|
ProcessBuilder.class.getDeclaredConstructor(String[].class);
|
||||||
builder = pbc.newInstance(new Object[]{result});
|
builder = pbc.newInstance(new Object[] {result});
|
||||||
|
|
||||||
File directory = new File("./");
|
File directory = new File("./");
|
||||||
LOGGER.debug("[CMD] path: " + directory.getAbsolutePath());
|
LOGGER.debug("[CMD] path: " + directory.getAbsolutePath());
|
||||||
@ -330,7 +326,7 @@ public class ContractClient {
|
|||||||
} else {
|
} else {
|
||||||
LOGGER.info("setMember ignore, meta:" + (multiContractMeta == null)
|
LOGGER.info("setMember ignore, meta:" + (multiContractMeta == null)
|
||||||
+ (multiContractMeta == null ? "NULL"
|
+ (multiContractMeta == null ? "NULL"
|
||||||
: " members:" + multiContractMeta.getMembers()));
|
: " members:" + multiContractMeta.getMembers()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isBundlePath(contractMeta.contract.getScriptStr())) {
|
if (isBundlePath(contractMeta.contract.getScriptStr())) {
|
||||||
|
@ -104,7 +104,7 @@ public class ContractManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String convertToBytes(long traffic) {
|
private static String convertToBytes(long traffic) {
|
||||||
String[] unit = new String[]{"B", "KB", "MB", "GB", "TB"};
|
String[] unit = new String[] {"B", "KB", "MB", "GB", "TB"};
|
||||||
double d = traffic;
|
double d = traffic;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < unit.length - 1; i++) {
|
for (i = 0; i < unit.length - 1; i++) {
|
||||||
@ -368,7 +368,7 @@ public class ContractManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void checkPointToLedger(OnHashCallback cb, String contractID, String data,
|
public static void checkPointToLedger(OnHashCallback cb, String contractID, String data,
|
||||||
String requestID) {
|
String requestID) {
|
||||||
boolean isMaster = instance.getContractIsMaster(contractID);
|
boolean isMaster = instance.getContractIsMaster(contractID);
|
||||||
if (!isMaster) {
|
if (!isMaster) {
|
||||||
LOGGER.info("非合约 " + contractID + "的master,无需承担checkPoint上链任务!");
|
LOGGER.info("非合约 " + contractID + "的master,无需承担checkPoint上链任务!");
|
||||||
@ -898,8 +898,8 @@ public class ContractManager {
|
|||||||
config.setMockConfig(mockYPK);
|
config.setMockConfig(mockYPK);
|
||||||
// client.setProjectConfig(JsonUtil.toJson(config));
|
// client.setProjectConfig(JsonUtil.toJson(config));
|
||||||
} // else {
|
} // else {
|
||||||
// bubian
|
// bubian
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1182,7 +1182,7 @@ public class ContractManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void executeInternalAsync(ContractClient client, ContractRequest request,
|
private void executeInternalAsync(ContractClient client, ContractRequest request,
|
||||||
ResultCallback rcb, OnHashCallback cb) {
|
ResultCallback rcb, OnHashCallback cb) {
|
||||||
ContractResult cr;
|
ContractResult cr;
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
@ -1223,7 +1223,7 @@ public class ContractManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String executeInternal(ContractClient client, ContractRequest request,
|
private String executeInternal(ContractClient client, ContractRequest request,
|
||||||
OnHashCallback ocb) {
|
OnHashCallback ocb) {
|
||||||
// LOGGER.info("ContractManager executeInternal : ");
|
// LOGGER.info("ContractManager executeInternal : ");
|
||||||
|
|
||||||
ContractResult cr;
|
ContractResult cr;
|
||||||
@ -1254,7 +1254,7 @@ public class ContractManager {
|
|||||||
* @author Kaidong Wu
|
* @author Kaidong Wu
|
||||||
*/
|
*/
|
||||||
public void extractEventsFromContractResult(OnHashCallback ocb, JsonObject result,
|
public void extractEventsFromContractResult(OnHashCallback ocb, JsonObject result,
|
||||||
ContractClient client, ContractRequest request, long startTime) {
|
ContractClient client, ContractRequest request, long startTime) {
|
||||||
try {
|
try {
|
||||||
ContractResult cr = JsonUtil.fromJson(result, ContractResult.class);
|
ContractResult cr = JsonUtil.fromJson(result, ContractResult.class);
|
||||||
if (null != cr.events && !cr.events.isEmpty()) {
|
if (null != cr.events && !cr.events.isEmpty()) {
|
||||||
@ -1305,7 +1305,7 @@ public class ContractManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void executeContractInternal(ContractRequest cr, final ResultCallback rcb,
|
public void executeContractInternal(ContractRequest cr, final ResultCallback rcb,
|
||||||
final OnHashCallback hcb) {
|
final OnHashCallback hcb) {
|
||||||
LOGGER.debug(JsonUtil.toJson(cr));
|
LOGGER.debug(JsonUtil.toJson(cr));
|
||||||
ContractMeta meta = statusRecorder.getContractMeta(cr.getContractID());
|
ContractMeta meta = statusRecorder.getContractMeta(cr.getContractID());
|
||||||
MultiContractMeta multiMeta =
|
MultiContractMeta multiMeta =
|
||||||
@ -1795,15 +1795,14 @@ public class ContractManager {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public void addLocalContractLog(String action, String contractId, String contractName,
|
public void addLocalContractLog(String action, String contractId, String contractName,
|
||||||
String pubKey) {
|
String pubKey) {
|
||||||
String sb = "{\"action\":\"" + action + "\",\"pubKey\":\"" + pubKey + "\",\"contractID\":\""
|
String sb = "{\"action\":\"" + action + "\",\"pubKey\":\"" + pubKey + "\",\"contractID\":\""
|
||||||
+ contractId + "\",\"contractName\":\"" + contractName + "\",\"date\":"
|
+ contractId + "\",\"contractName\":\"" + contractName + "\",\"date\":"
|
||||||
+ System.currentTimeMillis() + "}";
|
+ System.currentTimeMillis() + "}";
|
||||||
logsDB.put(contractName, sb);
|
logsDB.put(contractName, sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changePermission(String contractFileName, String pmList) {
|
public void changePermission(String contractFileName, String pmList) {}
|
||||||
}
|
|
||||||
|
|
||||||
// public String getSyncType(String contractName) {
|
// public String getSyncType(String contractName) {
|
||||||
// ContractClient client = getByName(contractName);
|
// ContractClient client = getByName(contractName);
|
||||||
@ -1854,8 +1853,8 @@ public class ContractManager {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
public void addLocalContractLog(String action, String contractId, String contractName,
|
public void addLocalContractLog(String action, String contractId, String contractName,
|
||||||
String pubKey, String function, String costTime, long totalGas, long executionGas,
|
String pubKey, String function, String costTime, long totalGas, long executionGas,
|
||||||
long extraGas, Map<String, String> logType) {
|
long extraGas, Map<String, String> logType) {
|
||||||
contractCounter.inc();
|
contractCounter.inc();
|
||||||
if (logType == null || logType.isEmpty()) {
|
if (logType == null || logType.isEmpty()) {
|
||||||
logsDB.put(contractName,
|
logsDB.put(contractName,
|
||||||
|
Loading…
Reference in New Issue
Block a user