public StoreAccess( FileSystemAbstraction fileSystem, PageCache pageCache, DatabaseLayout directoryStructure, Config config ) { this( new StoreFactory( directoryStructure, config, new DefaultIdGeneratorFactory( fileSystem ), pageCache, fileSystem, NullLogProvider.getInstance(), EmptyVersionContextSupplier.EMPTY ).openAllNeoStores() ); this.closeable = true; }
@Override public IdGenerator open( File filename, IdType idType, LongSupplier highId, long maxId ) { IdTypeConfiguration idTypeConfiguration = idTypeConfigurationProvider.getIdTypeConfiguration( idType ); return open( filename, idTypeConfiguration.getGrabSize(), idType, highId, maxId ); }
@Override protected IdGenerator instantiate( FileSystemAbstraction fs, File fileName, int grabSize, long maxValue, boolean aggressiveReuse, IdType idType, LongSupplier highId ) { return spy( super.instantiate( fs, fileName, grabSize, maxValue, aggressiveReuse, idType, highId ) ); } } );
private StoreFactory getStoreFactory( Config config, DatabaseLayout databaseLayout, FileSystemAbstraction ephemeralFileSystemAbstraction, NullLogProvider instance ) { return new StoreFactory( databaseLayout, config, new DefaultIdGeneratorFactory( ephemeralFileSystemAbstraction ), pageCache, ephemeralFileSystemAbstraction, instance, EmptyVersionContextSupplier.EMPTY ); } }
@Override public IdGenerator open( File filename, IdType idType, LongSupplier highId, long maxId ) { IdTypeConfiguration idTypeConfiguration = idTypeConfigurationProvider.getIdTypeConfiguration( idType ); return open( filename, idTypeConfiguration.getGrabSize(), idType, highId, maxId ); }
@Override public IdGenerator open( File fileName, int grabSize, IdType idType, LongSupplier highId, long maxId ) { IdTypeConfiguration idTypeConfiguration = idTypeConfigurationProvider.getIdTypeConfiguration( idType ); IdGenerator generator = instantiate( fs, fileName, grabSize, maxId, idTypeConfiguration.allowAggressiveReuse(), idType, highId ); generators.put( idType, generator ); return generator; }
public IdContextFactory build() { if ( idGeneratorFactoryProvider == null ) { requireNonNull( fileSystemAbstraction, "File system is required to build id generator factory." ); idGeneratorFactoryProvider = databaseName -> new DefaultIdGeneratorFactory( fileSystemAbstraction, idTypeConfigurationProvider ); } if ( idTypeConfigurationProvider == null ) { idTypeConfigurationProvider = new CommunityIdTypeConfigurationProvider(); } if ( factoryWrapper == null ) { factoryWrapper = identity(); } return new IdContextFactory( jobScheduler, idGeneratorFactoryProvider, idTypeConfigurationProvider, idReuseEligibility, factoryWrapper ); } }
private long getHighId( File coreDir, DefaultIdGeneratorFactory factory, IdType idType, String store ) { IdGenerator idGenerator = factory.open( new File( coreDir, idFile( store ) ), idType, -1, Long.MAX_VALUE ); long highId = idGenerator.getHighId(); idGenerator.close(); return highId; }
@Override public IdGenerator open( File fileName, int grabSize, IdType idType, LongSupplier highId, long maxId ) { IdTypeConfiguration idTypeConfiguration = idTypeConfigurationProvider.getIdTypeConfiguration( idType ); IdGenerator generator = instantiate( fs, fileName, grabSize, maxId, idTypeConfiguration.allowAggressiveReuse(), idType, highId ); generators.put( idType, generator ); return generator; }
MyStore( Config config, PageCache pageCache, MyFormat format ) { super( new File( "store" ), new File( "idFile" ), config, IdType.NODE, new DefaultIdGeneratorFactory( fs.get() ), pageCache, NullLogProvider.getInstance(), "T", format, format, "XYZ" ); }
private long getHighId( File coreDir, DefaultIdGeneratorFactory factory, IdType idType, String store ) { IdGenerator idGenerator = factory.open( new File( coreDir, idFile( store ) ), idType, () -> -1L, Long.MAX_VALUE ); long highId = idGenerator.getHighId(); idGenerator.close(); return highId; }
private BatchingNeoStores( FileSystemAbstraction fileSystem, PageCache pageCache, File databaseDirectory, RecordFormats recordFormats, Config neo4jConfig, Configuration importConfiguration, LogService logService, AdditionalInitialIds initialIds, boolean externalPageCache, IoTracer ioTracer ) { this.fileSystem = fileSystem; this.recordFormats = recordFormats; this.importConfiguration = importConfiguration; this.initialIds = initialIds; this.logProvider = logService.getInternalLogProvider(); this.databaseLayout = DatabaseLayout.of( databaseDirectory ); this.temporaryDatabaseLayout = DatabaseLayout.of( databaseLayout.file( TEMP_STORE_NAME ), TEMP_STORE_NAME ); this.neo4jConfig = neo4jConfig; this.pageCache = pageCache; this.ioTracer = ioTracer; this.externalPageCache = externalPageCache; this.idGeneratorFactory = new DefaultIdGeneratorFactory( fileSystem ); }
private StoreFactory factory( Integer customThreshold, PageCache pageCache ) { Map<String, String> customConfig = new HashMap<>(); if ( customThreshold != null ) { customConfig.put( GraphDatabaseSettings.dense_node_threshold.name(), "" + customThreshold ); } return new StoreFactory( testDir.databaseLayout(), Config.defaults( customConfig ), new DefaultIdGeneratorFactory( fs ), pageCache, fs, NullLogProvider.getInstance(), EmptyVersionContextSupplier.EMPTY ); }
public void migrate( DatabaseLayout fromDirectoryStructure, RecordFormats fromFormat, DatabaseLayout toDirectoryStructure, RecordFormats toFormat, ProgressReporter progressReporter, StoreType[] types, StoreType... additionalTypesToOpen ) { StoreType[] storesToOpen = ArrayUtil.concat( types, additionalTypesToOpen ); progressReporter.start( storesToOpen.length ); try ( NeoStores fromStores = new StoreFactory( fromDirectoryStructure, config, new DefaultIdGeneratorFactory( fs ), pageCache, fs, fromFormat, NullLogProvider.getInstance(), EmptyVersionContextSupplier.EMPTY ) .openNeoStores( true, storesToOpen ); NeoStores toStores = new StoreFactory( toDirectoryStructure, withPersistedStoreHeadersAsConfigFrom( fromStores, storesToOpen ), new DefaultIdGeneratorFactory( fs ), pageCache, fs, toFormat, NullLogProvider.getInstance(), EmptyVersionContextSupplier.EMPTY ) .openNeoStores( true, storesToOpen ) ) { for ( StoreType type : types ) { // This condition will exclude counts store first and foremost. if ( type.isRecordStore() ) { migrate( fromStores.getRecordStore( type ), toStores.getRecordStore( type ) ); progressReporter.progress( 1 ); } } } }
private StoreFactory newStoreFactory( PageCache pageCache ) { FileSystemAbstraction fileSystem = fileSystemRule.get(); return new StoreFactory( directory.databaseLayout(), getTuningConfiguration(), new DefaultIdGeneratorFactory( fileSystem ), pageCache, fileSystem, NullLogProvider.getInstance(), EmptyVersionContextSupplier.EMPTY ); }
private MetaDataStore newMetaDataStore() { LogProvider logProvider = NullLogProvider.getInstance(); StoreFactory storeFactory = new StoreFactory( testDirectory.databaseLayout(), Config.defaults(), new DefaultIdGeneratorFactory( fs ), pageCacheWithFakeOverflow, fs, logProvider, EmptyVersionContextSupplier.EMPTY ); return storeFactory.openNeoStores( true, StoreType.META_DATA ).getMetaDataStore(); }
private static StoreFactory newStoreFactory( DatabaseLayout databaseLayout, PageCache pageCache, FileSystemAbstraction fs ) { RecordFormats recordFormats = RecordFormatSelector.defaultFormat(); Config config = Config.defaults(); IdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory( fs ); return new StoreFactory( databaseLayout, config, idGeneratorFactory, pageCache, fs, recordFormats, LOG_PROVIDER, EmptyVersionContextSupplier.EMPTY ); }
@Before public void setUp() { FileSystemAbstraction fs = fsRule.get(); pageCache = pageCacheRule.getPageCache( fs ); idGeneratorFactory = new DefaultIdGeneratorFactory( fs ); }
@Before public void before() { FileSystemAbstraction fs = this.fs.get(); StoreFactory storeFactory = new StoreFactory( testDirectory.databaseLayout(), Config.defaults(), new DefaultIdGeneratorFactory( fs ), pageCacheRule.getPageCache( fs ), fs, NullLogProvider.getInstance(), EmptyVersionContextSupplier.EMPTY ); neoStores = storeFactory.openAllNeoStores( true ); }
private StoreFactory getStoreFactory() { return new StoreFactory( storage.directory().databaseLayout(), Config.defaults(), new DefaultIdGeneratorFactory( storage.fileSystem() ), storage.pageCache(), storage.fileSystem(), NullLogProvider.getInstance(), EmptyVersionContextSupplier.EMPTY ); }