Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Break out DropAction into separate class IndexDropAction
To be used by GenericNativeIndex
- Loading branch information
Showing
7 changed files
with
115 additions
and
64 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
...ty/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/FileSystemIndexDropAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <http://www.gnu.org/licenses/>. | ||
*/ | ||
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 ); | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/IndexDropAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <http://www.gnu.org/licenses/>. | ||
*/ | ||
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 ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters