@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, skipUntil
public 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 EditLogInputStream
public long getLastTxId()
getLastTxId
in class EditLogInputStream
public String getName()
getName
in class EditLogInputStream
protected FSEditLogOp nextOp() throws IOException
EditLogInputStream
nextOp
in class EditLogInputStream
IOException
- if there is an error reading from the streamprotected FSEditLogOp nextValidOp()
EditLogInputStream
nextValidOp
in class EditLogInputStream
public int getVersion() throws IOException
EditLogInputStream
getVersion
in class EditLogInputStream
IOException
- if there is an error reading the versionpublic long getPosition()
EditLogInputStream
getPosition
in class EditLogInputStream
public void close() throws IOException
EditLogInputStream
close
in interface Closeable
close
in interface AutoCloseable
close
in class EditLogInputStream
IOException
- if an error occurred while closingpublic long length() throws IOException
EditLogInputStream
length
in class EditLogInputStream
IOException
public boolean isInProgress()
EditLogInputStream
isInProgress
in class EditLogInputStream
public void setMaxOpSize(int maxOpSize)
EditLogInputStream
setMaxOpSize
in class EditLogInputStream
Copyright © 2013 Apache Software Foundation. All rights reserved.