public class RaftStorageDirectory extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
RaftStorageDirectory.LogPathAndIndex |
| Modifier and Type | Method and Description |
|---|---|
File |
getClosedLogFile(long startIndex,
long endIndex) |
List<RaftStorageDirectory.LogPathAndIndex> |
getLogSegmentFiles() |
File |
getNewTempDir()
Returns a uniquely named temporary directory under $rootdir/tmp/
|
File |
getOpenLogFile(long startIndex) |
File |
getRoot()
Get root directory of this storage
|
File |
getStateMachineDir() |
boolean |
hasMetaFile() |
void |
lock()
Lock storage to provide exclusive access.
|
static RaftStorageDirectory.LogPathAndIndex |
processOnePath(Path path) |
Path |
relativizeToRoot(Path p) |
String |
toString() |
void |
unlock()
Unlock storage.
|
public File getRoot()
public File getOpenLogFile(long startIndex)
public File getClosedLogFile(long startIndex, long endIndex)
public File getStateMachineDir()
public File getNewTempDir()
public List<RaftStorageDirectory.LogPathAndIndex> getLogSegmentFiles() throws IOException
IOExceptionpublic static RaftStorageDirectory.LogPathAndIndex processOnePath(Path path) throws IOException
IOExceptionpublic boolean hasMetaFile()
public void lock()
throws IOException
Locking is not supported by all file systems. E.g., NFS does not consistently support exclusive locks.
If locking is supported we guarantee exclusive access to the storage directory. Otherwise, no guarantee is given.
IOException - if locking failspublic void unlock()
throws IOException
IOExceptionCopyright © 2017–2020 The Apache Software Foundation. All rights reserved.