]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:nil -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | ||
4 | #pragma once | |
5 | ||
6 | #include <cstdint> | |
7 | ||
8 | #include "common/hobject.h" | |
9 | #include "include/buffer_fwd.h" | |
10 | ||
11 | #include "crimson/os/seastore/onode.h" | |
12 | #include "crimson/os/seastore/seastore_types.h" | |
13 | ||
14 | using crimson::os::seastore::OnodeRef; | |
15 | ||
16 | struct delta_t { | |
17 | enum class op_t : uint8_t { | |
18 | nop, | |
19 | insert_onode, | |
20 | update_onode, | |
21 | insert_child, | |
22 | update_key, | |
23 | shift_left, | |
24 | trim_right, | |
25 | insert_front, | |
26 | insert_back, | |
27 | remove_from, | |
28 | // finer grained op? | |
29 | // - changing the embedded extent map of given oid | |
30 | // - mutating the embedded xattrs of given oid | |
31 | } op = op_t::nop; | |
32 | ||
33 | unsigned n = 0; | |
34 | ghobject_t oid; | |
35 | crimson::os::seastore::laddr_t addr = 0; | |
36 | OnodeRef onode; | |
37 | ceph::bufferptr keys; | |
38 | ceph::bufferptr cells; | |
39 | ||
40 | delta_t() = default; | |
41 | delta_t(op_t op) | |
42 | : op{op} | |
43 | {} | |
44 | delta_t(delta_t&& delta); | |
45 | delta_t& operator=(delta_t&& delta); | |
46 | ||
47 | static delta_t nop(); | |
48 | static delta_t insert_onode(unsigned slot, const ghobject_t& oid, OnodeRef onode); | |
49 | static delta_t update_onode(unsigned slot, const ghobject_t& oid, OnodeRef onode); | |
50 | static delta_t insert_child(unsigned slot, const ghobject_t& oid, crimson::os::seastore::laddr_t addr); | |
51 | static delta_t update_key(unsigned slot, const ghobject_t& oid); | |
52 | static delta_t shift_left(unsigned n); | |
53 | static delta_t trim_right(unsigned n); | |
54 | static delta_t insert_front(ceph::buffer::ptr keys, | |
55 | ceph::buffer::ptr cells); | |
56 | static delta_t insert_back(ceph::buffer::ptr keys, | |
57 | ceph::buffer::ptr cells); | |
58 | static delta_t remove_from(unsigned slot); | |
59 | ||
60 | // shortcuts | |
61 | static delta_t insert_item(unsigned slot, const ghobject_t& oid, OnodeRef onode) { | |
62 | return insert_onode(slot, oid, onode); | |
63 | } | |
64 | static delta_t insert_item(unsigned slot, const ghobject_t& oid, crimson::os::seastore::laddr_t addr) { | |
65 | return insert_child(slot, oid, addr); | |
66 | } | |
67 | ||
68 | void encode(ceph::bufferlist& bl); | |
69 | void decode(ceph::bufferlist::const_iterator& p); | |
70 | }; |