code: private <E extends RaftLogEntry> CompletableFuture<Indexed<E>> appendAndCompact(E entry) {
      return appendAndCompact(entry, 0);
    }
docs: Appends an entry to the Raft log and compacts logs if necessary.
  
  @param entry the entry to append
  @param <E>   the entry type
  @return a completable future to be completed once the entry has been appended