code: protected CompletableFuture<Long> submitAssignment(SegmentInfo segmentInfo, boolean pin, Duration timeout) {
          SegmentProperties properties = segmentInfo.getProperties();
          if (properties.isDeleted()) {
              // Stream does not exist. Fail the request with the appropriate exception.
              failAssignment(properties.getName(), new StreamSegmentNotExistsException("StreamSegment does not exist."));
              return Futures.failedFuture(new StreamSegmentNotExistsException(properties.getName()));
          }
  
          long existingSegmentId = this.connector.containerMetadata.getStreamSegmentId(properties.getName(), true);
          if (isValidSegmentId(existingSegmentId)) {
              // Looks like someone else beat us to it.
              completeAssignment(properties.getName(), existingSegmentId);
              return CompletableFuture.completedFuture(existingSegmentId);
          } else {
              return this.connector.getMapSegmentId()
                                   .apply(segmentInfo.getSegmentId(), segmentInfo.getProperties(), pin, timeout)
                                   .thenApply(id -> completeAssignment(properties.getName(), id));
          }
      }
docs: Invokes the {@link Connector#getMapSegmentId()} callback in order to assign an Id to a Segment. Upon completion,
  this operation will have mapped the given Segment to a new internal Segment Id if none was provided in the given
  SegmentInfo. If the given SegmentInfo already has a SegmentId set, then all efforts will be made to map that Segment
  with the requested Segment Id.
  
  @param segmentInfo The SegmentInfo for the StreamSegment to generate and persist.
  @param pin         If true, this Segment's metadata will be pinned to memory.
  @param timeout     Timeout for the operation.
  @return A CompletableFuture that, when completed, will contain the internal SegmentId that was assigned (or the
  one supplied via SegmentInfo, if any). If the operation failed, then this Future will complete with that exception.