+
+
+ /**
+ * Performs a snapshot with no capture on the replicated log.
+ * It clears the log from the supplied index or last-applied-1 which ever is minimum.
+ *
+ * @param snapshotCapturedIndex
+ */
+ protected void performSnapshotWithoutCapture(final long snapshotCapturedIndex) {
+ long actualIndex = context.getSnapshotManager().trimLog(snapshotCapturedIndex, this);
+
+ if(actualIndex != -1){
+ setReplicatedToAllIndex(actualIndex);
+ }
+ }
+
+ protected String getId(){
+ return context.getId();
+ }
+
+ public void applyServerConfiguration(ServerConfigurationPayload serverConfig) {
+ Map<String, String> currentPeers = context.getPeerAddresses();
+ for(String peerId: serverConfig.getNewServerConfig()) {
+ if(!getId().equals(peerId)) {
+ if(!currentPeers.containsKey(peerId)) {
+ context.addToPeers(peerId, null);
+ } else {
+ currentPeers.remove(peerId);
+ }
+ }
+ }
+
+ for(String peerIdToRemove: currentPeers.keySet()) {
+ context.removePeer(peerIdToRemove);
+ }
+ }