Add XorExtentWriter
This class is built on top of BlockExtentWriter(block aligned writer)
and ExtentMap. It will look at the extent map, convert blocks in the
extent map to XOR type, and convert everythign else to COW_REPLACE.
Test: th
Bug: 177104308
Change-Id: I6f9df83ed09f1c5a6aae9f266412132b002acd29
diff --git a/payload_generator/extent_utils.h b/payload_generator/extent_utils.h
index 2bd6626..f5bb39c 100644
--- a/payload_generator/extent_utils.h
+++ b/payload_generator/extent_utils.h
@@ -86,7 +86,9 @@
uint64_t block_offset,
uint64_t block_count);
-bool operator==(const Extent& a, const Extent& b);
+bool operator==(const Extent& a, const Extent& b) noexcept;
+
+bool operator!=(const Extent& a, const Extent& b) noexcept;
// TODO(zhangkelvin) This is ugly. Rewrite using C++20's coroutine once
// that's available. Unfortunately with C++17 this is the best I could do.
@@ -126,6 +128,10 @@
};
std::ostream& operator<<(std::ostream& out, const Extent& extent);
+std::ostream& operator<<(std::ostream& out, const std::vector<Extent>& extent);
+std::ostream& operator<<(
+ std::ostream& out,
+ const google::protobuf::RepeatedPtrField<Extent>& extent);
template <typename Container>
size_t GetNthBlock(const Container& extents, const size_t n) {