Пример #1
0
 private void recalcHashes(DataNode item) throws IOException {
   if (item.dirty == null) {
     return; // not dirty, which means no children are dirty
   }
   // only directories have derived hashes
   if (item instanceof DirectoryNode) {
     DirectoryNode dirNode = (DirectoryNode) item;
     for (DataNode child : dirNode) {
       recalcHashes(child);
     }
     ByteArrayOutputStream bout = new ByteArrayOutputStream();
     hashCalc.sort(dirNode.getChildren());
     String newHash = hashCalc.calcHash(dirNode, bout);
     item.setHash(newHash);
     byte[] arrTriplets = bout.toByteArray();
     blobStore.setBlob(newHash, arrTriplets);
     log.info(
         "recalcHashes: "
             + item.name
             + " children:"
             + dirNode.members.size()
             + " hash="
             + newHash);
   }
 }