public class SnapshotTaker extends Object
| Modifier and Type | Field and Description |
|---|---|
protected BufferClaim |
bufferClaim
Reusable
BufferClaim to avoid allocation. |
protected IdleStrategy |
idleStrategy
IdleStrategy to be called when back pressure is propagated from the publication. |
protected MessageHeaderEncoder |
messageHeaderEncoder
Reusable
MessageHeaderEncoder to avoid allocation. |
protected ExclusivePublication |
publication
Publication to which the snapshot will be written. |
| Constructor and Description |
|---|
SnapshotTaker(ExclusivePublication publication,
IdleStrategy idleStrategy,
AgentInvoker aeronAgentInvoker)
Construct a
SnapshotTaker which will encode the snapshot to a publication. |
| Modifier and Type | Method and Description |
|---|---|
protected static void |
checkInterruptStatus()
Check for thread interrupt and throw an
AgentTerminationException if interrupted. |
protected static void |
checkResult(long result)
Check the result of offering to a publication when writing a snapshot.
|
protected void |
checkResultAndIdle(long result)
Check the result of offering to a publication when writing a snapshot and then idle after invoking the client
agent if necessary.
|
protected void |
invokeAgentClient()
Invoke the Aeron client agent if necessary.
|
void |
markBegin(long snapshotTypeId,
long logPosition,
long leadershipTermId,
int snapshotIndex,
TimeUnit timeUnit,
int appVersion)
Mark the beginning of the encoded snapshot.
|
void |
markEnd(long snapshotTypeId,
long logPosition,
long leadershipTermId,
int snapshotIndex,
TimeUnit timeUnit,
int appVersion)
Mark the end of the encoded snapshot.
|
void |
markSnapshot(long snapshotTypeId,
long logPosition,
long leadershipTermId,
int snapshotIndex,
SnapshotMark snapshotMark,
TimeUnit timeUnit,
int appVersion)
Generically
SnapshotMark a snapshot. |
protected void |
offer(DirectBuffer buffer,
int offset,
int length)
Helper method to offer a message into the snapshot publication.
|
protected final BufferClaim bufferClaim
BufferClaim to avoid allocation.protected final MessageHeaderEncoder messageHeaderEncoder
MessageHeaderEncoder to avoid allocation.protected final ExclusivePublication publication
Publication to which the snapshot will be written.protected final IdleStrategy idleStrategy
IdleStrategy to be called when back pressure is propagated from the publication.public SnapshotTaker(ExclusivePublication publication, IdleStrategy idleStrategy, AgentInvoker aeronAgentInvoker)
SnapshotTaker which will encode the snapshot to a publication.publication - into which the snapshot will be encoded.idleStrategy - to call when the publication is back pressured.aeronAgentInvoker - to call when idling so it stays active.public void markBegin(long snapshotTypeId,
long logPosition,
long leadershipTermId,
int snapshotIndex,
TimeUnit timeUnit,
int appVersion)
snapshotTypeId - type to identify snapshot within a cluster.logPosition - at which the snapshot was taken.leadershipTermId - at which the snapshot was taken.snapshotIndex - so the snapshot can be sectioned.timeUnit - of the cluster timestamps stored in the snapshot.appVersion - associated with the snapshot from ClusteredServiceContainer.Context.appVersion().public void markEnd(long snapshotTypeId,
long logPosition,
long leadershipTermId,
int snapshotIndex,
TimeUnit timeUnit,
int appVersion)
snapshotTypeId - type to identify snapshot within a cluster.logPosition - at which the snapshot was taken.leadershipTermId - at which the snapshot was taken.snapshotIndex - so the snapshot can be sectioned.timeUnit - of the cluster timestamps stored in the snapshot.appVersion - associated with the snapshot from ClusteredServiceContainer.Context.appVersion().public void markSnapshot(long snapshotTypeId,
long logPosition,
long leadershipTermId,
int snapshotIndex,
SnapshotMark snapshotMark,
TimeUnit timeUnit,
int appVersion)
SnapshotMark a snapshot.snapshotTypeId - type to identify snapshot within a cluster.logPosition - at which the snapshot was taken.leadershipTermId - at which the snapshot was taken.snapshotIndex - so the snapshot can be sectioned.snapshotMark - which specifies the type of snapshot mark.timeUnit - of the cluster timestamps stored in the snapshot.appVersion - associated with the snapshot from ClusteredServiceContainer.Context.appVersion().protected static void checkInterruptStatus()
AgentTerminationException if interrupted.protected static void checkResult(long result)
result - of an offer or try claim to a publication.protected void checkResultAndIdle(long result)
result - of an offer or try claim to a publication.protected void invokeAgentClient()
protected final void offer(DirectBuffer buffer, int offset, int length)
buffer - containing the message.offset - at which the message begins.length - of the message.Copyright © 2014-2023 Real Logic Limited. All Rights Reserved.