Search in sources :

Example 61 with StoreFactory

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

the class PropertyDeleterTest method startStore.

private void startStore(boolean log) {
    Config config = Config.defaults(GraphDatabaseInternalSettings.log_inconsistent_data_deletion, log);
    idGeneratorFactory = new DefaultIdGeneratorFactory(directory.getFileSystem(), immediate(), "db");
    neoStores = new StoreFactory(DatabaseLayout.ofFlat(directory.homePath()), config, idGeneratorFactory, pageCache, directory.getFileSystem(), NullLogProvider.getInstance(), PageCacheTracer.NULL, writable()).openAllNeoStores(true);
    propertyStore = neoStores.getPropertyStore();
    propertyCreator = new PropertyCreator(propertyStore, traverser, NULL, INSTANCE);
    deleter = new PropertyDeleter(traverser, this.neoStores, new TokenNameLookup() {

        @Override
        public String labelGetName(int labelId) {
            return "" + labelId;
        }

        @Override
        public String relationshipTypeGetName(int relationshipTypeId) {
            return "" + relationshipTypeId;
        }

        @Override
        public String propertyKeyGetName(int propertyKeyId) {
            return "" + propertyKeyId;
        }
    }, logProvider, config, NULL, INSTANCE);
}
Also used : TokenNameLookup(org.neo4j.common.TokenNameLookup) Config(org.neo4j.configuration.Config) DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory)

Example 62 with StoreFactory

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

the class SchemaStorageReadAndWriteTest method before.

@BeforeAll
void before() throws Exception {
    testDirectory.prepareDirectory(getClass(), "test");
    var storeFactory = new StoreFactory(databaseLayout, Config.defaults(), new DefaultIdGeneratorFactory(fs, immediate(), databaseLayout.getDatabaseName()), pageCache, fs, NullLogProvider.getInstance(), PageCacheTracer.NULL, writable());
    neoStores = storeFactory.openNeoStores(true, StoreType.SCHEMA, StoreType.PROPERTY_KEY_TOKEN, StoreType.LABEL_TOKEN, StoreType.RELATIONSHIP_TYPE_TOKEN);
    AtomicInteger tokenIdCounter = new AtomicInteger();
    TokenCreator tokenCreator = (name, internal) -> tokenIdCounter.incrementAndGet();
    TokenHolders tokens = new TokenHolders(new DelegatingTokenHolder(tokenCreator, TokenHolder.TYPE_PROPERTY_KEY), new DelegatingTokenHolder(tokenCreator, TokenHolder.TYPE_LABEL), new DelegatingTokenHolder(tokenCreator, TokenHolder.TYPE_RELATIONSHIP_TYPE));
    tokens.setInitialTokens(StoreTokens.allTokens(neoStores), NULL);
    tokenIdCounter.set(Math.max(tokenIdCounter.get(), tokens.propertyKeyTokens().size()));
    tokenIdCounter.set(Math.max(tokenIdCounter.get(), tokens.labelTokens().size()));
    tokenIdCounter.set(Math.max(tokenIdCounter.get(), tokens.relationshipTypeTokens().size()));
    storage = new SchemaStorage(neoStores.getSchemaStore(), tokens, () -> KernelVersion.LATEST);
}
Also used : RepeatedTest(org.junit.jupiter.api.RepeatedTest) SchemaRule(org.neo4j.internal.schema.SchemaRule) TokenCreator(org.neo4j.token.TokenCreator) KernelVersion(org.neo4j.kernel.KernelVersion) Config(org.neo4j.configuration.Config) NullLogProvider(org.neo4j.logging.NullLogProvider) DatabaseLayout(org.neo4j.io.layout.DatabaseLayout) AfterAll(org.junit.jupiter.api.AfterAll) TokenHolder(org.neo4j.token.api.TokenHolder) TestInstance(org.junit.jupiter.api.TestInstance) NeoStores(org.neo4j.kernel.impl.store.NeoStores) Inject(org.neo4j.test.extension.Inject) BeforeAll(org.junit.jupiter.api.BeforeAll) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) DelegatingTokenHolder(org.neo4j.token.DelegatingTokenHolder) PageCacheTracer(org.neo4j.io.pagecache.tracing.PageCacheTracer) NULL(org.neo4j.io.pagecache.context.CursorContext.NULL) PageCache(org.neo4j.io.pagecache.PageCache) DatabaseReadOnlyChecker.writable(org.neo4j.configuration.helpers.DatabaseReadOnlyChecker.writable) TestDirectory(org.neo4j.test.rule.TestDirectory) EphemeralPageCacheExtension(org.neo4j.test.extension.pagecache.EphemeralPageCacheExtension) RecoveryCleanupWorkCollector.immediate(org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector.immediate) EphemeralNeo4jLayoutExtension(org.neo4j.test.extension.EphemeralNeo4jLayoutExtension) INSTANCE(org.neo4j.memory.EmptyMemoryTracker.INSTANCE) TokenHolders(org.neo4j.token.TokenHolders) EphemeralFileSystemAbstraction(org.neo4j.io.fs.EphemeralFileSystemAbstraction) DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) StoreType(org.neo4j.kernel.impl.store.StoreType) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) TokenHolders(org.neo4j.token.TokenHolders) TokenCreator(org.neo4j.token.TokenCreator) DelegatingTokenHolder(org.neo4j.token.DelegatingTokenHolder) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 63 with StoreFactory

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

the class RecordNodeCursorIT method startNeoStores.

@BeforeEach
void startNeoStores() {
    neoStores = new StoreFactory(DatabaseLayout.ofFlat(directory.homePath()), Config.defaults(), new DefaultIdGeneratorFactory(directory.getFileSystem(), immediate(), "db"), pageCache, directory.getFileSystem(), NullLogProvider.nullLogProvider(), PageCacheTracer.NULL, DatabaseReadOnlyChecker.writable()).openAllNeoStores(true);
    nodeStore = neoStores.getNodeStore();
}
Also used : DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 64 with StoreFactory

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

the class RecordRelationshipTraversalCursorTest method setupStores.

@BeforeEach
void setupStores() {
    DefaultIdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(fs, immediate(), databaseLayout.getDatabaseName());
    StoreFactory storeFactory = new StoreFactory(databaseLayout, Config.defaults(), idGeneratorFactory, pageCache, fs, getRecordFormats(), NullLogProvider.getInstance(), PageCacheTracer.NULL, writable(), Sets.immutable.empty());
    neoStores = storeFactory.openAllNeoStores(true);
}
Also used : DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) BeforeEach(org.junit.jupiter.api.BeforeEach)

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