@InterfaceAudience.Private public class EditLogFileInputStream extends EditLogInputStream
EditLogInputStream, which
reads edits from a file. That file may be either on the local disk or
accessible via a URL.| Constructor and Description |
|---|
EditLogFileInputStream(File name,
long firstTxId,
long lastTxId,
boolean isInProgress)
Open an EditLogInputStream for the given file.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the stream.
|
static EditLogInputStream |
fromUrl(URL url,
long startTxId,
long endTxId,
boolean inProgress)
Open an EditLogInputStream for the given URL.
|
long |
getFirstTxId() |
long |
getLastTxId() |
String |
getName() |
long |
getPosition()
Get the "position" of in the stream.
|
int |
getVersion()
Get the layout version of the data in the stream.
|
boolean |
isInProgress()
Return true if this stream is in progress, false if it is finalized.
|
long |
length()
Return the size of the current edits log or -1 if unknown.
|
protected FSEditLogOp |
nextOp()
Get the next operation from the stream storage.
|
protected FSEditLogOp |
nextValidOp()
Get the next valid operation from the stream storage.
|
void |
setMaxOpSize(int maxOpSize)
Set the maximum opcode size in bytes.
|
String |
toString() |
getCurrentStreamName, readOp, resync, skipUntilpublic EditLogFileInputStream(File name, long firstTxId, long lastTxId, boolean isInProgress)
name - filename to openfirstTxId - first transaction found in filelastTxId - last transaction id found in fileLogHeaderCorruptException - if the header is either missing or
appears to be corrupt/truncatedIOException - if an actual IO error occurs while reading the
headerpublic static EditLogInputStream fromUrl(URL url, long startTxId, long endTxId, boolean inProgress)
url - the url hosting the logstartTxId - the expected starting txidendTxId - the expected ending txidinProgress - whether the log is in-progresspublic long getFirstTxId()
getFirstTxId in class EditLogInputStreampublic long getLastTxId()
getLastTxId in class EditLogInputStreampublic String getName()
getName in class EditLogInputStreamprotected FSEditLogOp nextOp() throws IOException
EditLogInputStreamnextOp in class EditLogInputStreamIOException - if there is an error reading from the streamprotected FSEditLogOp nextValidOp()
EditLogInputStreamnextValidOp in class EditLogInputStreampublic int getVersion()
throws IOException
EditLogInputStreamgetVersion in class EditLogInputStreamIOException - if there is an error reading the versionpublic long getPosition()
EditLogInputStreamgetPosition in class EditLogInputStreampublic void close()
throws IOException
EditLogInputStreamclose in interface Closeableclose in interface AutoCloseableclose in class EditLogInputStreamIOException - if an error occurred while closingpublic long length()
throws IOException
EditLogInputStreamlength in class EditLogInputStreamIOExceptionpublic boolean isInProgress()
EditLogInputStreamisInProgress in class EditLogInputStreampublic void setMaxOpSize(int maxOpSize)
EditLogInputStreamsetMaxOpSize in class EditLogInputStreamCopyright © 2013 Apache Software Foundation. All rights reserved.