use of org.neo4j.com.ToFileStoreWriter in project graphdb by neo4j-attic.
the class OnlineBackup method full.
public OnlineBackup full(String targetDirectory) {
if (directoryContainsDb(targetDirectory)) {
throw new RuntimeException(targetDirectory + " already contains a database");
}
// TODO OMG this is ugly
BackupClient client = new BackupClient(hostNameOrIp, port, new NotYetExistingGraphDatabase(targetDirectory));
try {
Response<Void> response = client.fullBackup(new ToFileStoreWriter(targetDirectory));
GraphDatabaseService targetDb = startTemporaryDb(targetDirectory);
try {
unpackResponse(response, targetDb, MasterUtil.txHandlerForFullCopy());
} finally {
targetDb.shutdown();
}
} finally {
client.shutdown();
// TODO This is also ugly
StringLogger.close(targetDirectory);
}
return this;
}
use of org.neo4j.com.ToFileStoreWriter in project graphdb by neo4j-attic.
the class HighlyAvailableGraphDatabase method copyStoreFromMaster.
private void copyStoreFromMaster(Pair<Master, Machine> master) throws Exception {
msgLog.logMessage("Copying store from master");
Response<Void> response = master.first().copyStore(new SlaveContext(machineId, 0, new Pair[0]), new ToFileStoreWriter(storeDir));
EmbeddedGraphDatabase tempDb = new EmbeddedGraphDatabase(storeDir);
try {
MasterUtil.applyReceivedTransactions(response, tempDb, MasterUtil.txHandlerForFullCopy());
} finally {
tempDb.shutdown();
}
msgLog.logMessage("Done copying store from master");
}
Aggregations