summaryrefslogtreecommitdiffstats
path: root/otautil/include
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2017-11-09 23:00:36 +0100
committerandroid-build-merger <android-build-merger@google.com>2017-11-09 23:00:36 +0100
commit9715398c4b24edd8aea2bc2cb0f471f98fcab45b (patch)
treee3c990eb46754f3ca865ab904a5007837eeb52ca /otautil/include
parentMerge "otautil: Remove the aborts in RangeSet::Parse()." am: 16b8b8fd1c am: 236a7261cb (diff)
parentMerge "Load-balancing update_verifier worker threads." am: f1e70b93f1 (diff)
downloadandroid_bootable_recovery-9715398c4b24edd8aea2bc2cb0f471f98fcab45b.tar
android_bootable_recovery-9715398c4b24edd8aea2bc2cb0f471f98fcab45b.tar.gz
android_bootable_recovery-9715398c4b24edd8aea2bc2cb0f471f98fcab45b.tar.bz2
android_bootable_recovery-9715398c4b24edd8aea2bc2cb0f471f98fcab45b.tar.lz
android_bootable_recovery-9715398c4b24edd8aea2bc2cb0f471f98fcab45b.tar.xz
android_bootable_recovery-9715398c4b24edd8aea2bc2cb0f471f98fcab45b.tar.zst
android_bootable_recovery-9715398c4b24edd8aea2bc2cb0f471f98fcab45b.zip
Diffstat (limited to 'otautil/include')
-rw-r--r--otautil/include/otautil/rangeset.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/otautil/include/otautil/rangeset.h b/otautil/include/otautil/rangeset.h
index af8ae2dee..e91d02ca6 100644
--- a/otautil/include/otautil/rangeset.h
+++ b/otautil/include/otautil/rangeset.h
@@ -49,6 +49,14 @@ class RangeSet {
// bounds. For example, "3,5" contains blocks 3 and 4. So "3,5" and "5,7" are not overlapped.
bool Overlaps(const RangeSet& other) const;
+ // Returns a vector of RangeSets that contain the same set of blocks represented by the current
+ // RangeSet. The RangeSets in the vector contain similar number of blocks, with a maximum delta
+ // of 1-block between any two of them. For example, 14 blocks would be split into 4 + 4 + 3 + 3,
+ // as opposed to 4 + 4 + 4 + 2. If the total number of blocks (T) is less than groups, it
+ // returns a vector of T 1-block RangeSets. Otherwise the number of the returned RangeSets must
+ // equal to groups. The current RangeSet remains intact after the split.
+ std::vector<RangeSet> Split(size_t groups) const;
+
// Returns the number of Range's in this RangeSet.
size_t size() const {
return ranges_.size();