Search in sources :

Example 16 with DefaultIdGeneratorFactory

use of org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory 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 17 with DefaultIdGeneratorFactory

use of org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory 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 18 with DefaultIdGeneratorFactory

use of org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory in project neo4j by neo4j.

the class CoreBootstrapper method bootstrap.

public CoreSnapshot bootstrap(Set<MemberId> members) throws IOException {
    StoreFactory factory = new StoreFactory(storeDir, config, new DefaultIdGeneratorFactory(fs), pageCache, fs, logProvider);
    NeoStores neoStores = factory.openAllNeoStores(true);
    neoStores.close();
    CoreSnapshot coreSnapshot = new CoreSnapshot(FIRST_INDEX, FIRST_TERM);
    coreSnapshot.add(CoreStateType.ID_ALLOCATION, deriveIdAllocationState(storeDir));
    coreSnapshot.add(CoreStateType.LOCK_TOKEN, new ReplicatedLockTokenState());
    coreSnapshot.add(CoreStateType.RAFT_CORE_STATE, new RaftCoreState(new MembershipEntry(FIRST_INDEX, members)));
    coreSnapshot.add(CoreStateType.SESSION_TRACKER, new GlobalSessionTrackerState());
    appendNullTransactionLogEntryToSetRaftIndexToMinusOne();
    return coreSnapshot;
}
Also used : CoreSnapshot(org.neo4j.causalclustering.core.state.snapshot.CoreSnapshot) MembershipEntry(org.neo4j.causalclustering.core.consensus.membership.MembershipEntry) RaftCoreState(org.neo4j.causalclustering.core.state.snapshot.RaftCoreState) NeoStores(org.neo4j.kernel.impl.store.NeoStores) DefaultIdGeneratorFactory(org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory) ReplicatedLockTokenState(org.neo4j.causalclustering.core.state.machines.locks.ReplicatedLockTokenState) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) GlobalSessionTrackerState(org.neo4j.causalclustering.core.replication.session.GlobalSessionTrackerState)

Example 19 with DefaultIdGeneratorFactory

use of org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory in project neo4j by neo4j.

the class PropertyPhysicalToLogicalConverterTest method before.

@Before
public void before() throws Exception {
    File storeDir = new File("dir");
    fs.get().mkdirs(storeDir);
    StoreFactory storeFactory = new StoreFactory(storeDir, Config.empty(), new DefaultIdGeneratorFactory(fs.get()), pageCacheRule.getPageCache(fs.get()), fs.get(), NullLogProvider.getInstance());
    neoStores = storeFactory.openAllNeoStores(true);
    store = neoStores.getPropertyStore();
    converter = new PropertyPhysicalToLogicalConverter(store);
}
Also used : DefaultIdGeneratorFactory(org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) File(java.io.File) Before(org.junit.Before)

Example 20 with DefaultIdGeneratorFactory

use of org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory in project neo4j by neo4j.

the class CommonAbstractStoreTest method shouldDeleteOnCloseIfOpenOptionsSaysSo.

@Test
public void shouldDeleteOnCloseIfOpenOptionsSaysSo() throws Exception {
    // GIVEN
    File file = dir.file("store").getAbsoluteFile();
    File idFile = new File(file.getParentFile(), StoreFileType.ID.augment(file.getName()));
    FileSystemAbstraction fs = fileSystemRule.get();
    PageCache pageCache = pageCacheRule.getPageCache(fs, Config.empty());
    TheStore store = new TheStore(file, config, idType, new DefaultIdGeneratorFactory(fs), pageCache, NullLogProvider.getInstance(), recordFormat, DELETE_ON_CLOSE);
    store.initialise(true);
    store.makeStoreOk();
    assertTrue(fs.fileExists(file));
    assertTrue(fs.fileExists(idFile));
    // WHEN
    store.close();
    // THEN
    assertFalse(fs.fileExists(file));
    assertFalse(fs.fileExists(idFile));
}
Also used : FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) DefaultIdGeneratorFactory(org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory) PagedFile(org.neo4j.io.pagecache.PagedFile) File(java.io.File) PageCache(org.neo4j.io.pagecache.PageCache) Test(org.junit.Test)

Aggregations

DefaultIdGeneratorFactory (org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory)34 File (java.io.File)18 Config (org.neo4j.kernel.configuration.Config)17 Test (org.junit.Test)13 StoreFactory (org.neo4j.kernel.impl.store.StoreFactory)11 Before (org.junit.Before)10 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)8 PageCache (org.neo4j.io.pagecache.PageCache)6 NeoStores (org.neo4j.kernel.impl.store.NeoStores)5 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)4 ArrayList (java.util.ArrayList)3 UncloseableDelegatingFileSystemAbstraction (org.neo4j.graphdb.mockfs.UncloseableDelegatingFileSystemAbstraction)2 DefaultFileSystemAbstraction (org.neo4j.io.fs.DefaultFileSystemAbstraction)2 PagedFile (org.neo4j.io.pagecache.PagedFile)2 StandalonePageCacheFactory.createPageCache (org.neo4j.io.pagecache.impl.muninn.StandalonePageCacheFactory.createPageCache)2 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)2 NullLogProvider (org.neo4j.logging.NullLogProvider)2 IOException (java.io.IOException)1 InterruptedIOException (java.io.InterruptedIOException)1 PrintStream (java.io.PrintStream)1