update_engine: Implement FilterExtentRanges.
This patch includes a new FilterExtentRanges() function to filter out
a set of blocks from a list of extents. This function is useful to remove
overlapping lists of blocks when generating operations during delta
generation. While this function is included in the main update_engine
daemon as well, the whole extent_ranges.{cc,h} module will be migrated
to the payload_generator/ directory. This function will be used in a
follow up CL.
BUG=None
TEST=Added unittests.
Change-Id: Ia9d561550fd6f59d59a9e178dd866fd71a095375
Reviewed-on: https://chromium-review.googlesource.com/275802
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
diff --git a/extent_ranges.h b/extent_ranges.h
index 4376d05..ec3547c 100644
--- a/extent_ranges.h
+++ b/extent_ranges.h
@@ -68,6 +68,12 @@
uint64_t blocks_;
};
+// Filters out from the passed list of extents |extents| all the blocks in the
+// ExtentRanges set. Note that the order of the blocks in |extents| is preserved
+// omitting blocks present in the ExtentRanges |ranges|.
+std::vector<Extent> FilterExtentRanges(const std::vector<Extent>& extents,
+ const ExtentRanges& ranges);
+
} // namespace chromeos_update_engine
#endif // UPDATE_ENGINE_EXTENT_RANGES_H_