use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.
the class GraphStoreFixture method directStoreAccess.
public DirectStoreAccess directStoreAccess() {
if (directStoreAccess == null) {
fileSystem = new DefaultFileSystemAbstraction();
PageCache pageCache = getPageCache(fileSystem);
LogProvider logProvider = NullLogProvider.getInstance();
StoreFactory storeFactory = new StoreFactory(directory, pageCache, fileSystem, logProvider);
neoStore = storeFactory.openAllNeoStores();
StoreAccess nativeStores;
if (keepStatistics) {
AccessStatistics accessStatistics = new AccessStatistics();
statistics = new VerboseStatistics(accessStatistics, new DefaultCounts(defaultConsistencyCheckThreadsNumber()), NullLog.getInstance());
nativeStores = new AccessStatsKeepingStoreAccess(neoStore, accessStatistics);
} else {
statistics = Statistics.NONE;
nativeStores = new StoreAccess(neoStore);
}
nativeStores.initialize();
Config config = Config.empty();
OperationalMode operationalMode = OperationalMode.single;
IndexStoreView indexStoreView = new NeoStoreIndexStoreView(LockService.NO_LOCK_SERVICE, nativeStores.getRawNeoStores());
Dependencies dependencies = new Dependencies();
dependencies.satisfyDependencies(Config.defaults(), fileSystem, new SimpleLogService(logProvider, logProvider), indexStoreView, pageCache);
KernelContext kernelContext = new SimpleKernelContext(directory, UNKNOWN, dependencies);
LabelScanStore labelScanStore = startLabelScanStore(config, dependencies, kernelContext);
directStoreAccess = new DirectStoreAccess(nativeStores, labelScanStore, createIndexes(fileSystem, config, operationalMode));
}
return directStoreAccess;
}
use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.
the class DumpStoreChain method dump.
void dump(File storeDir) throws IOException {
try (DefaultFileSystemAbstraction fs = new DefaultFileSystemAbstraction();
PageCache pageCache = createPageCache(fs)) {
DefaultIdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(fs);
Config config = Config.defaults();
StoreFactory storeFactory = new StoreFactory(storeDir, config, idGeneratorFactory, pageCache, fs, logProvider());
try (NeoStores neoStores = storeFactory.openNeoStores(getStoreTypes())) {
RecordStore<RECORD> store = store(neoStores);
RECORD record = store.newRecord();
for (long next = first; next != -1; ) {
store.getRecord(next, record, RecordLoad.FORCE);
System.out.println(record);
next = next(record);
}
}
}
}
use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.
the class RsdrMain method main.
public static void main(String[] args) throws IOException {
try (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction()) {
console.printf("Neo4j Raw Store Diagnostics Reader%n");
if (args.length != 1 || !fileSystem.isDirectory(new File(args[0]))) {
console.printf("Usage: rsdr <store directory>%n");
return;
}
File storedir = new File(args[0]);
Config config = buildConfig();
try (PageCache pageCache = createPageCache(fileSystem, config)) {
File neoStore = new File(storedir, MetaDataStore.DEFAULT_NAME);
StoreFactory factory = openStore(fileSystem, neoStore, config, pageCache);
NeoStores neoStores = factory.openAllNeoStores();
interact(fileSystem, neoStores);
}
}
}
use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.
the class DumpCountsStore method dumpCountsStore.
public static void dumpCountsStore(FileSystemAbstraction fs, File path, PrintStream out) throws IOException {
try (PageCache pages = createPageCache(fs);
Lifespan life = new Lifespan()) {
if (fs.isDirectory(path)) {
StoreFactory factory = new StoreFactory(path, pages, fs, NullLogProvider.getInstance());
NeoStores neoStores = factory.openAllNeoStores();
SchemaStorage schemaStorage = new SchemaStorage(neoStores.getSchemaStore());
neoStores.getCounts().accept(new DumpCountsStore(out, neoStores, schemaStorage));
} else {
VisitableCountsTracker tracker = new VisitableCountsTracker(NullLogProvider.getInstance(), fs, pages, Config.empty(), path);
if (fs.fileExists(path)) {
tracker.visitFile(path, new DumpCountsStore(out));
} else {
life.add(tracker).accept(new DumpCountsStore(out));
}
}
}
}
use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.
the class OnDiskLastTxIdGetterTest method lastTransactionIdIsBaseTxIdWhileNeoStoresAreStopped.
@Test
public void lastTransactionIdIsBaseTxIdWhileNeoStoresAreStopped() {
final StoreFactory storeFactory = new StoreFactory(new File("store"), pageCacheRule.getPageCache(fs.get()), fs.get(), NullLogProvider.getInstance());
final NeoStores neoStores = storeFactory.openAllNeoStores(true);
neoStores.close();
LongSupplier supplier = () -> neoStores.getMetaDataStore().getLastCommittedTransactionId();
OnDiskLastTxIdGetter diskLastTxIdGetter = new OnDiskLastTxIdGetter(supplier);
assertEquals(TransactionIdStore.BASE_TX_ID, diskLastTxIdGetter.getLastTxId());
}
Aggregations