This commit is contained in:
Andrea Cavalli 2019-04-17 18:19:01 +02:00
parent 4c07228e54
commit dea0eea5b7
3 changed files with 13 additions and 4 deletions

View File

@ -17,7 +17,7 @@ public class ObjectStrangeDbList<T> extends StrangeDbList<T> {
return indices; return indices;
} }
public ObjectStrangeDbList() { protected ObjectStrangeDbList() {
super(); super();
} }

View File

@ -5,6 +5,7 @@ import it.cavallium.strangedb.java.objects.EnhancedObject;
import it.cavallium.strangedb.java.database.IDatabaseTools; import it.cavallium.strangedb.java.database.IDatabaseTools;
import java.io.IOException; import java.io.IOException;
import java.util.Collection;
import java.util.StringJoiner; import java.util.StringJoiner;
public abstract class StrangeDbList<T> extends EnhancedObject { public abstract class StrangeDbList<T> extends EnhancedObject {

View File

@ -264,14 +264,22 @@ public class Performance {
} }
public static void generateDb() throws IOException { public static void generateDb() throws IOException {
dbDataFile = Files.createFile(rootDirectory.resolve("db_data.dat")); dbDataFile = rootDirectory.resolve("db_data.dat");
dbBlocksFile = Files.createFile(rootDirectory.resolve("db_blocks.dat")); dbBlocksFile = rootDirectory.resolve("db_blocks.dat");
dbReferencesFile = Files.createFile(rootDirectory.resolve("db_references.dat")); dbReferencesFile = rootDirectory.resolve("db_references.dat");
deleteDbFolders();
Files.createFile(dbDataFile);
Files.createFile(dbBlocksFile);
Files.createFile(dbReferencesFile);
db = new DatabaseJava(dbDataFile, dbBlocksFile, dbReferencesFile); db = new DatabaseJava(dbDataFile, dbBlocksFile, dbReferencesFile);
} }
public static void deleteDb() throws IOException { public static void deleteDb() throws IOException {
db.close(); db.close();
deleteDbFolders();
}
public static void deleteDbFolders() throws IOException {
Files.deleteIfExists(dbDataFile); Files.deleteIfExists(dbDataFile);
Files.deleteIfExists(dbBlocksFile); Files.deleteIfExists(dbBlocksFile);
Files.deleteIfExists(dbReferencesFile); Files.deleteIfExists(dbReferencesFile);