summaryrefslogtreecommitdiffstats
path: root/src/test/crimson/seastore/test_block.cc
blob: f7a39b0ef59cc25e90d782b9c7d6170441f84c14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#include "test/crimson/seastore/test_block.h"

namespace crimson::os::seastore {


ceph::bufferlist TestBlock::get_delta() {
  ceph::bufferlist bl;
  encode(delta, bl);
  return bl;
}


void TestBlock::apply_delta(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);
  }
}

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);
  }
}

}