java.io.Closeable, java.lang.AutoCloseable@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 | Description |
|---|---|
EditLogFileInputStream(java.io.File name,
long firstTxId,
long lastTxId,
boolean isInProgress) |
Open an EditLogInputStream for the given file.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
Close the stream.
|
static EditLogInputStream |
fromByteString(org.apache.hadoop.thirdparty.protobuf.ByteString bytes,
long startTxId,
long endTxId,
boolean inProgress) |
Create an EditLogInputStream from a
ByteString, i.e. |
static EditLogInputStream |
fromUrl(org.apache.hadoop.hdfs.web.URLConnectionFactory connectionFactory,
java.net.URL url,
long startTxId,
long endTxId,
boolean inProgress) |
Open an EditLogInputStream for the given URL.
|
long |
getFirstTxId() |
|
long |
getLastTxId() |
|
java.lang.String |
getName() |
|
long |
getPosition() |
Get the "position" of in the stream.
|
int |
getVersion(boolean verifyVersion) |
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.
|
boolean |
isLocalLog() |
Returns true if we are currently reading the log from a local disk or an
even faster data source (e.g.
|
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.
|
protected long |
scanNextOp() |
Go through the next operation from the stream storage.
|
void |
setMaxOpSize(int maxOpSize) |
Set the maximum opcode size in bytes.
|
java.lang.String |
toString() |
getCurrentStreamName, readOp, resync, skipUntilpublic EditLogFileInputStream(java.io.File name,
long firstTxId,
long lastTxId,
boolean isInProgress)
name - filename to openfirstTxId - first transaction found in filelastTxId - last transaction id found in filepublic static EditLogInputStream fromUrl(org.apache.hadoop.hdfs.web.URLConnectionFactory connectionFactory, java.net.URL url, long startTxId, long endTxId, boolean inProgress)
connectionFactory - the URLConnectionFactory used to create the connection.url - the url hosting the logstartTxId - the expected starting txidendTxId - the expected ending txidinProgress - whether the log is in-progresspublic static EditLogInputStream fromByteString(org.apache.hadoop.thirdparty.protobuf.ByteString bytes, long startTxId, long endTxId, boolean inProgress)
ByteString, i.e. an in-memory
collection of bytes.bytes - The byte string to read fromstartTxId - the expected starting transaction IDendTxId - the expected ending transaction IDinProgress - whether the log is in-progresspublic long getFirstTxId()
getFirstTxId in class EditLogInputStreampublic long getLastTxId()
getLastTxId in class EditLogInputStreampublic java.lang.String getName()
getName in class EditLogInputStreamprotected long scanNextOp()
throws java.io.IOException
EditLogInputStreamscanNextOp in class EditLogInputStreamjava.io.IOExceptionprotected FSEditLogOp nextOp() throws java.io.IOException
EditLogInputStreamnextOp in class EditLogInputStreamjava.io.IOException - if there is an error reading from the streamprotected FSEditLogOp nextValidOp()
EditLogInputStreamnextValidOp in class EditLogInputStreampublic int getVersion(boolean verifyVersion)
throws java.io.IOException
EditLogInputStreamgetVersion in class EditLogInputStreamjava.io.IOException - if there is an error reading the versionpublic long getPosition()
EditLogInputStreamgetPosition in class EditLogInputStreampublic void close()
throws java.io.IOException
EditLogInputStreamclose in interface java.lang.AutoCloseableclose in interface java.io.Closeableclose in class EditLogInputStreamjava.io.IOException - if an error occurred while closingpublic long length()
throws java.io.IOException
EditLogInputStreamlength in class EditLogInputStreamjava.io.IOExceptionpublic boolean isInProgress()
EditLogInputStreamisInProgress in class EditLogInputStreampublic java.lang.String toString()
toString in class EditLogInputStreampublic void setMaxOpSize(int maxOpSize)
EditLogInputStreamsetMaxOpSize in class EditLogInputStreampublic boolean isLocalLog()
EditLogInputStreamisLocalLog in class EditLogInputStreamCopyright © 2008–2025 Apache Software Foundation. All rights reserved.