mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Mahler <bmah...@apache.org>
Subject Re: Review Request 50062: Updated makePortRanges for variable types.
Date Mon, 18 Jul 2016 19:07:10 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/50062/#review142607
-----------------------------------------------------------




src/tests/hierarchical_allocator_tests.cpp (lines 85 - 114)
<https://reviews.apache.org/r/50062/#comment208230>

    Looks like we can simplify this like we did in sorter_tests?
    
    ```
    // Returns a "ports" resource with the number of ranges
    // specified as: [1-2, 4-5, 7-8, 10-11, ...]
    static Resource makePortRanges(size_t numRanges)
    {
      ::mesos::Value::Ranges ranges;
    
      for (size_t i = 0; i < numRanges; ++i) {
        Value::Range* range = ranges.add_range();
        range->set_begin((3 * i) + 1);
        range->set_end(range->begin() + 1);
      }
    
      Value value;
      value.set_type(Value::RANGES);
      value.mutable_ranges()->CopyFrom(ranges);
    
      Resource resource;
      resource.set_role("*");
      resource.set_name("ports");
      resource.set_type(Value::RANGES);
      resource.mutable_ranges()->CopyFrom(value.ranges());
    
      return resource;
    }
    ```
    
    Then we don't need `makeRange`.


- Benjamin Mahler


On July 16, 2016, 3:15 a.m., Guangya Liu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/50062/
> -----------------------------------------------------------
> 
> (Updated July 16, 2016, 3:15 a.m.)
> 
> 
> Review request for mesos, Benjamin Mahler and Jiang Yan Xu.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> 1) Using `size_t` for counter.
> 2) Using `uint64_t` for range related values.
> 
> 
> Diffs
> -----
> 
>   src/tests/hierarchical_allocator_tests.cpp ce5da6be490b6fce311286eb4018c91eef55067e

> 
> Diff: https://reviews.apache.org/r/50062/diff/
> 
> 
> Testing
> -------
> 
> make
> make check
> 
> 
> Thanks,
> 
> Guangya Liu
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message