1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
15 #ifndef CEPH_MOSDBOOT_H
16 #define CEPH_MOSDBOOT_H
18 #include "messages/PaxosServiceMessage.h"
20 #include "include/types.h"
21 #include "osd/osd_types.h"
23 class MOSDBoot : public PaxosServiceMessage {
25 static const int HEAD_VERSION = 6;
26 static const int COMPAT_VERSION = 6;
30 entity_addr_t hb_back_addr, hb_front_addr;
31 entity_addr_t cluster_addr;
32 epoch_t boot_epoch; // last epoch this daemon was added to the map (if any)
33 map<string,string> metadata; ///< misc metadata about this osd
34 uint64_t osd_features;
37 : PaxosServiceMessage(MSG_OSD_BOOT, 0, HEAD_VERSION, COMPAT_VERSION),
38 boot_epoch(0), osd_features(0)
40 MOSDBoot(OSDSuperblock& s, epoch_t e, epoch_t be,
41 const entity_addr_t& hb_back_addr_ref,
42 const entity_addr_t& hb_front_addr_ref,
43 const entity_addr_t& cluster_addr_ref,
45 : PaxosServiceMessage(MSG_OSD_BOOT, e, HEAD_VERSION, COMPAT_VERSION),
47 hb_back_addr(hb_back_addr_ref),
48 hb_front_addr(hb_front_addr_ref),
49 cluster_addr(cluster_addr_ref),
55 ~MOSDBoot() override { }
58 const char *get_type_name() const override { return "osd_boot"; }
59 void print(ostream& out) const override {
60 out << "osd_boot(osd." << sb.whoami << " booted " << boot_epoch
61 << " features " << osd_features
62 << " v" << version << ")";
65 void encode_payload(uint64_t features) override {
67 ::encode(sb, payload);
68 ::encode(hb_back_addr, payload, features);
69 ::encode(cluster_addr, payload, features);
70 ::encode(boot_epoch, payload);
71 ::encode(hb_front_addr, payload, features);
72 ::encode(metadata, payload);
73 ::encode(osd_features, payload);
75 void decode_payload() override {
76 bufferlist::iterator p = payload.begin();
79 ::decode(hb_back_addr, p);
80 ::decode(cluster_addr, p);
81 ::decode(boot_epoch, p);
82 ::decode(hb_front_addr, p);
83 ::decode(metadata, p);
84 ::decode(osd_features, p);