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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:nil -*-
// vim: ts=8 sw=2 smarttab
#pragma once
#include <cstdint>
#include "common/hobject.h"
#include "include/buffer_fwd.h"
#include "crimson/os/seastore/onode.h"
#include "crimson/os/seastore/seastore_types.h"
using crimson::os::seastore::OnodeRef;
struct delta_t {
enum class op_t : uint8_t {
nop,
insert_onode,
update_onode,
insert_child,
update_key,
shift_left,
trim_right,
insert_front,
insert_back,
remove_from,
// finer grained op?
// - changing the embedded extent map of given oid
// - mutating the embedded xattrs of given oid
} op = op_t::nop;
unsigned n = 0;
ghobject_t oid;
crimson::os::seastore::laddr_t addr = 0;
OnodeRef onode;
ceph::bufferptr keys;
ceph::bufferptr cells;
delta_t() = default;
delta_t(op_t op)
: op{op}
{}
delta_t(delta_t&& delta);
delta_t& operator=(delta_t&& delta);
static delta_t nop();
static delta_t insert_onode(unsigned slot, const ghobject_t& oid, OnodeRef onode);
static delta_t update_onode(unsigned slot, const ghobject_t& oid, OnodeRef onode);
static delta_t insert_child(unsigned slot, const ghobject_t& oid, crimson::os::seastore::laddr_t addr);
static delta_t update_key(unsigned slot, const ghobject_t& oid);
static delta_t shift_left(unsigned n);
static delta_t trim_right(unsigned n);
static delta_t insert_front(ceph::buffer::ptr keys,
ceph::buffer::ptr cells);
static delta_t insert_back(ceph::buffer::ptr keys,
ceph::buffer::ptr cells);
static delta_t remove_from(unsigned slot);
// shortcuts
static delta_t insert_item(unsigned slot, const ghobject_t& oid, OnodeRef onode) {
return insert_onode(slot, oid, onode);
}
static delta_t insert_item(unsigned slot, const ghobject_t& oid, crimson::os::seastore::laddr_t addr) {
return insert_child(slot, oid, addr);
}
void encode(ceph::bufferlist& bl);
void decode(ceph::bufferlist::const_iterator& p);
};
|