Search in sources :

Example 1 with DatabaseFile

use of org.neo4j.io.layout.DatabaseFile in project neo4j by neo4j.

the class StoreMigratorFileOperation method fileOperation.

/**
 * Performs a file operation on a database's store files from one directory
 * to another. Remember that in the case of {@link FileOperation#MOVE moving files}, the way that's done is to
 * just rename files (the standard way of moving with JDK6) from and to must be on the same disk partition.
 *
 * @param fromLayout directory that hosts the database files.
 * @param toLayout directory to receive the database files.
 * @throws IOException if any of the operations fail for any reason.
 */
static void fileOperation(FileOperation operation, FileSystemAbstraction fs, DatabaseLayout fromLayout, DatabaseLayout toLayout, Iterable<DatabaseFile> databaseFiles, boolean allowSkipNonExistentFiles, boolean includeIdFile, ExistingTargetStrategy existingTargetStrategy) throws IOException {
    for (DatabaseFile databaseStore : databaseFiles) {
        Path[] files = includeIdFile ? fromLayout.allFiles(databaseStore).toArray(Path[]::new) : new Path[] { fromLayout.file(databaseStore) };
        perform(operation, fs, fromLayout, toLayout, allowSkipNonExistentFiles, existingTargetStrategy, files);
    }
}
Also used : Path(java.nio.file.Path) DatabaseFile(org.neo4j.io.layout.DatabaseFile)

Example 2 with DatabaseFile

use of org.neo4j.io.layout.DatabaseFile in project neo4j by neo4j.

the class BatchingNeoStores method deleteStoreFiles.

private void deleteStoreFiles(DatabaseLayout databaseLayout, Predicate<StoreType> storesToKeep) {
    for (StoreType type : StoreType.values()) {
        if (!storesToKeep.test(type)) {
            DatabaseFile databaseFile = type.getDatabaseFile();
            databaseLayout.allFiles(databaseFile).forEach(uncheckedConsumer(fileSystem::deleteFile));
        }
    }
}
Also used : StoreType(org.neo4j.kernel.impl.store.StoreType) DatabaseFile(org.neo4j.io.layout.DatabaseFile)

Aggregations

DatabaseFile (org.neo4j.io.layout.DatabaseFile)2 Path (java.nio.file.Path)1 StoreType (org.neo4j.kernel.impl.store.StoreType)1