public static class SingleChronicleQueueExcerpts.StoreTailer extends Object implements ExcerptTailer, net.openhft.chronicle.wire.SourceContext, ExcerptContext
Constructor and Description |
---|
StoreTailer(@NotNull SingleChronicleQueue queue) |
StoreTailer(@NotNull SingleChronicleQueue queue,
net.openhft.chronicle.core.values.LongValue indexValue) |
Modifier and Type | Method and Description |
---|---|
@NotNull ExcerptTailer |
afterLastWritten(@NotNull 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.
|
@NotNull 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 . |
@NotNull ExcerptTailer |
originalToEnd() |
boolean |
peekDocument()
Returns
true if ExcerptTailer.readingDocument() would return a document which is present, in other words would return a DocumentContext where DocumentContext.isPresent() == true
For the best performance you should only use this method once a message has been found by toStart() or readingDocument(). |
@NotNull 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(@NotNull net.openhft.chronicle.wire.ReadMarshallable reader) |
static @Nullable net.openhft.chronicle.wire.MessageHistory |
readHistory(net.openhft.chronicle.wire.DocumentContext dc,
net.openhft.chronicle.wire.MessageHistory history) |
@NotNull net.openhft.chronicle.wire.DocumentContext |
readingDocument()
Returns the
DocumentContext for this ExcerptTailer. |
@NotNull 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.
|
@NotNull 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() |
@NotNull ExcerptTailer |
toEnd()
Moves the index for this Trailer to the end of the queue.
|
@NotNull ExcerptTailer |
toStart()
Moves the index for this Trailer to the first existing excerpt in the queue.
|
@NotNull String |
toString() |
net.openhft.chronicle.wire.Wire |
wire() |
net.openhft.chronicle.wire.Wire |
wireForIndex() |
public StoreTailer(@NotNull @NotNull SingleChronicleQueue queue)
public StoreTailer(@NotNull @NotNull SingleChronicleQueue queue, net.openhft.chronicle.core.values.LongValue indexValue)
@Nullable public static @Nullable net.openhft.chronicle.wire.MessageHistory readHistory(net.openhft.chronicle.wire.DocumentContext dc, net.openhft.chronicle.wire.MessageHistory history)
public boolean readDocument(@NotNull @NotNull net.openhft.chronicle.wire.ReadMarshallable reader)
readDocument
in interface net.openhft.chronicle.wire.MarshallableIn
@NotNull public @NotNull net.openhft.chronicle.wire.DocumentContext readingDocument()
ExcerptTailer
DocumentContext
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 ExcerptTailer
readingDocument
in interface net.openhft.chronicle.wire.MarshallableIn
public net.openhft.chronicle.wire.Wire wire()
wire
in interface ExcerptContext
public net.openhft.chronicle.wire.Wire wireForIndex()
wireForIndex
in interface ExcerptContext
public long timeoutMS()
timeoutMS
in interface ExcerptContext
public int sourceId()
ExcerptCommon
sourceId
in interface ExcerptCommon<ExcerptTailer>
sourceId
in interface net.openhft.chronicle.wire.SourceContext
ChronicleQueue.sourceId()
@NotNull public @NotNull net.openhft.chronicle.wire.DocumentContext readingDocument(boolean includeMetaData)
ExcerptTailer
DocumentContext
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 ExcerptTailer
includeMetaData
- if the DocumentContext shall be meta data aware.public boolean peekDocument()
ExcerptTailer
true
if ExcerptTailer.readingDocument()
would return a document which is present, in other words would return a DocumentContext where DocumentContext.isPresent()
== true
For the best performance you should only use this method once a message has been found by toStart() or readingDocument(). Otherwise ExcerptTailer.readingDocument()
is called and then rolled back, which is not optimal.
For the same reason, this method should also be avoided when reading documents backwards.peekDocument
in interface ExcerptTailer
peekDocument
in interface net.openhft.chronicle.wire.MarshallableIn
ExcerptTailer.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 ExcerptTailer
index
in interface net.openhft.chronicle.wire.SourceContext
public int cycle()
ExcerptTailer
Usually, each cycle will have its own unique data file to store excerpts.
cycle
in interface ExcerptTailer
public boolean moveToIndex(long index)
ExcerptTailer
index
.
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 ExcerptTailer
index
- index to move to.@NotNull public final @NotNull ExcerptTailer toStart()
ExcerptTailer
toStart
in interface ExcerptTailer
@NotNull public @NotNull ExcerptTailer toEnd()
ExcerptTailer
If 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 ExcerptTailer
public ExcerptTailer striding(boolean striding)
ExcerptTailer
striding
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 ExcerptTailer
striding
- skip to the indexStride if that is easy, doesn't always happen.public boolean striding()
ExcerptTailer
striding
in interface ExcerptTailer
ExcerptTailer.striding(boolean)
@NotNull public @NotNull ExcerptTailer originalToEnd()
public TailerDirection direction()
ExcerptTailer
The direction determines the direction of movement upon reading an excerpt.
direction
in interface ExcerptTailer
@NotNull public @NotNull ExcerptTailer direction(TailerDirection direction)
ExcerptTailer
The direction determines the direction of movement upon reading an excerpt.
direction
in interface ExcerptTailer
direction
- which is either of NONE, FORWARD, BACKWARD@NotNull public @NotNull ChronicleQueue queue()
ExcerptCommon
queue
in interface ExcerptCommon<ExcerptTailer>
public Runnable getCloserJob()
ExcerptTailer
The task shall de-allocate any internal resources held.
getCloserJob
in interface ExcerptTailer
public void releaseResources()
public void readAfterReplicaAcknowledged(boolean readAfterReplicaAcknowledged)
ExcerptTailer
readAfterReplicaAcknowledged
.
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 ExcerptTailer
readAfterReplicaAcknowledged
- enablepublic boolean readAfterReplicaAcknowledged()
ExcerptTailer
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 ExcerptTailer
@NotNull public @NotNull TailerState state()
ExcerptTailer
TailerState
of this Trailer.state
in interface ExcerptTailer
TailerState
of this TrailerTailerState
@NotNull public @NotNull ExcerptTailer afterLastWritten(@NotNull @NotNull ChronicleQueue queue)
ExcerptTailer
afterLastWritten
in interface ExcerptTailer
queue
- which was written to.public void setCycle(int cycle)
Copyright © 2020. All rights reserved.