code: private CompletableFuture<WriterFlushResult> flushOnce(TimeoutTimer timer) {
          boolean hasDelete = this.hasDeletePending.get();
          boolean hasMerge = this.mergeTransactionCount.get() > 0;
          boolean hasSeal = this.hasSealPending.get();
          boolean hasTruncate = this.truncateCount.get() > 0;
          long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "flushOnce", this.operations.size(),
                  this.mergeTransactionCount, hasSeal, hasTruncate, hasDelete);
  
          CompletableFuture<WriterFlushResult> result;
          if (hasDelete) {
              // If we have a Deletes, simply delete the Segment and move on. No other operation matters now.
              result = deleteSegment(timer);
          } else if (hasSeal || hasMerge || hasTruncate) {
              // If we have a Seal, Merge or Truncate Pending, flush everything until we reach that operation.
              result = flushFully(timer);
              if (hasMerge) {
                  // If we have a merge, do it after we flush fully.
                  result = result.thenComposeAsync(flushResult -> mergeIfNecessary(flushResult, timer), this.executor);
              }
  
              if (hasSeal) {
                  // If we have a seal, do it after every other operation.
                  result = result.thenComposeAsync(flushResult -> sealIfNecessary(flushResult, timer), this.executor);
              }
          } else {
              // Otherwise, just flush the excess as long as we have something to flush.
              result = flushExcess(timer);
          }
  
          if (log.isTraceEnabled()) {
              result = result.thenApply(r -> {
                  LoggerHelpers.traceLeave(log, this.traceObjectId, "flushOnce", traceId, r);
                  return r;
              });
          }
  
          return result;
      }
docs: Flushes the contents of the Aggregator exactly once to the Storage in a 'normal' mode (where it does not need to
  do any reconciliation).
  
  @param timer Timer for the operation.
  @return A CompletableFuture that, when completed, will contain the result from the flush operation.