public abstract class DirectoryFactory extends Object implements NamedListInitializedPlugin, Closeable
Modifier and Type | Class and Description |
---|---|
static class |
DirectoryFactory.DirContext |
Modifier and Type | Field and Description |
---|---|
protected CoreContainer |
coreContainer |
protected static String |
INDEX_W_TIMESTAMP_REGEX |
static IOContext |
IOCONTEXT_NO_CACHE |
static String |
LOCK_TYPE_HDFS |
static String |
LOCK_TYPE_NATIVE |
static String |
LOCK_TYPE_NONE |
static String |
LOCK_TYPE_SIMPLE |
static String |
LOCK_TYPE_SINGLE |
Constructor and Description |
---|
DirectoryFactory() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addCloseListener(Directory dir,
CachingDirectoryFactory.CloseListener closeListener)
Adds a close listener for a Directory.
|
void |
cleanupOldIndexDirectories(String dataDirPath,
String currentIndexDirPath,
boolean afterCoreReload) |
abstract void |
close()
Close the this and all of the Directories it contains.
|
protected abstract Directory |
create(String path,
LockFactory lockFactory,
DirectoryFactory.DirContext dirContext)
Creates a new Directory for a given path.
|
protected abstract LockFactory |
createLockFactory(String rawLockType)
Creates a new LockFactory for a given path.
|
protected boolean |
deleteOldIndexDirectory(String oldDirPath) |
abstract void |
doneWithDirectory(Directory directory)
Indicates a Directory will no longer be used, and when its ref count
hits 0, it can be closed.
|
static boolean |
empty(Directory dir)
Delete the files in the Directory
|
abstract boolean |
exists(String path)
Returns true if a Directory exists for a given path.
|
abstract Directory |
get(String path,
DirectoryFactory.DirContext dirContext,
String rawLockType)
Returns the Directory for a given path, using the specified rawLockType.
|
protected Directory |
getBaseDir(Directory dir) |
String |
getDataHome(CoreDescriptor cd) |
abstract void |
incRef(Directory directory)
Increment the number of references to the given Directory.
|
void |
initCoreContainer(CoreContainer cc) |
boolean |
isAbsolute(String path) |
abstract boolean |
isPersistent() |
boolean |
isSharedStorage() |
void |
move(Directory fromDir,
Directory toDir,
String fileName,
IOContext ioContext)
Override for more efficient moves.
|
String |
normalize(String path)
Normalize a given path.
|
Collection<SolrInfoMBean> |
offerMBeans()
Optionally allow the DirectoryFactory to request registration of some MBeans.
|
abstract void |
release(Directory directory)
Releases the Directory so that it may be closed when it is no longer
referenced.
|
abstract void |
remove(Directory dir)
Removes the Directory's persistent storage.
|
abstract void |
remove(Directory dir,
boolean afterCoreClose)
Removes the Directory's persistent storage.
|
abstract void |
remove(String path)
This remove is special in that it may be called even after
the factory has been closed.
|
abstract void |
remove(String path,
boolean afterCoreClose)
This remove is special in that it may be called even after
the factory has been closed.
|
void |
renameWithOverwrite(Directory dir,
String fileName,
String toName) |
boolean |
searchersReserveCommitPoints()
If your implementation can count on delete-on-last-close semantics
or throws an exception when trying to remove a file in use, return
false (eg NFS).
|
long |
size(Directory directory) |
long |
size(String path) |
static long |
sizeOf(Directory directory,
String file) |
static long |
sizeOfDirectory(Directory directory) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
init
public static final IOContext IOCONTEXT_NO_CACHE
protected static final String INDEX_W_TIMESTAMP_REGEX
public static final String LOCK_TYPE_SIMPLE
public static final String LOCK_TYPE_NATIVE
public static final String LOCK_TYPE_SINGLE
public static final String LOCK_TYPE_NONE
public static final String LOCK_TYPE_HDFS
protected volatile CoreContainer coreContainer
public abstract void doneWithDirectory(Directory directory) throws IOException
IOException
- If there is a low-level I/O error.public abstract void addCloseListener(Directory dir, CachingDirectoryFactory.CloseListener closeListener)
public abstract void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
- If there is a low-level I/O error.protected abstract Directory create(String path, LockFactory lockFactory, DirectoryFactory.DirContext dirContext) throws IOException
IOException
- If there is a low-level I/O error.protected abstract LockFactory createLockFactory(String rawLockType) throws IOException
rawLockType
- A string value as passed in config. Every factory should at least support 'none' to disable locking.IOException
- If there is a low-level I/O error.public abstract boolean exists(String path) throws IOException
IOException
- If there is a low-level I/O error.public abstract void remove(Directory dir) throws IOException
IOException
- If there is a low-level I/O error.public abstract void remove(Directory dir, boolean afterCoreClose) throws IOException
IOException
- If there is a low-level I/O error.public abstract void remove(String path, boolean afterCoreClose) throws IOException
path
- to removeafterCoreClose
- whether to wait until after the core is closed.IOException
- If there is a low-level I/O error.public abstract void remove(String path) throws IOException
path
- to removeIOException
- If there is a low-level I/O error.public long size(Directory directory) throws IOException
directory
- to calculate size ofIOException
- on low level IO errorpublic long size(String path) throws IOException
path
- to calculate size ofIOException
- on low level IO errorpublic void move(Directory fromDir, Directory toDir, String fileName, IOContext ioContext) throws IOException
IOException
- If there is a low-level I/O error.public void renameWithOverwrite(Directory dir, String fileName, String toName) throws IOException
IOException
public abstract Directory get(String path, DirectoryFactory.DirContext dirContext, String rawLockType) throws IOException
IOException
- If there is a low-level I/O error.public abstract void incRef(Directory directory)
public abstract boolean isPersistent()
public boolean isSharedStorage()
public abstract void release(Directory directory) throws IOException
IOException
- If there is a low-level I/O error.public String normalize(String path) throws IOException
path
- to normalizeIOException
- on io errorpublic boolean isAbsolute(String path)
path
- the path to checkpublic static long sizeOfDirectory(Directory directory) throws IOException
IOException
public static long sizeOf(Directory directory, String file) throws IOException
IOException
public static boolean empty(Directory dir)
public boolean searchersReserveCommitPoints()
public String getDataHome(CoreDescriptor cd) throws IOException
IOException
public Collection<SolrInfoMBean> offerMBeans()
public void cleanupOldIndexDirectories(String dataDirPath, String currentIndexDirPath, boolean afterCoreReload)
protected boolean deleteOldIndexDirectory(String oldDirPath) throws IOException
IOException
public void initCoreContainer(CoreContainer cc)
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.