for (auto &sync_point : sync_points) {
sync_point.encode(bl);
}
+ ::encode(snap_seqs, bl);
}
void MirrorPeerClientMeta::decode(__u8 version, bufferlist::iterator& it) {
for (auto &sync_point : sync_points) {
sync_point.decode(version, it);
}
+
+ ::decode(snap_seqs, it);
}
void MirrorPeerClientMeta::dump(Formatter *f) const {
f->dump_string("image_id", image_id);
f->open_array_section("sync_points");
for (auto &sync_point : sync_points) {
+ f->open_object_section("sync_point");
sync_point.dump(f);
+ f->close_section();
+ }
+ f->close_section();
+ f->open_array_section("snap_seqs");
+ for (auto &pair : snap_seqs) {
+ f->open_object_section("snap_seq");
+ f->dump_unsigned("local_snap_seq", pair.first);
+ f->dump_unsigned("peer_snap_seq", pair.second);
+ f->close_section();
}
f->close_section();
}
o.push_back(new ClientData(ImageClientMeta()));
o.push_back(new ClientData(ImageClientMeta(123)));
o.push_back(new ClientData(MirrorPeerClientMeta()));
- o.push_back(new ClientData(MirrorPeerClientMeta("image_id", {{"snap 1", 123}})));
+ o.push_back(new ClientData(MirrorPeerClientMeta("image_id", {{"snap 1", 123}},
+ {{1, 2}, {3, 4}})));
o.push_back(new ClientData(CliClientMeta()));
}
struct MirrorPeerClientMeta {
typedef std::list<MirrorPeerSyncPoint> SyncPoints;
+ typedef std::map<uint64_t, uint64_t> SnapSeqs;
static const ClientMetaType TYPE = MIRROR_PEER_CLIENT_META_TYPE;
std::string image_id;
- SyncPoints sync_points;
+ SyncPoints sync_points; ///< max two in-use snapshots for sync
+ SnapSeqs snap_seqs; ///< local to peer snap seq mapping
MirrorPeerClientMeta() {
}
MirrorPeerClientMeta(const std::string &image_id,
- const SyncPoints &sync_points = SyncPoints())
- : image_id(image_id), sync_points(sync_points) {
+ const SyncPoints &sync_points = SyncPoints(),
+ const SnapSeqs &snap_seqs = SnapSeqs())
+ : image_id(image_id), sync_points(sync_points), snap_seqs(snap_seqs) {
}
void encode(bufferlist& bl) const;