code: @SuppressWarnings("unchecked")
    public <T> CompletableFuture<T> apply(long index) {
      CompletableFuture<T> future = futures.computeIfAbsent(index, i -> new CompletableFuture<T>());
      enqueueBatch(index);
      return future;
    }
docs: Applies the entry at the given index to the state machine.
  <p>
  Calls to this method are assumed to expect a result. This means linearizable session events triggered by the
  application of the command at the given index will be awaited before completing the returned future.
  
  @param index The index to apply.
  @return A completable future to be completed once the commit has been applied.