}
}
+ceph::bufferlist TestBlockPhysical::get_delta() {
+ ceph::bufferlist bl;
+ encode(delta, bl);
+ return bl;
+}
+
+void TestBlockPhysical::apply_delta_and_adjust_crc(
+ paddr_t, const ceph::bufferlist &bl) {
+ auto biter = bl.begin();
+ decltype(delta) deltas;
+ decode(deltas, biter);
+ for (auto &&d : deltas) {
+ set_contents(d.val, d.offset, d.len);
+ }
+}
+
}
TestBlockPhysical(ceph::bufferptr &&ptr)
: CachedExtent(std::move(ptr)) {}
- TestBlockPhysical(const TestBlock &other)
+ TestBlockPhysical(const TestBlockPhysical &other)
: CachedExtent(other) {}
CachedExtentRef duplicate_for_write() final {
void set_contents(char c, uint16_t offset, uint16_t len) {
::memset(get_bptr().c_str() + offset, c, len);
+ delta.push_back({c, offset, len});
}
void set_contents(char c) {
set_contents(c, 0, get_length());
}
- ceph::bufferlist get_delta() final { return ceph::bufferlist(); }
+ ceph::bufferlist get_delta() final;
- void apply_delta_and_adjust_crc(paddr_t, const ceph::bufferlist &bl) final {}
+ void apply_delta_and_adjust_crc(paddr_t, const ceph::bufferlist &bl) final;
};
using TestBlockPhysicalRef = TCachedExtentRef<TestBlockPhysical>;