summaryrefslogtreecommitdiffstats
path: root/src/common/json/OSDStructures.cc
blob: aaac5f6e16938ab98174141ea8dc94a34b7f26f8 (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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#include "OSDStructures.h"

#include "common/ceph_json.h"
#include "common/io_exerciser/OpType.h"

using namespace ceph::messaging::osd;

void OSDMapRequest::dump(Formatter* f) const {
  encode_json("prefix", "osd map", f);
  encode_json("pool", pool, f);
  encode_json("object", object, f);
  encode_json("nspace", nspace, f);
  encode_json("format", format, f);
}

void OSDMapRequest::decode_json(JSONObj* obj) {
  JSONDecoder::decode_json("pool", pool, obj);
  JSONDecoder::decode_json("object", object, obj);
  JSONDecoder::decode_json("nspace", nspace, obj);
  JSONDecoder::decode_json("format", format, obj);
}

void OSDMapReply::dump(Formatter* f) const {
  encode_json("epoch", epoch, f);
  encode_json("pool", pool, f);
  encode_json("pool_id", pool_id, f);
  encode_json("objname", objname, f);
  encode_json("raw_pgid", raw_pgid, f);
  encode_json("pgid", pgid, f);
  encode_json("up", up, f);
  encode_json("up_primary", up_primary, f);
  encode_json("acting", acting, f);
  encode_json("acting_primary", acting_primary, f);
}

void OSDMapReply::decode_json(JSONObj* obj) {
  JSONDecoder::decode_json("epoch", epoch, obj);
  JSONDecoder::decode_json("pool", pool, obj);
  JSONDecoder::decode_json("pool_id", pool_id, obj);
  JSONDecoder::decode_json("objname", objname, obj);
  JSONDecoder::decode_json("raw_pgid", raw_pgid, obj);
  JSONDecoder::decode_json("pgid", pgid, obj);
  JSONDecoder::decode_json("up", up, obj);
  JSONDecoder::decode_json("up_primary", up_primary, obj);
  JSONDecoder::decode_json("acting", acting, obj);
  JSONDecoder::decode_json("acting_primary", acting_primary, obj);
}

void OSDPoolGetRequest::dump(Formatter* f) const {
  encode_json("prefix", "osd pool get", f);
  encode_json("pool", pool, f);
  encode_json("var", var, f);
  encode_json("format", format, f);
}

void OSDPoolGetRequest::decode_json(JSONObj* obj) {
  JSONDecoder::decode_json("pool", pool, obj);
  JSONDecoder::decode_json("var", var, obj);
  JSONDecoder::decode_json("format", format, obj);
}

void OSDPoolGetReply::dump(Formatter* f) const {
  encode_json("erasure_code_profile", erasure_code_profile, f);
}

void OSDPoolGetReply::decode_json(JSONObj* obj) {
  JSONDecoder::decode_json("erasure_code_profile", erasure_code_profile, obj);
}

void OSDECProfileGetRequest::dump(Formatter* f) const {
  encode_json("prefix", "osd pool get", f);
  encode_json("name", name, f);
  encode_json("format", format, f);
}

void OSDECProfileGetRequest::decode_json(JSONObj* obj) {
  JSONDecoder::decode_json("name", name, obj);
  JSONDecoder::decode_json("format", format, obj);
}

void OSDECProfileGetReply::dump(Formatter* f) const {
  encode_json("crush-device-class", crush_device_class, f);
  encode_json("crush-failure-domain", crush_failure_domain, f);
  encode_json("crush-num-failure-domains", crush_num_failure_domains, f);
  encode_json("crush-osds-per-failure-domain", crush_osds_per_failure_domain,
              f);
  encode_json("crush-root", crush_root, f);
  encode_json("jerasure-per-chunk-alignment", jerasure_per_chunk_alignment, f);
  encode_json("k", k, f);
  encode_json("m", m, f);
  encode_json("plugin", plugin, f);
  encode_json("technique", technique, f);
  encode_json("w", w, f);
}

void OSDECProfileGetReply::decode_json(JSONObj* obj) {
  JSONDecoder::decode_json("crush-device-class", crush_device_class, obj);
  JSONDecoder::decode_json("crush-failure-domain", crush_failure_domain, obj);
  JSONDecoder::decode_json("crush-num-failure-domains",
                           crush_num_failure_domains, obj);
  JSONDecoder::decode_json("crush-osds-per-failure-domain",
                           crush_osds_per_failure_domain, obj);
  JSONDecoder::decode_json("crush-root", crush_root, obj);
  JSONDecoder::decode_json("jerasure-per-chunk-alignment",
                           jerasure_per_chunk_alignment, obj);
  JSONDecoder::decode_json("k", k, obj);
  JSONDecoder::decode_json("m", m, obj);
  JSONDecoder::decode_json("plugin", plugin, obj);
  JSONDecoder::decode_json("technique", technique, obj);
  JSONDecoder::decode_json("w", w, obj);
}

void OSDECProfileSetRequest::dump(Formatter* f) const {
  encode_json("prefix", "osd erasure-code-profile set", f);
  encode_json("name", name, f);
  encode_json("profile", profile, f);
}

void OSDECProfileSetRequest::decode_json(JSONObj* obj) {
  JSONDecoder::decode_json("name", name, obj);
  JSONDecoder::decode_json("profile", profile, obj);
}

void OSDECPoolCreateRequest::dump(Formatter* f) const {
  encode_json("prefix", "osd pool create", f);
  encode_json("pool", pool, f);
  encode_json("pool_type", pool_type, f);
  encode_json("pg_num", pg_num, f);
  encode_json("pgp_num", pgp_num, f);
  encode_json("erasure_code_profile", erasure_code_profile, f);
}

void OSDECPoolCreateRequest::decode_json(JSONObj* obj) {
  JSONDecoder::decode_json("pool", pool, obj);
  JSONDecoder::decode_json("pool_type", pool_type, obj);
  JSONDecoder::decode_json("pg_num", pg_num, obj);
  JSONDecoder::decode_json("pgp_num", pgp_num, obj);
  JSONDecoder::decode_json("erasure_code_profile", erasure_code_profile, obj);
}

void OSDSetRequest::dump(Formatter* f) const {
  encode_json("prefix", "osd set", f);
  encode_json("key", key, f);
  encode_json("yes_i_really_mean_it", yes_i_really_mean_it, f);
}

void OSDSetRequest::decode_json(JSONObj* obj) {
  JSONDecoder::decode_json("key", key, obj);
  JSONDecoder::decode_json("yes_i_really_mean_it", yes_i_really_mean_it, obj);
}