MCPcopy Create free account
hub / github.com/ceph/ceph / encode_payload

Method encode_payload

src/messages/MOSDMap.h:102–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100 }
101 }
102 void encode_payload(uint64_t features) override {
103 using ceph::encode;
104 header.version = HEAD_VERSION;
105 header.compat_version = COMPAT_VERSION;
106 encode(fsid, payload);
107 if (OSDMap::get_significant_features(encode_features) !=
108 OSDMap::get_significant_features(features)) {
109 if ((features & CEPH_FEATURE_PGID64) == 0 ||
110 (features & CEPH_FEATURE_PGPOOL3) == 0) {
111 header.version = 1; // old old_client version
112 header.compat_version = 1;
113 } else if ((features & CEPH_FEATURE_OSDENC) == 0) {
114 header.version = 2; // old pg_pool_t
115 header.compat_version = 2;
116 }
117
118 // reencode maps using old format
119 //
120 // FIXME: this can probably be done more efficiently higher up
121 // the stack, or maybe replaced with something that only
122 // includes the pools the client cares about.
123 for (auto p = incremental_maps.begin(); p != incremental_maps.end(); ++p) {
124 OSDMap::Incremental inc;
125 auto q = p->second.cbegin();
126 inc.decode(q);
127 // always encode with subset of osdmaps canonical features
128 uint64_t f = inc.encode_features & features;
129 p->second.clear();
130 if (inc.fullmap.length()) {
131 // embedded full std::map?
132 OSDMap m;
133 m.decode(inc.fullmap);
134 inc.fullmap.clear();
135 m.encode(inc.fullmap, f | CEPH_FEATURE_RESERVED);
136 }
137 if (inc.crush.length()) {
138 // embedded crush std::map
139 CrushWrapper c;
140 auto p = inc.crush.cbegin();
141 c.decode(p);
142 inc.crush.clear();
143 c.encode(inc.crush, f);
144 }
145 inc.encode(p->second, f | CEPH_FEATURE_RESERVED);
146 }
147 for (auto p = maps.begin(); p != maps.end(); ++p) {
148 OSDMap m;
149 m.decode(p->second);
150 // always encode with subset of osdmaps canonical features
151 uint64_t f = m.get_encoding_features() & features;
152 p->second.clear();
153 m.encode(p->second, f | CEPH_FEATURE_RESERVED);
154 }
155 }
156 encode(incremental_maps, payload);
157 encode(maps, payload);
158 if (header.version >= 2) {
159 encode(cluster_osdmap_trim_lower_bound, payload);

Callers

nothing calls this directly

Calls 9

get_encoding_featuresMethod · 0.80
encodeFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
cbeginMethod · 0.45
decodeMethod · 0.45
clearMethod · 0.45
lengthMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected