File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
src/main/java/io/pwrlabs/database/rocksdb Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -459,9 +459,7 @@ public MerkleTree clone(String newTreeName) throws RocksDBException {
459459 File destDir = new File ("merkleTree/" + newTreeName );
460460
461461 if (destDir .exists ()) {
462- FileUtils .emptyDirectory (destDir );
463- } else {
464- destDir .mkdirs ();
462+ FileUtils .deleteDirectory (destDir );
465463 }
466464
467465 lock .writeLock ().lock ();
@@ -1131,4 +1129,12 @@ public boolean equals(Object obj) {
11311129 }
11321130 //endregion
11331131
1132+ public static void main (String [] args ) throws Exception {
1133+ MerkleTree tree = new MerkleTree ("tree1" );
1134+ tree .addOrUpdateData ("key1" .getBytes (), "value1" .getBytes ());
1135+
1136+ MerkleTree tree2 = tree .clone ("tree2" );
1137+ System .out .println (Hex .toHexString (tree2 .getData ("key1" .getBytes ())));
1138+ System .out .println ("ok" );
1139+ }
11341140}
You can’t perform that action at this time.
0 commit comments