Search in sources :

Example 1 with JsonFileManager

use of bisq.common.storage.JsonFileManager in project bisq-core by bisq-network.

the class JsonBlockChainExporter method init.

private void init(@Named(Storage.STORAGE_DIR) File storageDir, @Named(DaoOptionKeys.DUMP_BLOCKCHAIN_DATA) boolean dumpBlockchainData) {
    if (dumpBlockchainData) {
        txDir = new File(Paths.get(storageDir.getAbsolutePath(), "tx").toString());
        txOutputDir = new File(Paths.get(storageDir.getAbsolutePath(), "txo").toString());
        bsqBlockChainDir = new File(Paths.get(storageDir.getAbsolutePath(), "all").toString());
        try {
            if (txDir.exists())
                FileUtil.deleteDirectory(txDir);
            if (txOutputDir.exists())
                FileUtil.deleteDirectory(txOutputDir);
            if (bsqBlockChainDir.exists())
                FileUtil.deleteDirectory(bsqBlockChainDir);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (!txDir.mkdir())
            log.warn("make txDir failed.\ntxDir=" + txDir.getAbsolutePath());
        if (!txOutputDir.mkdir())
            log.warn("make txOutputDir failed.\ntxOutputDir=" + txOutputDir.getAbsolutePath());
        if (!bsqBlockChainDir.mkdir())
            log.warn("make bsqBsqBlockChainDir failed.\nbsqBsqBlockChainDir=" + bsqBlockChainDir.getAbsolutePath());
        txFileManager = new JsonFileManager(txDir);
        txOutputFileManager = new JsonFileManager(txOutputDir);
        bsqBlockChainFileManager = new JsonFileManager(bsqBlockChainDir);
    }
}
Also used : IOException(java.io.IOException) JsonFileManager(bisq.common.storage.JsonFileManager) File(java.io.File)

Aggregations

JsonFileManager (bisq.common.storage.JsonFileManager)1 File (java.io.File)1 IOException (java.io.IOException)1