code: long getEndOffsetForSegment(Segment segment) {
          return Optional.ofNullable(sync.getState().getEndSegments().get(segment)).orElse(Long.MAX_VALUE);
      }
docs: Fetch the configured end offset for a configured segment. If end offset is not configured return Long.MAX_VALUE.
  
  @param segment Segment.
  @return endOffset of the segment.