Search in sources :

Example 1 with KernelTransactionsSnapshot

use of org.neo4j.kernel.impl.api.KernelTransactionsSnapshot in project neo4j by neo4j.

the class NeoStoreDataSource method buildStorageEngine.

private StorageEngine buildStorageEngine(PropertyKeyTokenHolder propertyKeyTokenHolder, LabelTokenHolder labelTokens, RelationshipTypeTokenHolder relationshipTypeTokens, LegacyIndexProviderLookup legacyIndexProviderLookup, IndexConfigStore indexConfigStore, Runnable schemaStateChangeCallback, SynchronizedArrayIdOrderingQueue legacyIndexTransactionOrdering) {
    // TODO we should break this dependency on the kernelModule (which has not yet been created at this point in
    // TODO the code) and instead let information about generations of transactions flow through the StorageEngine
    // TODO API
    Supplier<KernelTransactionsSnapshot> transactionSnapshotSupplier = () -> kernelModule.kernelTransactions().get();
    RecordStorageEngine storageEngine = new RecordStorageEngine(storeDir, config, idGeneratorFactory, eligibleForReuse, idTypeConfigurationProvider, pageCache, fs, logProvider, propertyKeyTokenHolder, labelTokens, relationshipTypeTokens, schemaStateChangeCallback, constraintSemantics, scheduler, tokenNameLookup, lockService, schemaIndexProvider, indexingServiceMonitor, databaseHealth, labelScanStoreProvider, legacyIndexProviderLookup, indexConfigStore, legacyIndexTransactionOrdering, transactionSnapshotSupplier);
    // We pretend that the storage engine abstract hides all details within it. Whereas that's mostly
    // true it's not entirely true for the time being. As long as we need this call below, which
    // makes available one or more internal things to the outside world, there are leaks to plug.
    storageEngine.satisfyDependencies(dependencies);
    return life.add(storageEngine);
}
Also used : RecordStorageEngine(org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine) KernelTransactionsSnapshot(org.neo4j.kernel.impl.api.KernelTransactionsSnapshot)

Example 2 with KernelTransactionsSnapshot

use of org.neo4j.kernel.impl.api.KernelTransactionsSnapshot in project neo4j by neo4j.

the class RecordStorageEngineRule method get.

private RecordStorageEngine get(FileSystemAbstraction fs, PageCache pageCache, SchemaIndexProvider schemaIndexProvider, DatabaseHealth databaseHealth, File storeDirectory, Function<BatchTransactionApplierFacade, BatchTransactionApplierFacade> transactionApplierTransformer) {
    if (!fs.fileExists(storeDirectory) && !fs.mkdir(storeDirectory)) {
        throw new IllegalStateException();
    }
    IdGeneratorFactory idGeneratorFactory = new EphemeralIdGenerator.Factory();
    LabelScanStoreProvider labelScanStoreProvider = nativeLabelScanStoreProvider(storeDirectory, fs, pageCache);
    LegacyIndexProviderLookup legacyIndexProviderLookup = mock(LegacyIndexProviderLookup.class);
    when(legacyIndexProviderLookup.all()).thenReturn(Iterables.empty());
    IndexConfigStore indexConfigStore = new IndexConfigStore(storeDirectory, fs);
    JobScheduler scheduler = life.add(new Neo4jJobScheduler());
    Config config = Config.defaults();
    Supplier<KernelTransactionsSnapshot> txSnapshotSupplier = () -> new KernelTransactionsSnapshot(Collections.emptySet(), 0);
    return life.add(new ExtendedRecordStorageEngine(storeDirectory, config, idGeneratorFactory, IdReuseEligibility.ALWAYS, new CommunityIdTypeConfigurationProvider(), pageCache, fs, NullLogProvider.getInstance(), mock(PropertyKeyTokenHolder.class), mock(LabelTokenHolder.class), mock(RelationshipTypeTokenHolder.class), () -> {
    }, new StandardConstraintSemantics(), scheduler, mock(TokenNameLookup.class), new ReentrantLockService(), schemaIndexProvider, IndexingService.NO_MONITOR, databaseHealth, labelScanStoreProvider, legacyIndexProviderLookup, indexConfigStore, new SynchronizedArrayIdOrderingQueue(20), txSnapshotSupplier, transactionApplierTransformer));
}
Also used : JobScheduler(org.neo4j.kernel.impl.util.JobScheduler) Neo4jJobScheduler(org.neo4j.kernel.impl.util.Neo4jJobScheduler) LabelScanStoreProvider(org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider) NeoStoreDataSourceRule.nativeLabelScanStoreProvider(org.neo4j.test.rule.NeoStoreDataSourceRule.nativeLabelScanStoreProvider) LegacyIndexProviderLookup(org.neo4j.kernel.impl.api.LegacyIndexProviderLookup) Config(org.neo4j.kernel.configuration.Config) IndexConfigStore(org.neo4j.kernel.impl.index.IndexConfigStore) IdGeneratorFactory(org.neo4j.kernel.impl.store.id.IdGeneratorFactory) IdGeneratorFactory(org.neo4j.kernel.impl.store.id.IdGeneratorFactory) KernelTransactionsSnapshot(org.neo4j.kernel.impl.api.KernelTransactionsSnapshot) Neo4jJobScheduler(org.neo4j.kernel.impl.util.Neo4jJobScheduler) CommunityIdTypeConfigurationProvider(org.neo4j.kernel.impl.store.id.configuration.CommunityIdTypeConfigurationProvider) SynchronizedArrayIdOrderingQueue(org.neo4j.kernel.impl.util.SynchronizedArrayIdOrderingQueue) ReentrantLockService(org.neo4j.kernel.impl.locking.ReentrantLockService) StandardConstraintSemantics(org.neo4j.kernel.impl.constraints.StandardConstraintSemantics)

Aggregations

KernelTransactionsSnapshot (org.neo4j.kernel.impl.api.KernelTransactionsSnapshot)2 Config (org.neo4j.kernel.configuration.Config)1 LegacyIndexProviderLookup (org.neo4j.kernel.impl.api.LegacyIndexProviderLookup)1 LabelScanStoreProvider (org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider)1 StandardConstraintSemantics (org.neo4j.kernel.impl.constraints.StandardConstraintSemantics)1 IndexConfigStore (org.neo4j.kernel.impl.index.IndexConfigStore)1 ReentrantLockService (org.neo4j.kernel.impl.locking.ReentrantLockService)1 RecordStorageEngine (org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine)1 IdGeneratorFactory (org.neo4j.kernel.impl.store.id.IdGeneratorFactory)1 CommunityIdTypeConfigurationProvider (org.neo4j.kernel.impl.store.id.configuration.CommunityIdTypeConfigurationProvider)1 JobScheduler (org.neo4j.kernel.impl.util.JobScheduler)1 Neo4jJobScheduler (org.neo4j.kernel.impl.util.Neo4jJobScheduler)1 SynchronizedArrayIdOrderingQueue (org.neo4j.kernel.impl.util.SynchronizedArrayIdOrderingQueue)1 NeoStoreDataSourceRule.nativeLabelScanStoreProvider (org.neo4j.test.rule.NeoStoreDataSourceRule.nativeLabelScanStoreProvider)1