Search in sources :

Example 6 with IndexDirectoryStructure

use of org.neo4j.kernel.api.index.IndexDirectoryStructure in project neo4j by neo4j.

the class GenericNativeIndexAccessorTest method dropShouldDeleteEntireIndexFolder.

@Test
void dropShouldDeleteEntireIndexFolder() {
    // given
    Path root = testDirectory.directory("root");
    IndexDirectoryStructure directoryStructure = IndexDirectoryStructure.directoriesByProvider(root).forProvider(GenericNativeIndexProvider.DESCRIPTOR);
    long indexId = 8;
    IndexDescriptor descriptor = forSchema(SchemaDescriptor.forLabel(1, 1)).withName("index").materialise(indexId);
    IndexSpecificSpaceFillingCurveSettings spatialSettings = mock(IndexSpecificSpaceFillingCurveSettings.class);
    IndexFiles indexFiles = new IndexFiles.Directory(fs, directoryStructure, descriptor.getId());
    DatabaseIndexContext databaseIndexContext = DatabaseIndexContext.builder(pageCache, fs, DEFAULT_DATABASE_NAME).build();
    GenericNativeIndexAccessor accessor = new GenericNativeIndexAccessor(databaseIndexContext, indexFiles, new GenericLayout(1, spatialSettings), immediate(), descriptor, spatialSettings, mock(SpaceFillingCurveConfiguration.class), SIMPLE_NAME_LOOKUP);
    // when
    accessor.drop();
    // then
    assertFalse(fs.fileExists(indexFiles.getBase()));
}
Also used : Path(java.nio.file.Path) IndexSpecificSpaceFillingCurveSettings(org.neo4j.kernel.impl.index.schema.config.IndexSpecificSpaceFillingCurveSettings) IndexDirectoryStructure(org.neo4j.kernel.api.index.IndexDirectoryStructure) SpaceFillingCurveConfiguration(org.neo4j.gis.spatial.index.curves.SpaceFillingCurveConfiguration) IndexDescriptor(org.neo4j.internal.schema.IndexDescriptor) TestDirectory(org.neo4j.test.rule.TestDirectory) Test(org.junit.jupiter.api.Test)

Example 7 with IndexDirectoryStructure

use of org.neo4j.kernel.api.index.IndexDirectoryStructure in project neo4j by neo4j.

the class GenericAccessorPointsTest method setup.

@BeforeEach
void setup() {
    IndexDirectoryStructure directoryStructure = IndexDirectoryStructure.directoriesByProvider(directory.homePath()).forProvider(DESCRIPTOR);
    descriptor = TestIndexDescriptorFactory.forLabel(1, 1);
    IndexFiles indexFiles = new IndexFiles.Directory(fs, directoryStructure, descriptor.getId());
    GenericLayout layout = new GenericLayout(1, indexSettings);
    RecoveryCleanupWorkCollector collector = RecoveryCleanupWorkCollector.ignore();
    DatabaseIndexContext databaseIndexContext = DatabaseIndexContext.builder(pageCache, fs, DEFAULT_DATABASE_NAME).build();
    StandardConfiguration configuration = new StandardConfiguration();
    accessor = new GenericNativeIndexAccessor(databaseIndexContext, indexFiles, layout, collector, descriptor, indexSettings, configuration, SIMPLE_NAME_LOOKUP);
}
Also used : IndexDirectoryStructure(org.neo4j.kernel.api.index.IndexDirectoryStructure) RecoveryCleanupWorkCollector(org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector) StandardConfiguration(org.neo4j.gis.spatial.index.curves.StandardConfiguration) TestDirectory(org.neo4j.test.rule.TestDirectory) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 8 with IndexDirectoryStructure

use of org.neo4j.kernel.api.index.IndexDirectoryStructure in project neo4j by neo4j.

the class BlockBasedIndexPopulatorTest method setup.

@BeforeEach
void setup() {
    IndexProviderDescriptor providerDescriptor = new IndexProviderDescriptor("test", "v1");
    IndexDirectoryStructure directoryStructure = directoriesByProvider(testDir.homePath()).forProvider(providerDescriptor);
    indexFiles = new IndexFiles.Directory(fs, directoryStructure, INDEX_DESCRIPTOR.getId());
    databaseIndexContext = DatabaseIndexContext.builder(pageCache, fs, DEFAULT_DATABASE_NAME).build();
    jobScheduler = JobSchedulerFactory.createInitialisedScheduler();
    populationWorkScheduler = wrapScheduler(jobScheduler);
}
Also used : IndexDirectoryStructure(org.neo4j.kernel.api.index.IndexDirectoryStructure) IndexProviderDescriptor(org.neo4j.internal.schema.IndexProviderDescriptor) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

IndexDirectoryStructure (org.neo4j.kernel.api.index.IndexDirectoryStructure)8 IndexProviderDescriptor (org.neo4j.internal.schema.IndexProviderDescriptor)5 BeforeEach (org.junit.jupiter.api.BeforeEach)3 Test (org.junit.jupiter.api.Test)3 Path (java.nio.file.Path)2 StorageEngineFactory (org.neo4j.storageengine.api.StorageEngineFactory)2 StoreVersion (org.neo4j.storageengine.api.StoreVersion)2 SchemaIndexMigrator (org.neo4j.storageengine.migration.SchemaIndexMigrator)2 TestDirectory (org.neo4j.test.rule.TestDirectory)2 ArrayList (java.util.ArrayList)1 SpaceFillingCurveConfiguration (org.neo4j.gis.spatial.index.curves.SpaceFillingCurveConfiguration)1 StandardConfiguration (org.neo4j.gis.spatial.index.curves.StandardConfiguration)1 RecoveryCleanupWorkCollector (org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector)1 IndexImporterFactory (org.neo4j.internal.batchimport.IndexImporterFactory)1 NULL_CONTEXT (org.neo4j.internal.kernel.api.QueryContext.NULL_CONTEXT)1 IndexDescriptor (org.neo4j.internal.schema.IndexDescriptor)1 SchemaRule (org.neo4j.internal.schema.SchemaRule)1 IndexStorageFactory (org.neo4j.kernel.api.impl.index.storage.IndexStorageFactory)1 IndexPopulator (org.neo4j.kernel.api.index.IndexPopulator)1 IndexSpecificSpaceFillingCurveSettings (org.neo4j.kernel.impl.index.schema.config.IndexSpecificSpaceFillingCurveSettings)1