for three reasons:
* we don't encode binary KeyRing since v0.48: the binary encoder for
KeyRing was dropped in
eaea7aa9b28849be612b22ce84971db671319806,
which was included since v0.48 (argonaut). and we don't encode
KeyRing in binary manually elsewhere since then.
* we should not use exception in the normal code path. in C++,
exception is not designed to be efficient or semantically a
language facility to be part of the normal code path. so, from
the readability perspective, we should not use exception here.
as all encoded KeyRings are in plaintext.
* simpler this way.
Signed-off-by: Kefu Chai <kchai@redhat.com>
}
}
-void KeyRing::decode(bufferlist::const_iterator& bl) {
- __u8 struct_v;
+void KeyRing::decode(bufferlist::const_iterator& bl)
+{
auto start_pos = bl;
- try {
- using ceph::decode;
- decode(struct_v, bl);
- decode(keys, bl);
- } catch (ceph::buffer::error& err) {
- keys.clear();
- decode_plaintext(start_pos);
- }
+ decode_plaintext(start_pos);
}
int KeyRing::load(CephContext *cct, const std::string &filename)