[ 
https://issues.apache.org/jira/browse/MESOS-5425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15326154#comment-15326154
 ] 

Yanyan Hu commented on MESOS-5425:
----------------------------------

Fix has been proposed here:
https://reviews.apache.org/r/48593/

The approach is re-implementing Ranges subtraction using IntervalSet data type: 
Ranges values(both subtrahend and minuend) are first converted to IntervalSet 
values. Then subtraction is done between these two IntervalSet values. The 
result is finally converted back to Ranges value.

Two new functions are added to make converting:

// Convert Ranges value to IntervalSet value
void Ranges2IntervalSet(const Value::Ranges& res, IntervalSet<int>& set)

// Convert IntervalSet value to Ranges value
void IntervalSet2Ranges(const IntervalSet<int>& set, Value::Ranges& res)

> Consider using IntervalSet for Port range resource math
> -------------------------------------------------------
>
>                 Key: MESOS-5425
>                 URL: https://issues.apache.org/jira/browse/MESOS-5425
>             Project: Mesos
>          Issue Type: Improvement
>          Components: allocation
>            Reporter: Joseph Wu
>              Labels: mesosphere
>
> Follow-up JIRA for comments raised in MESOS-3051 (see comments there).
> We should consider utilizing 
> [{{IntervalSet}}|https://github.com/apache/mesos/blob/a0b798d2fac39445ce0545cfaf05a682cd393abe/3rdparty/stout/include/stout/interval.hpp]
>  in [Port range resource 
> math|https://github.com/apache/mesos/blob/a0b798d2fac39445ce0545cfaf05a682cd393abe/src/common/values.cpp#L143].



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to