use of org.neo4j.storageengine.api.StorageEngineFactory in project neo4j by neo4j.
the class LogFilesBuilder method readOnlyTransactionIdStore.
private TransactionIdStore readOnlyTransactionIdStore() throws IOException {
StorageEngineFactory storageEngineFactory = StorageEngineFactory.defaultStorageEngine();
var pageCacheTracer = databaseTracers.getPageCacheTracer();
try (var cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer(READ_ONLY_TRANSACTION_STORE_READER_TAG))) {
return storageEngineFactory.readOnlyTransactionIdStore(fileSystem, databaseLayout, pageCache, cursorContext);
}
}
use of org.neo4j.storageengine.api.StorageEngineFactory in project neo4j by neo4j.
the class TransactionLogsInSeparateLocationIT method databaseWithTransactionLogsInSeparateAbsoluteLocation.
@Test
void databaseWithTransactionLogsInSeparateAbsoluteLocation() throws IOException {
Path txDirectory = testDirectory.directory("transaction-logs");
Config config = Config.newBuilder().set(neo4j_home, testDirectory.homePath()).set(transaction_logs_root_path, txDirectory.toAbsolutePath()).build();
DatabaseLayout layout = DatabaseLayout.of(config);
StorageEngineFactory storageEngineFactory = performTransactions(txDirectory.toAbsolutePath(), layout.databaseDirectory());
verifyTransactionLogs(layout.getTransactionLogsDirectory(), layout.databaseDirectory(), storageEngineFactory);
}
use of org.neo4j.storageengine.api.StorageEngineFactory in project neo4j by neo4j.
the class TransactionLogsInSeparateLocationIT method performTransactions.
private static StorageEngineFactory performTransactions(Path txPath, Path storeDir) {
DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder(storeDir).setConfig(transaction_logs_root_path, txPath).build();
GraphDatabaseService database = managementService.database(DEFAULT_DATABASE_NAME);
for (int i = 0; i < 10; i++) {
try (Transaction transaction = database.beginTx()) {
Node node = transaction.createNode();
node.setProperty("a", "b");
node.setProperty("c", "d");
transaction.commit();
}
}
StorageEngineFactory storageEngineFactory = ((GraphDatabaseAPI) database).getDependencyResolver().resolveDependency(StorageEngineFactory.class);
managementService.shutdown();
return storageEngineFactory;
}
use of org.neo4j.storageengine.api.StorageEngineFactory in project neo4j by neo4j.
the class StoreInfoCommand method execute.
@Override
public void execute() {
var storageEngineFactory = StorageEngineFactory.defaultStorageEngine();
var config = CommandHelpers.buildConfig(ctx, allowCommandExpansion);
var neo4jLayout = Neo4jLayout.of(config);
try (var fs = ctx.fs();
var jobScheduler = createInitialisedScheduler();
var pageCache = StandalonePageCacheFactory.createPageCache(fs, jobScheduler, PageCacheTracer.NULL)) {
validatePath(fs, all, path, neo4jLayout);
if (all) {
var collector = structured ? Collectors.joining(",", "[", "]") : Collectors.joining(System.lineSeparator() + System.lineSeparator());
var result = Arrays.stream(fs.listFiles(path)).sorted(comparing(Path::getFileName)).map(dbPath -> neo4jLayout.databaseLayout(dbPath.getFileName().toString())).filter(dbLayout -> Validators.isExistingDatabase(fs, dbLayout)).map(dbLayout -> printInfo(fs, dbLayout, pageCache, storageEngineFactory, config, structured, true)).collect(collector);
ctx.out().println(result);
} else {
var databaseLayout = neo4jLayout.databaseLayout(path.getFileName().toString());
ctx.out().println(printInfo(fs, databaseLayout, pageCache, storageEngineFactory, config, structured, false));
}
} catch (CommandFailedException e) {
throw e;
} catch (Exception e) {
throw new CommandFailedException(format("Failed to execute command: '%s'.", e.getMessage()), e);
}
}
Aggregations