@Test public void testRemoveFromAndPersist() throws Exception { ReplicatedLog log = ReplicatedLogImpl.newInstance(context); log.append(new SimpleReplicatedLogEntry(0, 1, new MockPayload("0"))); log.append(new SimpleReplicatedLogEntry(1, 1, new MockPayload("1"))); log.append(new SimpleReplicatedLogEntry(2, 1, new MockPayload("2"))); log.removeFromAndPersist(1); DeleteEntries deleteEntries = new DeleteEntries(1); verifyPersist(deleteEntries, match(deleteEntries), false); assertEquals("size", 1, log.size()); reset(mockPersistence); log.removeFromAndPersist(1); verifyNoMoreInteractions(mockPersistence); }
@Override public boolean removeFromAndPersist(final long logEntryIndex) { long adjustedIndex = removeFrom(logEntryIndex); if (adjustedIndex >= 0) { context.getPersistenceProvider().persist(new DeleteEntries(logEntryIndex), NoopProcedure.instance()); return true; } return false; }
ReplicatedLogImpl extends AbstractReplicatedLogImpl { @Override public boolean removeFromAndPersist(final long logEntryIndex) { long adjustedIndex = removeFrom(logEntryIndex); if (adjustedIndex >= 0) { context.getPersistenceProvider().persist(new DeleteEntries(logEntryIndex), NoopProcedure.instance()); return true; } return false; } }
ReplicatedLogImpl extends AbstractReplicatedLogImpl { @Override public boolean removeFromAndPersist(final long logEntryIndex) { long adjustedIndex = removeFrom(logEntryIndex); if (adjustedIndex >= 0) { context.getPersistenceProvider().persist(new DeleteEntries(logEntryIndex), NoopProcedure.instance()); return true; } return false; } private  ReplicatedLogImpl(final long snapshotIndex, final long snapshotTerm,
            final List<ReplicatedLogEntry> unAppliedEntries,
            final RaftActorContext context); }
ReplicatedLogImpl extends AbstractReplicatedLogImpl { @Override public boolean removeFromAndPersist(final long logEntryIndex) { long adjustedIndex = removeFrom(logEntryIndex); if (adjustedIndex >= 0) { context.getPersistenceProvider().persist(new DeleteEntries(logEntryIndex), NoopProcedure.instance()); return true; } return false; } private  ReplicatedLogImpl(final long snapshotIndex, final long snapshotTerm,
            final List<ReplicatedLogEntry> unAppliedEntries,
            final RaftActorContext context); @Override boolean removeFromAndPersist(final long logEntryIndex); @Override boolean shouldCaptureSnapshot(final long logIndex); @Override void captureSnapshotIfReady(final ReplicatedLogEntry replicatedLogEntry); @Override boolean appendAndPersist(final ReplicatedLogEntry replicatedLogEntry,
            final Consumer<ReplicatedLogEntry> callback, final boolean doAsync); }
ReplicatedLogImpl extends AbstractReplicatedLogImpl { @Override public boolean removeFromAndPersist(final long logEntryIndex) { long adjustedIndex = removeFrom(logEntryIndex); if (adjustedIndex >= 0) { context.getPersistenceProvider().persist(new DeleteEntries(logEntryIndex), NoopProcedure.instance()); return true; } return false; } private  ReplicatedLogImpl(final long snapshotIndex, final long snapshotTerm,
            final List<ReplicatedLogEntry> unAppliedEntries,
            final RaftActorContext context); @Override boolean removeFromAndPersist(final long logEntryIndex); @Override boolean shouldCaptureSnapshot(final long logIndex); @Override void captureSnapshotIfReady(final ReplicatedLogEntry replicatedLogEntry); @Override boolean appendAndPersist(final ReplicatedLogEntry replicatedLogEntry,
            final Consumer<ReplicatedLogEntry> callback, final boolean doAsync);  }