public interface IHALogReader
Modifier and Type | Field and Description |
---|---|
static String |
HA_LOG_EXT
The filename extension used for the HALog files.
|
static FileFilter |
HALOG_FILTER
A
FileFilter that visits all files ending with the
HA_LOG_EXT and the names of all direct child directories. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the reader iff it is open.
|
void |
computeDigest(MessageDigest digest)
Compute the digest.
|
IRootBlockView |
getClosingRootBlock()
The
IRootBlockView for the committed state AFTER the write set
contained in the HA log file has been applied. |
IRootBlockView |
getOpeningRootBlock()
The
IRootBlockView for the committed state BEFORE the write set
contained in the HA log file. |
boolean |
hasMoreBuffers()
Checks whether we have reached the end of the file (blocking).
|
boolean |
isEmpty()
Return
true if the root blocks in the log file have the same
commit counter. |
boolean |
isLive()
Return
true iff this is was the live HALog at the moment
when it was opened (if true, then this flag will remain true
even if the writer moves onto another HALog file). |
boolean |
isOpen()
Return
true iff the reader is open. |
IHAWriteMessage |
processNextBuffer(ByteBuffer clientBuffer)
Attempts to read the next
IHAWriteMessage and then the expected
buffer, that is read into the client buffer. |
static final String HA_LOG_EXT
static final FileFilter HALOG_FILTER
FileFilter
that visits all files ending with the
HA_LOG_EXT
and the names of all direct child directories. This
FileFilter
may be used to establish recursive scans of the HALog
directory.void close() throws IOException
Note: Closing a reader does not have a side-effect on any open reader or writer for the same file. Specifically, if two readers are open for the same file and one is closed, then other will remain open. Likewise, if a reader is open for the live HALog file, closing the writer will not close the reader and closing the reader will not close the writer.
IOException
boolean isEmpty()
true
if the root blocks in the log file have the same
commit counter. Such log files are logically empty regardless of their
length.
FIXME The code disagress and will report [false] if the live log has the
same root blocks but has not yet been closed.boolean isOpen()
true
iff the reader is open.IRootBlockView getOpeningRootBlock() throws IOException
IRootBlockView
for the committed state BEFORE the write set
contained in the HA log file.IOException
IRootBlockView getClosingRootBlock() throws IOException
IRootBlockView
for the committed state AFTER the write set
contained in the HA log file has been applied.IOException
boolean hasMoreBuffers() throws IOException
Note: This method will block if this is the live HALog. This allows a process to block until the next message is made available on the live HALog by the writer.
Note: This method is non-blocking if this is not the live HALog since the decision can be made deterministically by inspecting the #of messages available (in the closing root block) and the #of messages consumed by the reader.
false
if (a) the file is closed on entry to
this method; (b) the live HALog is closed while waiting for more
data to become available; or (c) the end of a historical HALog
file has been reached. Return true
iff more data can
be read from the file.IOException
- if there is an error reading from the backing file.IHAWriteMessage processNextBuffer(ByteBuffer clientBuffer) throws IOException
IHAWriteMessage
and then the expected
buffer, that is read into the client buffer. The IHAWriteMessage
is returned to the caller.
Note: The caller's buffer will be filled in IFF the data is on the HALog.
For some IHABufferStrategy
implementations, that data is not
present in the HALog. The caller's buffer will not be modified and the
caller is responsible for getting the data from the
IHABufferStrategy
(e.g., for the WORMStrategy
).
Note: IF the buffer is filled, then the limit will be the #of bytes ready to be transmitted and the position will be zero.
clientBuffer
- A buffer from the DirectBufferPool.INSTANCE
.IOException
void computeDigest(MessageDigest digest) throws DigestException, IOException
IHALogReader
is backed by the live
HALog, then only the digest of the then current extent will be computed.DigestException
IOException
boolean isLive()
true
iff this is was the live HALog at the moment
when it was opened (if true, then this flag will remain true
even if the writer moves onto another HALog file).Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.