public interface ExcerptTailer extends ExcerptCommon<ExcerptTailer>, net.openhft.chronicle.wire.MarshallableIn, net.openhft.chronicle.wire.SourceContext
The component that facilitates sequentially reading data from a ChronicleQueue
.
NOTE: Tailers are NOT thread-safe, sharing the Tailer between threads will lead to errors and unpredictable behaviour.
Modifier and Type | Method and Description |
---|---|
ExcerptTailer |
afterLastWritten(ChronicleQueue queue)
Wind this tailer to after the last entry which wrote an entry to the queue
|
int |
cycle() |
TailerDirection |
direction() |
ExcerptTailer |
direction(TailerDirection direction)
Set the direction of movement.
|
default Runnable |
getCloserJob()
A task that will be run if a WeakReference referring this appender is registered with a clean-up task.
|
long |
index() |
ExcerptTailer |
indexing(boolean indexing)
Causes this tailer to update the index as queue excerpts are read
|
boolean |
moveToIndex(long index)
Randomly select an Excerpt.
|
default boolean |
readAfterReplicaAcknowledged() |
default void |
readAfterReplicaAcknowledged(boolean readAfterReplicaAcknowledged) |
default net.openhft.chronicle.wire.DocumentContext |
readingDocument()
equivalent to
MarshallableIn.readDocument(ReadMarshallable) but with out the use of a
lambda expression. |
net.openhft.chronicle.wire.DocumentContext |
readingDocument(boolean includeMetaData) |
TailerState |
state() |
ExcerptTailer |
toEnd()
Wind to the last entry in the last cycle
|
ExcerptTailer |
toStart()
Replay from the first entry in the first cycle.
|
queue, sourceId
@NotNull default net.openhft.chronicle.wire.DocumentContext readingDocument()
MarshallableIn.readDocument(ReadMarshallable)
but with out the use of a
lambda expression.
This method is the ExcerptTailer equivalent of WireIn.readingDocument()
readingDocument
in interface net.openhft.chronicle.wire.MarshallableIn
@NotNull net.openhft.chronicle.wire.DocumentContext readingDocument(boolean includeMetaData)
long index()
index
in interface net.openhft.chronicle.wire.SourceContext
try (tailer.readingDocument){ }
block, returns index of current reading document.
Otherwise, the next index to read.
Index includes the cycle and the sequence number in that cycleint cycle()
boolean moveToIndex(long index)
index
- index to look up, the index includes the cycle number and a sequence number from with this cycle@NotNull ExcerptTailer toStart()
@NotNull ExcerptTailer toEnd()
If the direction() == FORWARD, this will be 1 more than the last entry.
Otherwise the index will be the last entry.
This is not atomic with the appenders, in other words if a cycle has been added in the current millisecond, toEnd() may not see it, This is because for performance reasons, the queue.lastCycle() is cached, as finding the last cycle is expensive, it requires asking the directory for the Files.list() so, this cache is only refreshed if the call toEnd() is in a new millisecond. Hence a whole milliseconds with of data could be added to the chronicle-queue that toEnd() won’t see. For appenders that that are on the same JVM, they can be informed that the last cycle has changed, this will yield better results, but atomicity can still not be guaranteed.
TailerDirection direction()
@NotNull ExcerptTailer direction(TailerDirection direction)
direction
- NONE, FORWARD, BACKWARD@NotNull ExcerptTailer afterLastWritten(ChronicleQueue queue) throws net.openhft.chronicle.core.io.IORuntimeException
queue
- which was written to.net.openhft.chronicle.core.io.IORuntimeException
- if the queue couldn't be wound to the last index.@NotNull ExcerptTailer indexing(boolean indexing)
indexing
- should this ExcerptTailer perform indexingdefault void readAfterReplicaAcknowledged(boolean readAfterReplicaAcknowledged)
default boolean readAfterReplicaAcknowledged()
@NotNull TailerState state()
default Runnable getCloserJob()
Copyright © 2018. All rights reserved.