public class BlockDirectory extends FilterDirectory implements ShutdownAwareDirectory
Modifier and Type | Field and Description |
---|---|
static long |
BLOCK_MOD |
static long |
BLOCK_SHIFT |
static int |
BLOCK_SIZE |
static Cache |
NO_CACHE |
in
Constructor and Description |
---|
BlockDirectory(String dirName,
Directory directory,
Cache cache,
Set<String> blockCacheFileTypes,
boolean blockCacheReadEnabled,
boolean blockCacheWriteEnabled) |
BlockDirectory(String dirName,
Directory directory,
Cache cache,
Set<String> blockCacheFileTypes,
boolean blockCacheReadEnabled,
boolean blockCacheWriteEnabled,
boolean cacheMerges,
boolean cacheReadOnce) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the store.
|
void |
closeOnShutdown() |
IndexOutput |
createOutput(String name,
IOContext context)
Creates a new, empty file in the directory with the given name.
|
void |
deleteFile(String name)
Removes an existing file in the directory.
|
static long |
getBlock(long pos) |
Cache |
getCache()
Expert: mostly for tests
|
static long |
getPosition(long pos) |
static long |
getRealPosition(long block,
long positionInBlock) |
boolean |
isBlockCacheReadEnabled() |
boolean |
isBlockCacheWriteEnabled() |
IndexInput |
openInput(String name,
IOContext context)
Returns a stream reading an existing file.
|
createTempOutput, fileLength, getDelegate, listAll, obtainLock, rename, sync, syncMetaData, toString, unwrap
copyFrom, ensureOpen, openChecksumInput, renameFile
public static final long BLOCK_SHIFT
public static final int BLOCK_SIZE
public static final long BLOCK_MOD
public BlockDirectory(String dirName, Directory directory, Cache cache, Set<String> blockCacheFileTypes, boolean blockCacheReadEnabled, boolean blockCacheWriteEnabled) throws IOException
IOException
public BlockDirectory(String dirName, Directory directory, Cache cache, Set<String> blockCacheFileTypes, boolean blockCacheReadEnabled, boolean blockCacheWriteEnabled, boolean cacheMerges, boolean cacheReadOnce) throws IOException
IOException
public static long getBlock(long pos)
public static long getPosition(long pos)
public static long getRealPosition(long block, long positionInBlock)
public IndexInput openInput(String name, IOContext context) throws IOException
Directory
Throws FileNotFoundException
or NoSuchFileException
if the file does not exist.
openInput
in class FilterDirectory
IOException
public void closeOnShutdown() throws IOException
closeOnShutdown
in interface ShutdownAwareDirectory
IOException
public void close() throws IOException
Directory
close
in interface Closeable
close
in interface AutoCloseable
close
in class FilterDirectory
IOException
public IndexOutput createOutput(String name, IOContext context) throws IOException
Directory
createOutput
in class FilterDirectory
IOException
public void deleteFile(String name) throws IOException
Directory
deleteFile
in class FilterDirectory
IOException
public boolean isBlockCacheReadEnabled()
public boolean isBlockCacheWriteEnabled()