use of io.bitsquare.common.crypto.Hash in project bitsquare by bitsquare.
the class P2PDataStorage method printData.
private void printData(String info) {
if (LoggerFactory.getLogger(Log.class).isInfoEnabled() || LoggerFactory.getLogger(Log.class).isDebugEnabled()) {
StringBuilder sb = new StringBuilder("\n\n------------------------------------------------------------\n");
sb.append("Data set ").append(info).append(" operation");
// We print the items sorted by hash with the payload class name and id
List<Tuple2<String, ProtectedStorageEntry>> tempList = map.values().stream().map(e -> new Tuple2<>(org.bitcoinj.core.Utils.HEX.encode(getHashAsByteArray(e.getStoragePayload()).bytes), e)).collect(Collectors.toList());
tempList.sort((o1, o2) -> o1.first.compareTo(o2.first));
tempList.stream().forEach(e -> {
final ProtectedStorageEntry storageEntry = e.second;
final StoragePayload storagePayload = storageEntry.getStoragePayload();
final MapValue mapValue = sequenceNumberMap.get(getHashAsByteArray(storagePayload));
sb.append("\n").append("Hash=").append(e.first).append("; Class=").append(storagePayload.getClass().getSimpleName()).append("; SequenceNumbers (Object/Stored)=").append(storageEntry.sequenceNumber).append(" / ").append(mapValue != null ? mapValue.sequenceNr : "null").append("; TimeStamp (Object/Stored)=").append(storageEntry.creationTimeStamp).append(" / ").append(mapValue != null ? mapValue.timeStamp : "null").append("; Payload=").append(Utilities.toTruncatedString(storagePayload));
});
sb.append("\n------------------------------------------------------------\n");
log.debug(sb.toString());
log.debug("Data set " + info + " operation: size=" + map.values().size());
}
}
Aggregations