mirror of
https://github.com/ceph/ceph
synced 2025-02-23 19:17:37 +00:00
rbd-mirror: include map timestamp in image map
Signed-off-by: Venky Shankar <vshankar@redhat.com>
This commit is contained in:
parent
f3b2eb9d2d
commit
c3ae008994
@ -482,6 +482,7 @@ void TrashImageSpec::dump(Formatter *f) const {
|
||||
void MirrorImageMap::encode(bufferlist &bl) const {
|
||||
ENCODE_START(1, 1, bl);
|
||||
::encode(instance_id, bl);
|
||||
::encode(mapped_time, bl);
|
||||
::encode(data, bl);
|
||||
ENCODE_FINISH(bl);
|
||||
}
|
||||
@ -489,12 +490,14 @@ void MirrorImageMap::encode(bufferlist &bl) const {
|
||||
void MirrorImageMap::decode(bufferlist::iterator &it) {
|
||||
DECODE_START(1, it);
|
||||
::decode(instance_id, it);
|
||||
::decode(mapped_time, it);
|
||||
::decode(data, it);
|
||||
DECODE_FINISH(it);
|
||||
}
|
||||
|
||||
void MirrorImageMap::dump(Formatter *f) const {
|
||||
f->dump_string("instance_id", instance_id);
|
||||
f->dump_stream("mapped_time") << mapped_time;
|
||||
|
||||
std::stringstream data_ss;
|
||||
data.hexdump(data_ss);
|
||||
@ -506,22 +509,24 @@ void MirrorImageMap::generate_test_instances(
|
||||
bufferlist data;
|
||||
data.append(std::string(128, '1'));
|
||||
|
||||
o.push_back(new MirrorImageMap("uuid-123", data));
|
||||
o.push_back(new MirrorImageMap("uuid-abc", data));
|
||||
o.push_back(new MirrorImageMap("uuid-123", utime_t(), data));
|
||||
o.push_back(new MirrorImageMap("uuid-abc", utime_t(), data));
|
||||
}
|
||||
|
||||
bool MirrorImageMap::operator==(const MirrorImageMap &rhs) const {
|
||||
return instance_id == rhs.instance_id && data.contents_equal(data);
|
||||
return instance_id == rhs.instance_id && mapped_time == rhs.mapped_time &&
|
||||
data.contents_equal(rhs.data);
|
||||
}
|
||||
|
||||
bool MirrorImageMap::operator<(const MirrorImageMap &rhs) const {
|
||||
return instance_id < rhs.instance_id;
|
||||
return instance_id < rhs.instance_id ||
|
||||
(instance_id == rhs.instance_id && mapped_time < rhs.mapped_time);
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& os,
|
||||
const MirrorImageMap &image_map) {
|
||||
return os << "["
|
||||
<< "instance_id=" << image_map.instance_id << "]";
|
||||
return os << "[" << "instance_id=" << image_map.instance_id << ", mapped_time="
|
||||
<< image_map.mapped_time << "]";
|
||||
}
|
||||
|
||||
} // namespace rbd
|
||||
|
@ -368,13 +368,15 @@ struct MirrorImageMap {
|
||||
MirrorImageMap() {
|
||||
}
|
||||
|
||||
MirrorImageMap(const std::string &instance_id,
|
||||
MirrorImageMap(const std::string &instance_id, utime_t mapped_time,
|
||||
const bufferlist &data)
|
||||
: instance_id(instance_id),
|
||||
mapped_time(mapped_time),
|
||||
data(data) {
|
||||
}
|
||||
|
||||
std::string instance_id;
|
||||
utime_t mapped_time;
|
||||
bufferlist data;
|
||||
|
||||
void encode(bufferlist &bl) const;
|
||||
|
Loading…
Reference in New Issue
Block a user