class MNVMeofGwBeacon final : public PaxosServiceMessage {
private:
+ static constexpr int HEAD_VERSION = BEACON_VERSION_ENHANCED;
+ static constexpr int COMPAT_VERSION = BEACON_VERSION_LEGACY;
protected:
std::string gw_id;
public:
MNVMeofGwBeacon()
- : PaxosServiceMessage{MSG_MNVMEOF_GW_BEACON, 0, BEACON_VERSION_ENHANCED,
- BEACON_VERSION_LEGACY}, sequence(0)
+ : PaxosServiceMessage{MSG_MNVMEOF_GW_BEACON, 0, HEAD_VERSION,
+ COMPAT_VERSION}, sequence(0)
{
set_priority(CEPH_MSG_PRIO_HIGH);
}
bool enable_diff = false) // default to legacy behavior for backward compatibility
: PaxosServiceMessage{MSG_MNVMEOF_GW_BEACON,
0,
- enable_diff ? BEACON_VERSION_ENHANCED :
- BEACON_VERSION_LEGACY, BEACON_VERSION_LEGACY},// Minimum compatible version
+ enable_diff ? HEAD_VERSION : COMPAT_VERSION,
+ COMPAT_VERSION},
gw_id(gw_id_), gw_pool(gw_pool_), gw_group(gw_group_), subsystems(subsystems_),
availability(availability_), last_osd_epoch(last_osd_epoch_),
last_gwmap_epoch(last_gwmap_epoch_), sequence(sequence_)
encode((uint32_t)availability, payload);
encode(last_osd_epoch, payload);
encode(last_gwmap_epoch, payload);
- // Only encode sequence for enhanced beacons (HEAD_VERSION >= 2)
- if (get_header().version >= BEACON_VERSION_ENHANCED) {
+ // Only encode sequence for enhanced beacons (version >= HEAD_VERSION)
+ if (get_header().version >= HEAD_VERSION) {
encode(sequence, payload);
}
}
availability = static_cast<gw_availability_t>(tmp);
decode(last_osd_epoch, p);
decode(last_gwmap_epoch, p);
- // Only decode sequence for enhanced beacons (HEAD_VERSION >= 2)
- if (get_header().version >= BEACON_VERSION_ENHANCED && !p.end()) {
+ // Only decode sequence for enhanced beacons (version >= HEAD_VERSION)
+ if (get_header().version >= HEAD_VERSION && !p.end()) {
decode(sequence, p);
} else {
sequence = 0; // Legacy beacons don't have sequence field