public static class SingleChronicleQueueExcerpts.StoreTailer extends Object implements ExcerptTailer, net.openhft.chronicle.wire.SourceContext, ExcerptContext
| Constructor and Description |
|---|
StoreTailer(SingleChronicleQueue queue) |
StoreTailer(SingleChronicleQueue queue,
net.openhft.chronicle.core.values.LongValue indexValue) |
| Modifier and Type | Method and Description |
|---|---|
ExcerptTailer |
afterLastWritten(ChronicleQueue queue)
Winds this Tailer to after the last entry which wrote an entry to the queue.
|
int |
cycle()
Returns the current cycle for this Trailer.
|
TailerDirection |
direction()
Returns the direction of this Tailer.
|
ExcerptTailer |
direction(TailerDirection direction)
Returns the direction of this Tailer.
|
Runnable |
getCloserJob()
Returns the task that will be run if a WeakReference referring this appender is registered with a clean-up task.
|
long |
index()
Returns the current index of this Trailer.
|
boolean |
moveToIndex(long index)
Moves the index for this Trailer to the provided
index. |
ExcerptTailer |
originalToEnd() |
boolean |
peekDocument()
Returns if it is likely that
ExcerptTailer.readingDocument() would return a DocumentContext
that provides excerpts to read. |
ChronicleQueue |
queue()
Returns the backing ChronicleQueue to which this
ExcerptCommon is attached to.
|
boolean |
readAfterReplicaAcknowledged()
Returns the Read After Replica Acknowledged property of this Trailer.
|
void |
readAfterReplicaAcknowledged(boolean readAfterReplicaAcknowledged)
Sets the Read After Replica Acknowledged property of this Trailer to the
provided
readAfterReplicaAcknowledged. |
boolean |
readDocument(net.openhft.chronicle.wire.ReadMarshallable reader) |
static net.openhft.chronicle.wire.MessageHistory |
readHistory(net.openhft.chronicle.wire.DocumentContext dc,
net.openhft.chronicle.wire.MessageHistory history) |
net.openhft.chronicle.wire.DocumentContext |
readingDocument()
Returns the
DocumentContext for this ExcerptTailer. |
net.openhft.chronicle.wire.DocumentContext |
readingDocument(boolean includeMetaData)
Returns the
DocumentContext for this ExcerptTailer. |
void |
releaseResources()
Can be used to manually release resources when this StoreTailer is no longer used.
|
void |
setCycle(int cycle) |
int |
sourceId()
Returns the source id of the backing ChronicleQueue
to which this ExcerptCommon is attached to.
|
TailerState |
state()
Returns the
TailerState of this Trailer. |
boolean |
striding()
Returns the striding property of this Trailer.
|
ExcerptTailer |
striding(boolean striding)
Sets the
striding property of this Trailer. |
long |
timeoutMS() |
ExcerptTailer |
toEnd()
Moves the index for this Trailer to the end of the queue.
|
ExcerptTailer |
toStart()
Moves the index for this Trailer to the first existing excerpt in the queue.
|
String |
toString() |
net.openhft.chronicle.wire.Wire |
wire() |
net.openhft.chronicle.wire.Wire |
wireForIndex() |
public StoreTailer(@NotNull
SingleChronicleQueue queue)
public StoreTailer(@NotNull
SingleChronicleQueue queue,
net.openhft.chronicle.core.values.LongValue indexValue)
@Nullable
public static net.openhft.chronicle.wire.MessageHistory readHistory(net.openhft.chronicle.wire.DocumentContext dc,
net.openhft.chronicle.wire.MessageHistory history)
public boolean readDocument(@NotNull
net.openhft.chronicle.wire.ReadMarshallable reader)
readDocument in interface net.openhft.chronicle.wire.MarshallableIn@NotNull public net.openhft.chronicle.wire.DocumentContext readingDocument()
ExcerptTailerDocumentContext for this ExcerptTailer.
This is equivalent to MarshallableIn.readDocument(ReadMarshallable) but without the use of a
lambda expression.
This method is the ExcerptTailer equivalent of WireIn.readingDocument()
readingDocument in interface ExcerptTailerreadingDocument in interface net.openhft.chronicle.wire.MarshallableInpublic net.openhft.chronicle.wire.Wire wire()
wire in interface ExcerptContextpublic net.openhft.chronicle.wire.Wire wireForIndex()
wireForIndex in interface ExcerptContextpublic long timeoutMS()
timeoutMS in interface ExcerptContextpublic int sourceId()
ExcerptCommonsourceId in interface ExcerptCommon<ExcerptTailer>sourceId in interface net.openhft.chronicle.wire.SourceContextChronicleQueue.sourceId()@NotNull public net.openhft.chronicle.wire.DocumentContext readingDocument(boolean includeMetaData)
ExcerptTailerDocumentContext for this ExcerptTailer.
This is equivalent to MarshallableIn.readDocument(ReadMarshallable) but without the use of a
lambda expression.
This method is the ExcerptTailer equivalent of WireIn.readingDocument()
readingDocument in interface ExcerptTailerincludeMetaData - if the DocumentContext shall be meta data aware.public boolean peekDocument()
ExcerptTailerExcerptTailer.readingDocument() would return a DocumentContext
that provides excerpts to read.
peekDocument() can be used after a message has been found by toStart() or readingDocument().
Until then only readingDocument() will find the first cycle.peekDocument in interface ExcerptTailerpeekDocument in interface net.openhft.chronicle.wire.MarshallableInExcerptTailer.readingDocument() would return a DocumentContext
that provides excerpts to read.public long index()
ExcerptTailer
If this method is invoked within a try (tailer.readingDocument){ } block, returns the index of
the current reading document. Otherwise, returns the next index to read.
The index includes the cycle and the sequence number within that cycle.
index in interface ExcerptTailerindex in interface net.openhft.chronicle.wire.SourceContextpublic int cycle()
ExcerptTailerUsually, each cycle will have its own unique data file to store excerpts.
cycle in interface ExcerptTailerpublic boolean moveToIndex(long index)
ExcerptTailerindex.
The index contains both the cycle number and sequence number within the cycle.
If the index is not a valid index, the operation is undefined.
moveToIndex in interface ExcerptTailerindex - index to move to.@NotNull public final ExcerptTailer toStart()
ExcerptTailertoStart in interface ExcerptTailer@NotNull public ExcerptTailer toEnd()
ExcerptTailerIf the direction() == FORWARD, this will be the index position corresponding to one more than the last entry. Otherwise, the index will be the last excerpt.
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 using the same queue instance ( and with then same JVM ), they can be informed that the last cycle has changed, this will yield better results, but atomicity can still not be guaranteed.
toEnd in interface ExcerptTailerpublic ExcerptTailer striding(boolean striding)
ExcerptTailerstriding property of this Trailer.
When striding is enabled AND direction is BACKWARD, skip to the entries easiest to find, doesn't need to be every entry.
striding in interface ExcerptTailerstriding - skip to the indexStride if that is easy, doesn't always happen.public boolean striding()
ExcerptTailerstriding in interface ExcerptTailerExcerptTailer.striding(boolean)@NotNull public ExcerptTailer originalToEnd()
public TailerDirection direction()
ExcerptTailerThe direction determines the direction of movement upon reading an excerpt.
direction in interface ExcerptTailer@NotNull public ExcerptTailer direction(TailerDirection direction)
ExcerptTailerThe direction determines the direction of movement upon reading an excerpt.
direction in interface ExcerptTailerdirection - which is either of NONE, FORWARD, BACKWARD@NotNull public ChronicleQueue queue()
ExcerptCommonqueue in interface ExcerptCommon<ExcerptTailer>public Runnable getCloserJob()
ExcerptTailerThe task shall de-allocate any internal resources held.
getCloserJob in interface ExcerptTailerpublic void releaseResources()
public void readAfterReplicaAcknowledged(boolean readAfterReplicaAcknowledged)
ExcerptTailerreadAfterReplicaAcknowledged.
Enterprise Queue only: if replication enabled, setting this to true on a source queue ensures that this tailer will not read until at least one of the sinks has acknowledged receipt of the excerpt. This will block forever if no sinks acknowledge receipt.
readAfterReplicaAcknowledged in interface ExcerptTailerreadAfterReplicaAcknowledged - enablepublic boolean readAfterReplicaAcknowledged()
ExcerptTailerEnterprise Queue only: if replication enabled, setting this to true on a source queue ensures that this tailer will not read until at least one of the sinks has acknowledged receipt of the excerpt. This will block forever if no sinks acknowledge receipt.
readAfterReplicaAcknowledged in interface ExcerptTailer@NotNull public TailerState state()
ExcerptTailerTailerState of this Trailer.state in interface ExcerptTailerTailerState of this TrailerTailerState@NotNull public ExcerptTailer afterLastWritten(@NotNull ChronicleQueue queue)
ExcerptTailerafterLastWritten in interface ExcerptTailerqueue - which was written to.public void setCycle(int cycle)
Copyright © 2020. All rights reserved.