@SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void testCaptureToInstall() { snapshotManager.captureToInstall(new SimpleReplicatedLogEntry(0, 1, new MockRaftActorContext.MockPayload()), 0, "follower-1"); assertEquals(true, snapshotManager.isCapturing()); ArgumentCaptor<Optional> outputStream = ArgumentCaptor.forClass(Optional.class); verify(mockProcedure).accept(outputStream.capture()); assertEquals("isPresent", true, outputStream.getValue().isPresent()); CaptureSnapshot captureSnapshot = snapshotManager.getCaptureSnapshot(); assertEquals(0L, captureSnapshot.getLastIndex()); assertEquals(1L, captureSnapshot.getLastTerm()); assertEquals(0L, captureSnapshot.getLastAppliedIndex()); assertEquals(1L, captureSnapshot.getLastAppliedTerm()); assertEquals(-1L, captureSnapshot.getReplicatedToAllIndex()); assertEquals(-1L, captureSnapshot.getReplicatedToAllTerm()); MessageCollectorActor.clearMessages(actorRef); }
@Override public boolean captureToInstall(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex, final String targetFollower) { return currentState.captureToInstall(lastLogEntry, replicatedToAllIndex, targetFollower); }
SnapshotManager implements SnapshotState { @Override public boolean captureToInstall(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex, final String targetFollower) { return currentState.captureToInstall(lastLogEntry, replicatedToAllIndex, targetFollower); } }
SnapshotManager implements SnapshotState { @Override public boolean captureToInstall(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex, final String targetFollower) { return currentState.captureToInstall(lastLogEntry, replicatedToAllIndex, targetFollower); } SnapshotManager(final RaftActorContext context, final Logger logger); }
SnapshotManager implements SnapshotState { @Override public boolean captureToInstall(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex, final String targetFollower) { return currentState.captureToInstall(lastLogEntry, replicatedToAllIndex, targetFollower); } SnapshotManager(final RaftActorContext context, final Logger logger); boolean isApplying(); @Override boolean isCapturing(); @Override boolean captureToInstall(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex,
            final String targetFollower); @Override boolean capture(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex); @Override boolean captureWithForcedTrim(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex); @Override void apply(final ApplySnapshot snapshot); @Override void persist(final Snapshot.State state, final Optional<OutputStream> installSnapshotStream,
            final long totalMemory); @Override void commit(final long sequenceNumber, final long timeStamp); @Override void rollback(); @Override long trimLog(final long desiredTrimIndex); Snapshot.@NonNull State convertSnapshot(final ByteSource snapshotBytes); long getLastSequenceNumber(); @VisibleForTesting CaptureSnapshot getCaptureSnapshot(); CaptureSnapshot newCaptureSnapshot(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex,
                                              final boolean mandatoryTrim); }
SnapshotManager implements SnapshotState { @Override public boolean captureToInstall(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex, final String targetFollower) { return currentState.captureToInstall(lastLogEntry, replicatedToAllIndex, targetFollower); } SnapshotManager(final RaftActorContext context, final Logger logger); boolean isApplying(); @Override boolean isCapturing(); @Override boolean captureToInstall(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex,
            final String targetFollower); @Override boolean capture(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex); @Override boolean captureWithForcedTrim(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex); @Override void apply(final ApplySnapshot snapshot); @Override void persist(final Snapshot.State state, final Optional<OutputStream> installSnapshotStream,
            final long totalMemory); @Override void commit(final long sequenceNumber, final long timeStamp); @Override void rollback(); @Override long trimLog(final long desiredTrimIndex); Snapshot.@NonNull State convertSnapshot(final ByteSource snapshotBytes); long getLastSequenceNumber(); @VisibleForTesting CaptureSnapshot getCaptureSnapshot(); CaptureSnapshot newCaptureSnapshot(final ReplicatedLogEntry lastLogEntry, final long replicatedToAllIndex,
                                              final boolean mandatoryTrim);  }