Search in sources :

Example 31 with StoreFactory

use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.

the class RecordStorageEngineFactory method schemaRuleMigrationAccess.

@Override
public SchemaRuleMigrationAccess schemaRuleMigrationAccess(FileSystemAbstraction fs, PageCache pageCache, Config config, DatabaseLayout databaseLayout, LogService logService, String recordFormats, PageCacheTracer cacheTracer, CursorContext cursorContext, MemoryTracker memoryTracker) {
    RecordFormats formats = selectForVersion(recordFormats);
    StoreFactory factory = new StoreFactory(databaseLayout, config, new DefaultIdGeneratorFactory(fs, immediate(), databaseLayout.getDatabaseName()), pageCache, fs, formats, logService.getInternalLogProvider(), cacheTracer, writable(), immutable.empty());
    NeoStores stores = factory.openNeoStores(true, StoreType.SCHEMA, StoreType.PROPERTY_KEY_TOKEN, StoreType.PROPERTY);
    try {
        stores.start(cursorContext);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return createMigrationTargetSchemaRuleAccess(stores, cursorContext, memoryTracker);
}
Also used : RecordFormats(org.neo4j.kernel.impl.store.format.RecordFormats) NeoStores(org.neo4j.kernel.impl.store.NeoStores) DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) UncheckedIOException(java.io.UncheckedIOException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory)

Example 32 with StoreFactory

use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.

the class DumpStore method main.

public static void main(String... args) throws Exception {
    if (args == null || args.length == 0) {
        System.err.println("SYNTAX: [file[:id[,id]*]]+");
        return;
    }
    try (DefaultFileSystemAbstraction fs = new DefaultFileSystemAbstraction();
        PageCache pageCache = createPageCache(fs)) {
        final DefaultIdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(fs);
        Function<File, StoreFactory> createStoreFactory = file -> new StoreFactory(file.getParentFile(), Config.defaults(), idGeneratorFactory, pageCache, fs, logProvider());
        for (String arg : args) {
            dumpFile(createStoreFactory, arg);
        }
    }
}
Also used : LogProvider(org.neo4j.logging.LogProvider) StandalonePageCacheFactory.createPageCache(org.neo4j.io.pagecache.impl.muninn.StandalonePageCacheFactory.createPageCache) Token(org.neo4j.storageengine.api.Token) NullLogProvider(org.neo4j.logging.NullLogProvider) Function(java.util.function.Function) ByteBuffer(java.nio.ByteBuffer) NeoStores(org.neo4j.kernel.impl.store.NeoStores) AbstractBaseRecord(org.neo4j.kernel.impl.store.record.AbstractBaseRecord) FormattedLogProvider(org.neo4j.logging.FormattedLogProvider) CommonAbstractStore(org.neo4j.kernel.impl.store.CommonAbstractStore) TokenRecord(org.neo4j.kernel.impl.store.record.TokenRecord) PrintStream(java.io.PrintStream) PageCache(org.neo4j.io.pagecache.PageCache) Config(org.neo4j.kernel.configuration.Config) DefaultIdGeneratorFactory(org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory) FORCE(org.neo4j.kernel.impl.store.record.RecordLoad.FORCE) SchemaStorage(org.neo4j.kernel.impl.store.SchemaStorage) SchemaStore(org.neo4j.kernel.impl.store.SchemaStore) TokenStore(org.neo4j.kernel.impl.store.TokenStore) PrintStreamLogger(org.neo4j.logging.PrintStreamLogger) File(java.io.File) DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) RecordStore(org.neo4j.kernel.impl.store.RecordStore) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) HexPrinter(org.neo4j.kernel.impl.util.HexPrinter) StoreType(org.neo4j.kernel.impl.store.StoreType) NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) NodeStore(org.neo4j.kernel.impl.store.NodeStore) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) DefaultIdGeneratorFactory(org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) File(java.io.File) StandalonePageCacheFactory.createPageCache(org.neo4j.io.pagecache.impl.muninn.StandalonePageCacheFactory.createPageCache) PageCache(org.neo4j.io.pagecache.PageCache)

Example 33 with StoreFactory

use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.

the class RsdrMain method openStore.

private static StoreFactory openStore(FileSystemAbstraction fileSystem, File storeDir, Config config, PageCache pageCache) {
    IdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(fileSystem);
    NullLogProvider logProvider = NullLogProvider.getInstance();
    return new StoreFactory(storeDir, config, idGeneratorFactory, pageCache, fileSystem, logProvider);
}
Also used : DefaultIdGeneratorFactory(org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory) IdGeneratorFactory(org.neo4j.kernel.impl.store.id.IdGeneratorFactory) DefaultIdGeneratorFactory(org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory) NullLogProvider(org.neo4j.logging.NullLogProvider) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory)

Example 34 with StoreFactory

use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.

the class PropertyDeduplicator method deduplicateProperties.

public void deduplicateProperties() throws IOException {
    StoreFactory factory = new StoreFactory(workingDir, pageCache, fileSystem, NullLogProvider.getInstance());
    try (NeoStores neoStores = factory.openNeoStores(StoreType.PROPERTY, StoreType.NODE, StoreType.SCHEMA)) {
        PropertyStore propertyStore = neoStores.getPropertyStore();
        NodeStore nodeStore = neoStores.getNodeStore();
        SchemaStore schemaStore = neoStores.getSchemaStore();
        PrimitiveLongObjectMap<List<DuplicateCluster>> duplicateClusters = collectConflictingProperties(propertyStore);
        resolveConflicts(duplicateClusters, propertyStore, nodeStore, schemaStore, neoStores.getStoreDir());
    }
}
Also used : NodeStore(org.neo4j.kernel.impl.store.NodeStore) SchemaStore(org.neo4j.kernel.impl.store.SchemaStore) NeoStores(org.neo4j.kernel.impl.store.NeoStores) ArrayList(java.util.ArrayList) List(java.util.List) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) PropertyStore(org.neo4j.kernel.impl.store.PropertyStore)

Example 35 with StoreFactory

use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.

the class ResponsePackerIT method createNeoStore.

private NeoStores createNeoStore(FileSystemAbstraction fs, PageCache pageCache) throws IOException {
    File storeDir = new File("/store/");
    fs.mkdirs(storeDir);
    StoreFactory storeFactory = new StoreFactory(storeDir, pageCache, fs, NullLogProvider.getInstance());
    return storeFactory.openAllNeoStores(true);
}
Also used : StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) File(java.io.File)

Aggregations

StoreFactory (org.neo4j.kernel.impl.store.StoreFactory)64 NeoStores (org.neo4j.kernel.impl.store.NeoStores)31 DefaultIdGeneratorFactory (org.neo4j.internal.id.DefaultIdGeneratorFactory)30 File (java.io.File)18 BeforeEach (org.junit.jupiter.api.BeforeEach)15 PageCache (org.neo4j.io.pagecache.PageCache)12 DefaultIdGeneratorFactory (org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory)11 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)7 MethodSource (org.junit.jupiter.params.provider.MethodSource)7 IOException (java.io.IOException)6 Path (java.nio.file.Path)6 Before (org.junit.Before)6 Test (org.junit.Test)6 Config (org.neo4j.configuration.Config)6 DefaultFileSystemAbstraction (org.neo4j.io.fs.DefaultFileSystemAbstraction)6 CursorContext (org.neo4j.io.pagecache.context.CursorContext)6 Config (org.neo4j.kernel.configuration.Config)6 LogProvider (org.neo4j.logging.LogProvider)6 NullLogProvider (org.neo4j.logging.NullLogProvider)6 ScanOnOpenOverwritingIdGeneratorFactory (org.neo4j.internal.id.ScanOnOpenOverwritingIdGeneratorFactory)5