summaryrefslogtreecommitdiffstats
path: root/src/messages/MOSDPGReadyToMerge.h
blob: e75212638535ff42bccec0be08a8f419bad4b5c8 (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
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#pragma once

class MOSDPGReadyToMerge : public PaxosServiceMessage {
public:
  pg_t pgid;
  eversion_t source_version, target_version;
  epoch_t last_epoch_started = 0;
  epoch_t last_epoch_clean = 0;
  bool ready = true;

  MOSDPGReadyToMerge()
    : PaxosServiceMessage{MSG_OSD_PG_READY_TO_MERGE, 0}
  {}
  MOSDPGReadyToMerge(pg_t p, eversion_t sv, eversion_t tv,
		     epoch_t les, epoch_t lec, bool r, epoch_t v)
    : PaxosServiceMessage{MSG_OSD_PG_READY_TO_MERGE, v},
      pgid(p),
      source_version(sv),
      target_version(tv),
      last_epoch_started(les),
      last_epoch_clean(lec),
      ready(r)
  {}
  void encode_payload(uint64_t features) override {
    using ceph::encode;
    paxos_encode();
    encode(pgid, payload);
    encode(source_version, payload);
    encode(target_version, payload);
    encode(last_epoch_started, payload);
    encode(last_epoch_clean, payload);
    encode(ready, payload);
  }
  void decode_payload() override {
    using ceph::decode;
    auto p = payload.cbegin();
    paxos_decode(p);
    decode(pgid, p);
    decode(source_version, p);
    decode(target_version, p);
    decode(last_epoch_started, p);
    decode(last_epoch_clean, p);
    decode(ready, p);
  }
  std::string_view get_type_name() const override { return "osd_pg_ready_to_merge"; }
  void print(std::ostream &out) const {
    out << get_type_name()
        << "(" << pgid
	<< " sv " << source_version
	<< " tv " << target_version
	<< " les/c " << last_epoch_started << "/" << last_epoch_clean
	<< (ready ? " ready" : " NOT READY")
        << " v" << version << ")";
  }
private:
  template<class T, typename... Args>
  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
};