public class MendelFileSystem extends java.lang.Object implements FileSystem
BLOCK_EXTENSION
Constructor and Description |
---|
MendelFileSystem(java.lang.String storageRoot) |
MendelFileSystem(java.lang.String storageRoot,
boolean pseudoFS) |
Modifier and Type | Method and Description |
---|---|
long |
countBlocks() |
protected void |
fullRecovery()
Does a full recovery from disk; this scans every block in the system,
reads metadata, and performs a checksum to verify integrity.
|
long |
getFreeSpace()
Reports the amount of free space (in bytes) in the root storage
directory.
|
protected void |
initialize(java.lang.String storageRoot) |
boolean |
isReadOnly()
Reports whether the Mendel filesystem is read-only.
|
Block |
loadBlock(java.lang.String blockPath)
Retrieves a
Block instance, given its path on disk. |
Metadata |
loadMetadata(java.lang.String blockPath)
|
java.util.List<ProteinSequence> |
nearestNeighboQuery(java.lang.String query) |
java.util.List<ProteinSequence> |
nearestNeighborQuery(java.lang.String queryString) |
protected java.util.List<java.lang.String> |
rebuildPaths(java.io.File storageDir)
Scans the directory structure on disk to find all the blocks stored.
|
protected void |
recover(java.util.List<java.lang.String> blockPaths)
Does a full recovery from disk on a particular Mendel partition; this
scans every block in the partition, reads its metadata, and performs a
checksum to verify block integrity.
|
protected java.util.List<java.lang.String> |
scanDirectory(java.io.File directory)
Scans a directory (and its subdirectories) for blocks.
|
void |
shutdown()
Performs a clean shutdown of the FileSystem instance.
|
java.lang.String |
storeBlock(Block block)
Stores a
Block at the specified path on disk. |
void |
storeMetadata(Metadata metadata,
java.lang.String blockPath)
Stores a
Metadata at the specified location. |
public MendelFileSystem(java.lang.String storageRoot, boolean pseudoFS) throws java.io.IOException, FileSystemException
java.io.IOException
FileSystemException
public MendelFileSystem(java.lang.String storageRoot) throws FileSystemException, java.io.IOException
FileSystemException
java.io.IOException
protected void initialize(java.lang.String storageRoot) throws FileSystemException, java.io.IOException
FileSystemException
java.io.IOException
protected java.util.List<java.lang.String> scanDirectory(java.io.File directory)
directory
- Directory to scan for blocks.protected void fullRecovery()
protected java.util.List<java.lang.String> rebuildPaths(java.io.File storageDir)
storageDir
- the root directory to start scanning from.protected void recover(java.util.List<java.lang.String> blockPaths)
public Block loadBlock(java.lang.String blockPath) throws java.io.IOException, SerializationException
FileSystem
Block
instance, given its path on disk.loadBlock
in interface FileSystem
blockPath
- the physical (on-disk) location of the Block to load.java.io.IOException
SerializationException
public Metadata loadMetadata(java.lang.String blockPath) throws java.io.IOException, SerializationException
FileSystem
loadMetadata
in interface FileSystem
blockPath
- the physical location of the Block to load metadata
from.java.io.IOException
SerializationException
public java.lang.String storeBlock(Block block) throws FileSystemException, java.io.IOException
FileSystem
Block
at the specified path on disk.storeBlock
in interface FileSystem
block
- the Block instance to persist to disk.FileSystemException
java.io.IOException
public void storeMetadata(Metadata metadata, java.lang.String blockPath) throws FileSystemException, java.io.IOException
FileSystem
Metadata
at the specified location. Metadata
can flow to disk at memory capacity or during shutdown.storeMetadata
in interface FileSystem
metadata
- the Metadata
to 'store,' which may
just involve
updating index structures.blockPath
- the on-disk path of the Block the Metadata being stored
belongs to.FileSystemException
java.io.IOException
public boolean isReadOnly()
public long getFreeSpace()
public void shutdown() throws java.io.IOException, FileSystemException
java.io.IOException
FileSystemException
public java.util.List<ProteinSequence> nearestNeighboQuery(java.lang.String query)
public java.util.List<ProteinSequence> nearestNeighborQuery(java.lang.String queryString)
public long countBlocks()