public class PartitionedIndexStorage extends Object
file system structure of all index related folders, lucene
directories and failure storage.| Constructor and Description |
|---|
PartitionedIndexStorage(DirectoryFactory directoryFactory,
org.neo4j.io.fs.FileSystemAbstraction fileSystem,
File rootFolder,
String identifier,
boolean archiveFailed) |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanupFolder(File folder)
For the given
folder removes the folder itself and all nested folders from both
file system and lucene directories. |
File |
getIndexFolder()
Resolves root folder for the given index.
|
File |
getPartitionFolder(int partition)
Resolves a folder for the partition with the given index.
|
String |
getStoredIndexFailure()
Retrieves stored index failure.
|
List<File> |
listFolders()
List all folders in the
index folder. |
org.apache.lucene.store.Directory |
openDirectory(File folder)
Opens a
lucene directory for the given folder. |
Map<File,org.apache.lucene.store.Directory> |
openIndexDirectories()
Opens all
lucene directories contained in the index folder. |
void |
prepareFolder(File folder)
|
void |
reserveIndexFailureStorage()
Create a failure storage in the
index folder. |
void |
storeIndexFailure(String failure)
Writes index failure into the failure storage.
|
public PartitionedIndexStorage(DirectoryFactory directoryFactory, org.neo4j.io.fs.FileSystemAbstraction fileSystem, File rootFolder, String identifier, boolean archiveFailed)
public org.apache.lucene.store.Directory openDirectory(File folder) throws IOException
lucene directory for the given folder.folder - the folder that denotes a lucene directory.IOException - if directory can't be opened.public File getPartitionFolder(int partition)
partition - the partition index.public File getIndexFolder()
public void reserveIndexFailureStorage()
throws IOException
index folder.IOException - if failure storage creation fails.FailureStorage.reserveForIndex()public void storeIndexFailure(String failure) throws IOException
failure - the cause of the index failure.IOException - if writing to the failure storage file failed.FailureStorage.storeIndexFailure(String)public String getStoredIndexFailure()
null if there is no failure.FailureStorage.loadIndexFailure()public void prepareFolder(File folder) throws IOException
folder - the folder to clean up.IOException - if some removal operation fails.public void cleanupFolder(File folder) throws IOException
folder removes the folder itself and all nested folders from both
file system and lucene directories.folder - the folder to remove.IOException - if some removal operation fails.public Map<File,org.apache.lucene.store.Directory> openIndexDirectories() throws IOException
lucene directories contained in the index folder.directory to the corresponding lucene directory.IOException - if opening of some lucene directory (via DirectoryFactory.open(File)) fails.public List<File> listFolders()
index folder.empty list if index folder is
empty.Copyright © 2002–2017 The Neo4j Graph Database Project. All rights reserved.