code: private CompletableFuture<WriterFlushResult> flushFully(TimeoutTimer timer) {
          long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "flushFully");
          WriterFlushResult result = new WriterFlushResult();
          return Futures
                  .loop(
                          this::canContinueFlushingFully,
                          () -> flushPendingAppends(timer.getRemaining())
                                  .thenCompose(flushResult -> flushPendingTruncate(flushResult, timer.getRemaining())),
                          result::withFlushResult,
                          this.executor)
                  .thenApply(v -> {
                      LoggerHelpers.traceLeave(log, this.traceObjectId, "flushFully", traceId, result);
                      return result;
                  });
      }
docs: Flushes all Append Operations that can be flushed at the given moment (until the entire Aggregator is emptied out
  or until a StreamSegmentSealOperation or MergeSegmentOperation is encountered).
  
  @param timer Timer for the operation.
  @return A CompletableFuture that, when completed, will contain the result from the flush operation.