diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/FileSystemIndexDropAction.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/FileSystemIndexDropAction.java
new file mode 100644
index 0000000000000..1ce608ef4d2f7
--- /dev/null
+++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/FileSystemIndexDropAction.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2002-2019 "Neo4j,"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.kernel.impl.index.schema;
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+
+import org.neo4j.io.fs.FileSystemAbstraction;
+import org.neo4j.kernel.api.index.IndexDirectoryStructure;
+
+import static org.neo4j.kernel.impl.index.schema.NativeIndexes.deleteIndex;
+
+public class FileSystemIndexDropAction implements IndexDropAction
+{
+ private final FileSystemAbstraction fs;
+ private final IndexDirectoryStructure directoryStructure;
+
+ public FileSystemIndexDropAction( FileSystemAbstraction fs, IndexDirectoryStructure directoryStructure )
+ {
+ this.fs = fs;
+ this.directoryStructure = directoryStructure;
+ }
+
+ @Override
+ public void drop( long indexId, boolean archiveExistentIndex )
+ {
+ try
+ {
+ deleteIndex( fs, directoryStructure, indexId, archiveExistentIndex );
+ }
+ catch ( IOException e )
+ {
+ throw new UncheckedIOException( e );
+ }
+ }
+}
diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/IndexDropAction.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/IndexDropAction.java
new file mode 100644
index 0000000000000..41f10e45e8bec
--- /dev/null
+++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/IndexDropAction.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2002-2019 "Neo4j,"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.kernel.impl.index.schema;
+
+import org.neo4j.graphdb.factory.GraphDatabaseSettings;
+
+@FunctionalInterface
+public
+interface IndexDropAction
+{
+ /**
+ * Deletes the index directory and everything in it, as last part of dropping an index.
+ * Can be configured to create archive with content of index directories for future analysis.
+ *
+ * @param indexId the index id, for which directory to drop.
+ * @param archiveExistentIndex create archive with content of dropped directories
+ * @see GraphDatabaseSettings#archive_failed_index
+ */
+ void drop( long indexId, boolean archiveExistentIndex );
+
+ /**
+ * Deletes the index directory and everything in it, as last part of dropping an index.
+ *
+ * @param indexId the index id, for which directory to drop.
+ */
+ default void drop( long indexId )
+ {
+ drop( indexId, false );
+ }
+}
diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexAccessor.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexAccessor.java
index 97cd7692fe46b..8cdc30bd8640f 100644
--- a/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexAccessor.java
+++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexAccessor.java
@@ -29,9 +29,9 @@
import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException;
import org.neo4j.kernel.api.index.IndexAccessor;
import org.neo4j.kernel.api.index.IndexUpdater;
-import org.neo4j.storageengine.api.NodePropertyAccessor;
import org.neo4j.kernel.impl.api.index.IndexUpdateMode;
-import org.neo4j.kernel.impl.index.schema.fusion.FusionIndexProvider.DropAction;
+import org.neo4j.kernel.impl.index.schema.IndexDropAction;
+import org.neo4j.storageengine.api.NodePropertyAccessor;
import org.neo4j.storageengine.api.schema.IndexReader;
import org.neo4j.storageengine.api.schema.StoreIndexDescriptor;
import org.neo4j.values.storable.Value;
@@ -41,12 +41,12 @@
class FusionIndexAccessor extends FusionIndexBase implements IndexAccessor
{
private final StoreIndexDescriptor descriptor;
- private final DropAction dropAction;
+ private final IndexDropAction dropAction;
FusionIndexAccessor( SlotSelector slotSelector,
InstanceSelector instanceSelector,
StoreIndexDescriptor descriptor,
- DropAction dropAction )
+ IndexDropAction dropAction )
{
super( slotSelector, instanceSelector );
this.descriptor = descriptor;
diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexPopulator.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexPopulator.java
index d734ae8f5db82..1fa46cba7e88c 100644
--- a/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexPopulator.java
+++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexPopulator.java
@@ -26,8 +26,8 @@
import org.neo4j.kernel.api.index.IndexEntryUpdate;
import org.neo4j.kernel.api.index.IndexPopulator;
import org.neo4j.kernel.api.index.IndexUpdater;
+import org.neo4j.kernel.impl.index.schema.IndexDropAction;
import org.neo4j.storageengine.api.NodePropertyAccessor;
-import org.neo4j.kernel.impl.index.schema.fusion.FusionIndexProvider.DropAction;
import org.neo4j.storageengine.api.schema.IndexSample;
import static org.neo4j.kernel.impl.index.schema.fusion.FusionIndexSampler.combineSamples;
@@ -35,10 +35,10 @@
class FusionIndexPopulator extends FusionIndexBase implements IndexPopulator
{
private final long indexId;
- private final DropAction dropAction;
+ private final IndexDropAction dropAction;
private final boolean archiveFailedIndex;
- FusionIndexPopulator( SlotSelector slotSelector, InstanceSelector instanceSelector, long indexId, DropAction dropAction,
+ FusionIndexPopulator( SlotSelector slotSelector, InstanceSelector instanceSelector, long indexId, IndexDropAction dropAction,
boolean archiveFailedIndex )
{
super( slotSelector, instanceSelector );
diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexProvider.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexProvider.java
index 77103dda48cba..71dd4679cd0c5 100644
--- a/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexProvider.java
+++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexProvider.java
@@ -20,11 +20,9 @@
package org.neo4j.kernel.impl.index.schema.fusion;
import java.io.IOException;
-import java.io.UncheckedIOException;
import java.util.EnumMap;
import java.util.List;
-import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.helpers.collection.Iterables;
import org.neo4j.internal.kernel.api.IndexCapability;
import org.neo4j.internal.kernel.api.IndexOrder;
@@ -37,6 +35,8 @@
import org.neo4j.kernel.api.index.IndexPopulator;
import org.neo4j.kernel.api.index.IndexProvider;
import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig;
+import org.neo4j.kernel.impl.index.schema.FileSystemIndexDropAction;
+import org.neo4j.kernel.impl.index.schema.IndexDropAction;
import org.neo4j.kernel.impl.newapi.UnionIndexCapability;
import org.neo4j.kernel.impl.storemigration.StoreMigrationParticipant;
import org.neo4j.storageengine.api.schema.StoreIndexDescriptor;
@@ -44,7 +44,6 @@
import static org.neo4j.internal.kernel.api.InternalIndexState.FAILED;
import static org.neo4j.internal.kernel.api.InternalIndexState.POPULATING;
-import static org.neo4j.kernel.impl.index.schema.NativeIndexes.deleteIndex;
import static org.neo4j.kernel.impl.index.schema.fusion.IndexSlot.LUCENE;
import static org.neo4j.kernel.impl.index.schema.fusion.IndexSlot.NUMBER;
import static org.neo4j.kernel.impl.index.schema.fusion.IndexSlot.SPATIAL;
@@ -60,7 +59,7 @@ public class FusionIndexProvider extends IndexProvider
private final boolean archiveFailedIndex;
private final InstanceSelector providers;
private final SlotSelector slotSelector;
- private final DropAction dropAction;
+ private final IndexDropAction dropAction;
public FusionIndexProvider(
// good to be strict with specific providers here since this is dev facing
@@ -79,7 +78,7 @@ public FusionIndexProvider(
this.archiveFailedIndex = archiveFailedIndex;
this.slotSelector = slotSelector;
this.providers = new InstanceSelector<>();
- this.dropAction = new FileSystemDropAction( fs, directoryStructure() );
+ this.dropAction = new FileSystemIndexDropAction( fs, directoryStructure() );
fillProvidersSelector( stringProvider, numberProvider, spatialProvider, temporalProvider, luceneProvider );
slotSelector.validateSatisfied( providers );
}
@@ -182,52 +181,4 @@ public StoreMigrationParticipant storeMigrationParticipant( FileSystemAbstractio
return StoreMigrationParticipant.NOT_PARTICIPATING;
}
- @FunctionalInterface
- interface DropAction
- {
- /**
- * Deletes the index directory and everything in it, as last part of dropping an index.
- * Can be configured to create archive with content of index directories for future analysis.
- *
- * @param indexId the index id, for which directory to drop.
- * @param archiveExistentIndex create archive with content of dropped directories
- * @see GraphDatabaseSettings#archive_failed_index
- */
- void drop( long indexId, boolean archiveExistentIndex );
-
- /**
- * Deletes the index directory and everything in it, as last part of dropping an index.
- *
- * @param indexId the index id, for which directory to drop.
- */
- default void drop( long indexId )
- {
- drop( indexId, false );
- }
- }
-
- private static class FileSystemDropAction implements DropAction
- {
- private final FileSystemAbstraction fs;
- private final IndexDirectoryStructure directoryStructure;
-
- FileSystemDropAction( FileSystemAbstraction fs, IndexDirectoryStructure directoryStructure )
- {
- this.fs = fs;
- this.directoryStructure = directoryStructure;
- }
-
- @Override
- public void drop( long indexId, boolean archiveExistentIndex )
- {
- try
- {
- deleteIndex( fs, directoryStructure, indexId, archiveExistentIndex );
- }
- catch ( IOException e )
- {
- throw new UncheckedIOException( e );
- }
- }
- }
}
diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexAccessorTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexAccessorTest.java
index 2b7890af3680f..fbac1bd38e33e 100644
--- a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexAccessorTest.java
+++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexAccessorTest.java
@@ -41,7 +41,7 @@
import org.neo4j.kernel.api.index.IndexUpdater;
import org.neo4j.kernel.api.schema.SchemaDescriptorFactory;
import org.neo4j.kernel.impl.api.index.IndexUpdateMode;
-import org.neo4j.kernel.impl.index.schema.fusion.FusionIndexProvider.DropAction;
+import org.neo4j.kernel.impl.index.schema.IndexDropAction;
import org.neo4j.storageengine.api.schema.IndexDescriptorFactory;
import org.neo4j.storageengine.api.schema.IndexReader;
import org.neo4j.storageengine.api.schema.StoreIndexDescriptor;
@@ -83,7 +83,7 @@ public class FusionIndexAccessorTest
{
private FusionIndexAccessor fusionIndexAccessor;
private final long indexId = 0;
- private final DropAction dropAction = mock( DropAction.class );
+ private final IndexDropAction dropAction = mock( IndexDropAction.class );
private EnumMap accessors;
private IndexAccessor[] aliveAccessors;
private StoreIndexDescriptor indexDescriptor =
diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexPopulatorTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexPopulatorTest.java
index b6752e1379512..03a0fc6fd6f2b 100644
--- a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexPopulatorTest.java
+++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/fusion/FusionIndexPopulatorTest.java
@@ -36,7 +36,7 @@
import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException;
import org.neo4j.kernel.api.index.IndexEntryUpdate;
import org.neo4j.kernel.api.index.IndexPopulator;
-import org.neo4j.kernel.impl.index.schema.fusion.FusionIndexProvider.DropAction;
+import org.neo4j.kernel.impl.index.schema.IndexDropAction;
import org.neo4j.values.storable.Value;
import static org.junit.Assert.fail;
@@ -69,7 +69,7 @@ public class FusionIndexPopulatorTest
private EnumMap populators;
private FusionIndexPopulator fusionIndexPopulator;
private final long indexId = 8;
- private final DropAction dropAction = mock( DropAction.class );
+ private final IndexDropAction dropAction = mock( IndexDropAction.class );
@Parameterized.Parameters( name = "{0}" )
public static FusionVersion[] versions()