code: protected CompletableFuture<QueryResponse> applyQuery(QueryEntry entry, CompletableFuture<QueryResponse> future) {
      // In the case of the leader, the state machine is always up to date, so no queries will be queued and all query
      // indexes will be the last applied index.
      context.getStateMachine().<ServerStateMachine.Result>apply(entry).whenComplete((result, error) -> {
        completeOperation(result, QueryResponse.builder(), error, future);
        entry.release();
      });
      return future;
    }
docs: Applies a query to the state machine.