code: CompletableFuture<Void> createSegment(String segmentName, Collection<AttributeUpdate> attributes, Duration timeout) {
          long traceId = LoggerHelpers.traceEnterWithContext(log, traceObjectId, "createSegment", segmentName);
          long segmentId = this.connector.containerMetadata.getStreamSegmentId(segmentName, true);
          if (isValidSegmentId(segmentId)) {
              // Quick fail: see if this is an active Segment, and if so, don't bother with anything else.
              return Futures.failedFuture(new StreamSegmentExistsException(segmentName));
          }
  
          ArrayView segmentInfo = SegmentInfo.serialize(SegmentInfo.newSegment(segmentName, attributes));
          CompletableFuture<Void> result = createSegment(segmentName, segmentInfo, new TimeoutTimer(timeout));
          if (log.isTraceEnabled()) {
              result.thenAccept(v -> LoggerHelpers.traceLeave(log, traceObjectId, "createSegment", traceId, segmentName));
          }
  
          return result;
      }
docs: Creates a new Segment with given name.
  
  @param segmentName The case-sensitive Segment Name.
  @param attributes  The initial attributes for the StreamSegment, if any.
  @param timeout     Timeout for the operation.
  @return A CompletableFuture that, when completed normally, will indicate the Segment has been created.
  If the operation failed, this will contain the exception that caused the failure. Notable exceptions:
  <ul>
  <li>{@link StreamSegmentExistsException} If the Segment already exists.
  </ul>