Search is not available for this dataset
repo
stringlengths
2
152
file
stringlengths
15
239
code
stringlengths
0
58.4M
file_length
int64
0
58.4M
avg_line_length
float64
0
1.81M
max_line_length
int64
0
12.7M
extension_type
stringclasses
364 values
null
ceph-main/src/messages/MMDSScrub.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMDSSCRUB_H #define CEPH_MMDSSCRUB_H #include "messages/MMDSOp.h" #include "include/types.h" #include "include/frag.h" class MMDSScrub : public MMDSOp { public: static constexpr int OP_QUEUEDIR = 1; static constexpr int OP_QUEUEDIR_ACK = -1; static constexpr int OP_QUEUEINO = 2; static constexpr int OP_QUEUEINO_ACK = -2; static constexpr int OP_ABORT = 3; static constexpr int OP_PAUSE = 4; static constexpr int OP_RESUME = 5; static const char *get_opname(int o) { switch (o) { case OP_QUEUEDIR: return "queue_dir"; case OP_QUEUEDIR_ACK: return "queue_dir_ack"; case OP_QUEUEINO: return "queue_ino"; case OP_QUEUEINO_ACK: return "queue_ino_ack"; case OP_ABORT: return "abort"; case OP_PAUSE: return "pause"; case OP_RESUME: return "resume"; default: ceph_abort(); return nullptr; } } std::string_view get_type_name() const override { return "mds_scrub"; } void print(std::ostream& out) const override { out << "mds_scrub(" << get_opname(op) << " " << ino << " " << frags << " " << tag; if (is_force()) out << " force"; if (is_recursive()) out << " recursive"; if (is_repair()) out << " repair"; out << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; encode(op, payload); encode(ino, payload); encode(frags, payload); encode(tag, payload); encode(origin, payload); encode(flags, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(op, p); decode(ino, p); decode(frags, p); decode(tag, p); decode(origin, p); decode(flags, p); } inodeno_t get_ino() const { return ino; } const fragset_t& get_frags() const { return frags; } const std::string& get_tag() const { return tag; } inodeno_t get_origin() const { return origin; } int get_op() const { return op; } bool is_internal_tag() const { return flags & FLAG_INTERNAL_TAG; } bool is_force() const { return flags & FLAG_FORCE; } bool is_recursive() const { return flags & FLAG_RECURSIVE; } bool is_repair() const { return flags & FLAG_REPAIR; } protected: static constexpr int HEAD_VERSION = 1; static constexpr int COMPAT_VERSION = 1; MMDSScrub() : MMDSOp(MSG_MDS_SCRUB, HEAD_VERSION, COMPAT_VERSION) {} MMDSScrub(int o) : MMDSOp(MSG_MDS_SCRUB, HEAD_VERSION, COMPAT_VERSION), op(o) {} MMDSScrub(int o, inodeno_t i, fragset_t&& _frags, std::string_view _tag, inodeno_t _origin=inodeno_t(), bool internal_tag=false, bool force=false, bool recursive=false, bool repair=false) : MMDSOp(MSG_MDS_SCRUB, HEAD_VERSION, COMPAT_VERSION), op(o), ino(i), frags(std::move(_frags)), tag(_tag), origin(_origin) { if (internal_tag) flags |= FLAG_INTERNAL_TAG; if (force) flags |= FLAG_FORCE; if (recursive) flags |= FLAG_RECURSIVE; if (repair) flags |= FLAG_REPAIR; } ~MMDSScrub() override {} private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); template<class T, typename... Args> friend MURef<T> crimson::make_message(Args&&... args); static constexpr unsigned FLAG_INTERNAL_TAG = 1<<0; static constexpr unsigned FLAG_FORCE = 1<<1; static constexpr unsigned FLAG_RECURSIVE = 1<<2; static constexpr unsigned FLAG_REPAIR = 1<<3; int op; inodeno_t ino; fragset_t frags; std::string tag; inodeno_t origin; unsigned flags = 0; }; #endif // CEPH_MMDSSCRUB_H
3,983
27.255319
74
h
null
ceph-main/src/messages/MMDSScrubStats.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMDSSCRUBSTATS_H #define CEPH_MMDSSCRUBSTATS_H #include "messages/MMDSOp.h" class MMDSScrubStats : public MMDSOp { static constexpr int HEAD_VERSION = 1; static constexpr int COMPAT_VERSION = 1; public: std::string_view get_type_name() const override { return "mds_scrub_stats"; } void print(std::ostream& o) const override { o << "mds_scrub_stats(e" << epoch; if (update_scrubbing) o << " [" << scrubbing_tags << "]"; if (aborting) o << " aborting"; o << ")"; } unsigned get_epoch() const { return epoch; } const auto& get_scrubbing_tags() const { return scrubbing_tags; } bool is_aborting() const { return aborting; } bool is_finished(const std::string& tag) const { return update_scrubbing && !scrubbing_tags.count(tag); } void encode_payload(uint64_t features) override { using ceph::encode; encode(epoch, payload); encode(scrubbing_tags, payload); encode(update_scrubbing, payload); encode(aborting, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(epoch, p); decode(scrubbing_tags, p); decode(update_scrubbing, p); decode(aborting, p); } protected: MMDSScrubStats(unsigned e=0) : MMDSOp(MSG_MDS_SCRUB_STATS, HEAD_VERSION, COMPAT_VERSION), epoch(e) {} MMDSScrubStats(unsigned e, std::set<std::string>&& tags, bool abrt=false) : MMDSOp(MSG_MDS_SCRUB_STATS, HEAD_VERSION, COMPAT_VERSION), epoch(e), scrubbing_tags(std::move(tags)), update_scrubbing(true), aborting(abrt) {} MMDSScrubStats(unsigned e, const std::set<std::string>& tags, bool abrt=false) : MMDSOp(MSG_MDS_SCRUB_STATS, HEAD_VERSION, COMPAT_VERSION), epoch(e), scrubbing_tags(tags), update_scrubbing(true), aborting(abrt) {} ~MMDSScrubStats() override {} private: unsigned epoch; std::set<std::string> scrubbing_tags; bool update_scrubbing = false; bool aborting = false; template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); template<class T, typename... Args> friend MURef<T> crimson::make_message(Args&&... args); }; #endif
2,592
30.240964
88
h
null
ceph-main/src/messages/MMDSSnapUpdate.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMDSSNAPUPDATE_H #define CEPH_MMDSSNAPUPDATE_H #include "messages/MMDSOp.h" class MMDSSnapUpdate final : public MMDSOp { private: inodeno_t ino; __s16 snap_op; public: inodeno_t get_ino() const { return ino; } int get_snap_op() const { return snap_op; } ceph::buffer::list snap_blob; protected: MMDSSnapUpdate() : MMDSOp{MSG_MDS_SNAPUPDATE} {} MMDSSnapUpdate(inodeno_t i, version_t tid, int op) : MMDSOp{MSG_MDS_SNAPUPDATE}, ino(i), snap_op(op) { set_tid(tid); } ~MMDSSnapUpdate() final {} public: std::string_view get_type_name() const override { return "snap_update"; } void print(std::ostream& o) const override { o << "snap_update(" << ino << " table_tid " << get_tid() << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; encode(ino, payload); encode(snap_op, payload); encode(snap_blob, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(ino, p); decode(snap_op, p); decode(snap_blob, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); template<class T, typename... Args> friend MURef<T> crimson::make_message(Args&&... args); }; #endif
1,724
25.136364
75
h
null
ceph-main/src/messages/MMDSTableRequest.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMDSTABLEREQUEST_H #define CEPH_MMDSTABLEREQUEST_H #include "mds/mds_table_types.h" #include "messages/MMDSOp.h" class MMDSTableRequest final : public MMDSOp { public: __u16 table = 0; __s16 op = 0; uint64_t reqid = 0; ceph::buffer::list bl; protected: MMDSTableRequest() : MMDSOp{MSG_MDS_TABLE_REQUEST} {} MMDSTableRequest(int tab, int o, uint64_t r, version_t v=0) : MMDSOp{MSG_MDS_TABLE_REQUEST}, table(tab), op(o), reqid(r) { set_tid(v); } ~MMDSTableRequest() final {} public: std::string_view get_type_name() const override { return "mds_table_request"; } void print(std::ostream& o) const override { o << "mds_table_request(" << get_mdstable_name(table) << " " << get_mdstableserver_opname(op); if (reqid) o << " " << reqid; if (get_tid()) o << " tid " << get_tid(); if (bl.length()) o << " " << bl.length() << " bytes"; o << ")"; } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(table, p); decode(op, p); decode(reqid, p); decode(bl, p); } void encode_payload(uint64_t features) override { using ceph::encode; encode(table, payload); encode(op, payload); encode(reqid, payload); encode(bl, payload); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); template<class T, typename... Args> friend MURef<T> crimson::make_message(Args&&... args); }; #endif
1,933
25.493151
81
h
null
ceph-main/src/messages/MMgrBeacon.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMGRBEACON_H #define CEPH_MMGRBEACON_H #include "messages/PaxosServiceMessage.h" #include "mon/MonCommand.h" #include "mon/MgrMap.h" #include "include/types.h" class MMgrBeacon final : public PaxosServiceMessage { private: static constexpr int HEAD_VERSION = 11; static constexpr int COMPAT_VERSION = 8; protected: uint64_t gid; entity_addrvec_t server_addrs; bool available; std::string name; uuid_d fsid; // From active daemon to populate MgrMap::services std::map<std::string, std::string> services; // Only populated during activation std::vector<MonCommand> command_descs; // Information about the modules found locally on this daemon std::vector<MgrMap::ModuleInfo> modules; std::map<std::string,std::string> metadata; ///< misc metadata about this osd std::multimap<std::string, entity_addrvec_t> clients; uint64_t mgr_features = 0; ///< reporting mgr's features public: MMgrBeacon() : PaxosServiceMessage{MSG_MGR_BEACON, 0, HEAD_VERSION, COMPAT_VERSION}, gid(0), available(false) {} MMgrBeacon(const uuid_d& fsid_, uint64_t gid_, const std::string &name_, entity_addrvec_t server_addrs_, bool available_, std::vector<MgrMap::ModuleInfo>&& modules_, std::map<std::string,std::string>&& metadata_, std::multimap<std::string, entity_addrvec_t>&& clients_, uint64_t feat) : PaxosServiceMessage{MSG_MGR_BEACON, 0, HEAD_VERSION, COMPAT_VERSION}, gid(gid_), server_addrs(server_addrs_), available(available_), name(name_), fsid(fsid_), modules(std::move(modules_)), metadata(std::move(metadata_)), clients(std::move(clients_)), mgr_features(feat) { } uint64_t get_gid() const { return gid; } entity_addrvec_t get_server_addrs() const { return server_addrs; } bool get_available() const { return available; } const std::string& get_name() const { return name; } const uuid_d& get_fsid() const { return fsid; } const std::map<std::string,std::string>& get_metadata() const { return metadata; } const std::map<std::string,std::string>& get_services() const { return services; } uint64_t get_mgr_features() const { return mgr_features; } void set_services(const std::map<std::string, std::string> &svcs) { services = svcs; } void set_command_descs(const std::vector<MonCommand> &cmds) { command_descs = cmds; } const std::vector<MonCommand> &get_command_descs() { return command_descs; } const std::vector<MgrMap::ModuleInfo> &get_available_modules() const { return modules; } const auto& get_clients() const { return clients; } private: ~MMgrBeacon() final {} public: std::string_view get_type_name() const override { return "mgrbeacon"; } void print(std::ostream& out) const override { out << get_type_name() << " mgr." << name << "(" << fsid << "," << gid << ", " << server_addrs << ", " << available << ")"; } void encode_payload(uint64_t features) override { header.version = HEAD_VERSION; header.compat_version = COMPAT_VERSION; using ceph::encode; paxos_encode(); assert(HAVE_FEATURE(features, SERVER_NAUTILUS)); encode(server_addrs, payload, features); encode(gid, payload); encode(available, payload); encode(name, payload); encode(fsid, payload); // Fill out old-style list of module names (deprecated by // later field of full ModuleInfos) std::set<std::string> module_names; for (const auto &info : modules) { module_names.insert(info.name); } encode(module_names, payload); encode(command_descs, payload); encode(metadata, payload); encode(services, payload); encode(modules, payload); encode(mgr_features, payload); std::vector<std::string> clients_names; std::vector<entity_addrvec_t> clients_addrs; for (const auto& i : clients) { clients_names.push_back(i.first); clients_addrs.push_back(i.second); } // The address vector needs to be encoded first to produce a // backwards compatible messsage for older monitors. encode(clients_addrs, payload, features); encode(clients_names, payload, features); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); assert(header.version >= 8); decode(server_addrs, p); // entity_addr_t for version < 8 decode(gid, p); decode(available, p); decode(name, p); decode(fsid, p); std::set<std::string> module_name_list; decode(module_name_list, p); decode(command_descs, p); decode(metadata, p); decode(services, p); decode(modules, p); if (header.version >= 9) { decode(mgr_features, p); } if (header.version >= 10) { std::vector<entity_addrvec_t> clients_addrs; decode(clients_addrs, p); clients.clear(); if (header.version >= 11) { std::vector<std::string> clients_names; decode(clients_names, p); if (clients_names.size() != clients_addrs.size()) { throw ceph::buffer::malformed_input( "clients_names.size() != clients_addrs.size()"); } auto cn = clients_names.begin(); auto ca = clients_addrs.begin(); for(; cn != clients_names.end(); ++cn, ++ca) { clients.emplace(*cn, *ca); } } else { for (const auto& i : clients_addrs) { clients.emplace("", i); } } } } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
5,955
27.227488
81
h
null
ceph-main/src/messages/MMgrClose.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #pragma once #include "msg/Message.h" class MMgrClose : public Message { private: static constexpr int HEAD_VERSION = 1; static constexpr int COMPAT_VERSION = 1; public: std::string daemon_name; std::string service_name; // optional; otherwise infer from entity type void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(daemon_name, p); decode(service_name, p); } void encode_payload(uint64_t features) override { using ceph::encode; encode(daemon_name, payload); encode(service_name, payload); } std::string_view get_type_name() const override { return "mgrclose"; } void print(std::ostream& out) const override { out << get_type_name() << "("; if (service_name.length()) { out << service_name; } else { out << ceph_entity_type_name(get_source().type()); } out << "." << daemon_name; out << ")"; } MMgrClose() : Message{MSG_MGR_CLOSE, HEAD_VERSION, COMPAT_VERSION} {} private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); };
1,227
22.615385
74
h
null
ceph-main/src/messages/MMgrCommand.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #pragma once #include <vector> #include "msg/Message.h" class MMgrCommand final : public Message { public: uuid_d fsid; std::vector<std::string> cmd; MMgrCommand() : Message{MSG_MGR_COMMAND} {} MMgrCommand(const uuid_d &f) : Message{MSG_MGR_COMMAND}, fsid(f) { } private: ~MMgrCommand() final {} public: std::string_view get_type_name() const override { return "mgr_command"; } void print(std::ostream& o) const override { o << "mgr_command(tid " << get_tid() << ": "; for (unsigned i=0; i<cmd.size(); i++) { if (i) o << ' '; o << cmd[i]; } o << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; encode(fsid, payload); encode(cmd, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(fsid, p); decode(cmd, p); } };
988
20.042553
75
h
null
ceph-main/src/messages/MMgrCommandReply.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #pragma once #include <string_view> #include "msg/Message.h" #include "MMgrCommand.h" class MMgrCommandReply final : public Message { public: errorcode32_t r; std::string rs; MMgrCommandReply() : Message{MSG_MGR_COMMAND_REPLY} {} MMgrCommandReply(MMgrCommand *m, int _r) : Message{MSG_MGR_COMMAND_REPLY}, r(_r) { header.tid = m->get_tid(); } MMgrCommandReply(int _r, std::string_view s) : Message{MSG_MGR_COMMAND_REPLY}, r(_r), rs(s) { } private: ~MMgrCommandReply() final {} public: std::string_view get_type_name() const override { return "mgr_command_reply"; } void print(std::ostream& o) const override { o << "mgr_command_reply(tid " << get_tid() << ": " << r << " " << rs << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; encode(r, payload); encode(rs, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(r, p); decode(rs, p); } };
1,102
22.978261
81
h
null
ceph-main/src/messages/MMgrConfigure.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2016 John Spray <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. */ #ifndef CEPH_MMGRCONFIGURE_H_ #define CEPH_MMGRCONFIGURE_H_ #include "msg/Message.h" #include "mgr/MetricTypes.h" #include "mgr/OSDPerfMetricTypes.h" /** * This message is sent from ceph-mgr to MgrClient, instructing it * it about what data to send back to ceph-mgr at what frequency. */ class MMgrConfigure : public Message { private: static constexpr int HEAD_VERSION = 4; static constexpr int COMPAT_VERSION = 1; public: uint32_t stats_period = 0; // Default 0 means if unspecified will include all stats uint32_t stats_threshold = 0; std::map<OSDPerfMetricQuery, OSDPerfMetricLimits> osd_perf_metric_queries; boost::optional<MetricConfigMessage> metric_config_message; void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(stats_period, p); if (header.version >= 2) { decode(stats_threshold, p); } if (header.version >= 3) { decode(osd_perf_metric_queries, p); } if (header.version >= 4) { decode(metric_config_message, p); } } void encode_payload(uint64_t features) override { using ceph::encode; encode(stats_period, payload); encode(stats_threshold, payload); encode(osd_perf_metric_queries, payload); if (metric_config_message && metric_config_message->should_encode(features)) { encode(metric_config_message, payload); } else { boost::optional<MetricConfigMessage> empty; encode(empty, payload); } } std::string_view get_type_name() const override { return "mgrconfigure"; } void print(std::ostream& out) const override { out << get_type_name() << "(period=" << stats_period << ", threshold=" << stats_threshold << ")"; } private: MMgrConfigure() : Message{MSG_MGR_CONFIGURE, HEAD_VERSION, COMPAT_VERSION} {} using RefCountedObject::put; using RefCountedObject::get; template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); template<class T, typename... Args> friend MURef<T> crimson::make_message(Args&&... args); }; #endif
2,512
26.922222
82
h
null
ceph-main/src/messages/MMgrDigest.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMGRDIGEST_H #define CEPH_MMGRDIGEST_H #include "msg/Message.h" /** * The mgr digest is a way for the mgr to subscribe to things * other than the cluster maps, which are needed by */ class MMgrDigest final : public Message { public: ceph::buffer::list mon_status_json; ceph::buffer::list health_json; std::string_view get_type_name() const override { return "mgrdigest"; } void print(std::ostream& out) const override { out << get_type_name(); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(mon_status_json, p); decode(health_json, p); } void encode_payload(uint64_t features) override { using ceph::encode; encode(mon_status_json, payload); encode(health_json, payload); } private: MMgrDigest() : Message{MSG_MGR_DIGEST} {} ~MMgrDigest() final {} using RefCountedObject::put; using RefCountedObject::get; template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); template<class T, typename... Args> friend MURef<T> crimson::make_message(Args&&... args); }; #endif
1,576
24.852459
73
h
null
ceph-main/src/messages/MMgrMap.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMGRMAP_H #define CEPH_MMGRMAP_H #include "msg/Message.h" #include "mon/MgrMap.h" class MMgrMap final : public Message { protected: MgrMap map; public: const MgrMap & get_map() {return map;} private: MMgrMap() : Message{MSG_MGR_MAP} {} MMgrMap(const MgrMap &map_) : Message{MSG_MGR_MAP}, map(map_) {} ~MMgrMap() final {} public: std::string_view get_type_name() const override { return "mgrmap"; } void print(std::ostream& out) const override { out << get_type_name() << "(e " << map.epoch << ")"; } void decode_payload() override { auto p = payload.cbegin(); decode(map, p); } void encode_payload(uint64_t features) override { using ceph::encode; encode(map, payload, features); } private: using RefCountedObject::put; using RefCountedObject::get; template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); template<class T, typename... Args> friend MURef<T> crimson::make_message(Args&&... args); }; #endif
1,470
23.114754
71
h
null
ceph-main/src/messages/MMgrOpen.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2016 John Spray <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. */ #ifndef CEPH_MMGROPEN_H_ #define CEPH_MMGROPEN_H_ #include "msg/Message.h" class MMgrOpen : public Message { private: static constexpr int HEAD_VERSION = 3; static constexpr int COMPAT_VERSION = 1; public: std::string daemon_name; std::string service_name; // optional; otherwise infer from entity type bool service_daemon = false; std::map<std::string,std::string> daemon_metadata; std::map<std::string,std::string> daemon_status; // encode map<string,map<int32_t,string>> of current config ceph::buffer::list config_bl; // encode map<string,string> of compiled-in defaults ceph::buffer::list config_defaults_bl; void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(daemon_name, p); if (header.version >= 2) { decode(service_name, p); decode(service_daemon, p); if (service_daemon) { decode(daemon_metadata, p); decode(daemon_status, p); } } if (header.version >= 3) { decode(config_bl, p); decode(config_defaults_bl, p); } } void encode_payload(uint64_t features) override { using ceph::encode; encode(daemon_name, payload); encode(service_name, payload); encode(service_daemon, payload); if (service_daemon) { encode(daemon_metadata, payload); encode(daemon_status, payload); } encode(config_bl, payload); encode(config_defaults_bl, payload); } std::string_view get_type_name() const override { return "mgropen"; } void print(std::ostream& out) const override { out << get_type_name() << "("; if (service_name.length()) { out << service_name; } else { out << ceph_entity_type_name(get_source().type()); } out << "." << daemon_name; if (service_daemon) { out << " daemon"; } out << ")"; } private: MMgrOpen() : Message{MSG_MGR_OPEN, HEAD_VERSION, COMPAT_VERSION} {} using RefCountedObject::put; using RefCountedObject::get; template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); template<class T, typename... Args> friend MURef<T> crimson::make_message(Args&&... args); }; #endif
2,620
24.950495
74
h
null
ceph-main/src/messages/MMgrReport.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2016 John Spray <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. */ #ifndef CEPH_MMGRREPORT_H_ #define CEPH_MMGRREPORT_H_ #include <boost/optional.hpp> #include "msg/Message.h" #include "mgr/MetricTypes.h" #include "mgr/OSDPerfMetricTypes.h" #include "common/perf_counters.h" #include "include/common_fwd.h" #include "mgr/DaemonHealthMetric.h" class PerfCounterType { public: std::string path; std::string description; std::string nick; enum perfcounter_type_d type; // For older clients that did not send priority, pretend everything // is "useful" so that mgr plugins filtering on prio will get some // data (albeit probably more than they wanted) uint8_t priority = PerfCountersBuilder::PRIO_USEFUL; enum unit_t unit; void encode(ceph::buffer::list &bl) const { // TODO: decide whether to drop the per-type // encoding here, we could rely on the MgrReport // verisoning instead. ENCODE_START(3, 1, bl); encode(path, bl); encode(description, bl); encode(nick, bl); static_assert(sizeof(type) == 1, "perfcounter_type_d must be one byte"); encode((uint8_t)type, bl); encode(priority, bl); encode((uint8_t)unit, bl); ENCODE_FINISH(bl); } void decode(ceph::buffer::list::const_iterator &p) { DECODE_START(3, p); decode(path, p); decode(description, p); decode(nick, p); uint8_t raw_type; decode(raw_type, p); type = (enum perfcounter_type_d)raw_type; if (struct_v >= 2) { decode(priority, p); } if (struct_v >= 3) { uint8_t raw_unit; decode(raw_unit, p); unit = (enum unit_t)raw_unit; } DECODE_FINISH(p); } }; WRITE_CLASS_ENCODER(PerfCounterType) class MMgrReport : public Message { private: static constexpr int HEAD_VERSION = 9; static constexpr int COMPAT_VERSION = 1; public: /** * Client is responsible for remembering whether it has introduced * each perf counter to the server. When first sending a particular * counter, it must inline the counter's schema here. */ std::vector<PerfCounterType> declare_types; std::vector<std::string> undeclare_types; // For all counters present, sorted by idx, output // as many bytes as are needed to represent them // Decode: iterate over the types we know about, sorted by idx, // and use the current type's type to decide how to decode // the next bytes from the ceph::buffer::list. ceph::buffer::list packed; std::string daemon_name; std::string service_name; // optional; otherwise infer from entity type // for service registration boost::optional<std::map<std::string,std::string>> daemon_status; boost::optional<std::map<std::string,std::string>> task_status; std::vector<DaemonHealthMetric> daemon_health_metrics; // encode map<string,map<int32_t,string>> of current config ceph::buffer::list config_bl; std::map<OSDPerfMetricQuery, OSDPerfMetricReport> osd_perf_metric_reports; boost::optional<MetricReportMessage> metric_report_message; void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(daemon_name, p); decode(declare_types, p); decode(packed, p); if (header.version >= 2) decode(undeclare_types, p); if (header.version >= 3) { decode(service_name, p); decode(daemon_status, p); } if (header.version >= 5) { decode(daemon_health_metrics, p); } if (header.version >= 6) { decode(config_bl, p); } if (header.version >= 7) { decode(osd_perf_metric_reports, p); } if (header.version >= 8) { decode(task_status, p); } if (header.version >= 9) { decode(metric_report_message, p); } } void encode_payload(uint64_t features) override { using ceph::encode; encode(daemon_name, payload); encode(declare_types, payload); encode(packed, payload); encode(undeclare_types, payload); encode(service_name, payload); encode(daemon_status, payload); encode(daemon_health_metrics, payload); encode(config_bl, payload); encode(osd_perf_metric_reports, payload); encode(task_status, payload); if (metric_report_message && metric_report_message->should_encode(features)) { encode(metric_report_message, payload); } else { boost::optional<MetricReportMessage> empty; encode(empty, payload); } } std::string_view get_type_name() const override { return "mgrreport"; } void print(std::ostream& out) const override { out << get_type_name() << "("; if (service_name.length()) { out << service_name; } else { out << ceph_entity_type_name(get_source().type()); } out << "." << daemon_name << " +" << declare_types.size() << "-" << undeclare_types.size() << " packed " << packed.length(); if (daemon_status) { out << " status=" << daemon_status->size(); } if (!daemon_health_metrics.empty()) { out << " daemon_metrics=" << daemon_health_metrics.size(); } if (task_status) { out << " task_status=" << task_status->size(); } out << ")"; } private: MMgrReport() : Message{MSG_MGR_REPORT, HEAD_VERSION, COMPAT_VERSION} {} using RefCountedObject::put; using RefCountedObject::get; template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); template<class T, typename... Args> friend MURef<T> crimson::make_message(Args&&... args); }; #endif
5,845
27.517073
82
h
null
ceph-main/src/messages/MMgrUpdate.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2022 Prashant D <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. */ #ifndef CEPH_MMGRUPDATE_H_ #define CEPH_MMGRUPDATE_H_ #include "msg/Message.h" class MMgrUpdate : public Message { private: static constexpr int HEAD_VERSION = 2; static constexpr int COMPAT_VERSION = 1; public: std::string daemon_name; std::string service_name; // optional; otherwise infer from entity type std::map<std::string,std::string> daemon_metadata; std::map<std::string,std::string> daemon_status; bool need_metadata_update = false; void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(daemon_name, p); if (header.version >= 2) { decode(service_name, p); decode(need_metadata_update, p); if (need_metadata_update) { decode(daemon_metadata, p); decode(daemon_status, p); } } } void encode_payload(uint64_t features) override { using ceph::encode; encode(daemon_name, payload); encode(service_name, payload); encode(need_metadata_update, payload); if (need_metadata_update) { encode(daemon_metadata, payload); encode(daemon_status, payload); } } std::string_view get_type_name() const override { return "mgrupdate"; } void print(std::ostream& out) const override { out << get_type_name() << "("; if (service_name.length()) { out << service_name; } else { out << ceph_entity_type_name(get_source().type()); } out << "." << daemon_name; out << ")"; } private: MMgrUpdate() : Message{MSG_MGR_UPDATE, HEAD_VERSION, COMPAT_VERSION} {} using RefCountedObject::put; using RefCountedObject::get; template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,142
24.211765
74
h
null
ceph-main/src/messages/MMonCommand.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMONCOMMAND_H #define CEPH_MMONCOMMAND_H #include "messages/PaxosServiceMessage.h" #include <vector> #include <string> using ceph::common::cmdmap_from_json; using ceph::common::cmd_getval; class MMonCommand final : public PaxosServiceMessage { public: // weird note: prior to octopus, MgrClient would leave fsid blank when // sending commands to the mgr. Starting with octopus, this is either // populated with a valid fsid (tell command) or an MMgrCommand is sent // instead. uuid_d fsid; std::vector<std::string> cmd; MMonCommand() : PaxosServiceMessage{MSG_MON_COMMAND, 0} {} MMonCommand(const uuid_d &f) : PaxosServiceMessage{MSG_MON_COMMAND, 0}, fsid(f) { } MMonCommand(const MMonCommand &other) : PaxosServiceMessage(MSG_MON_COMMAND, 0), fsid(other.fsid), cmd(other.cmd) { set_tid(other.get_tid()); set_data(other.get_data()); } ~MMonCommand() final {} public: std::string_view get_type_name() const override { return "mon_command"; } void print(std::ostream& o) const override { cmdmap_t cmdmap; std::ostringstream ss; std::string prefix; cmdmap_from_json(cmd, &cmdmap, ss); cmd_getval(cmdmap, "prefix", prefix); // Some config values contain sensitive data, so don't log them o << "mon_command("; if (prefix == "config set") { std::string name; cmd_getval(cmdmap, "name", name); o << "[{prefix=" << prefix << ", name=" << name << "}]"; } else if (prefix == "config-key set") { std::string key; cmd_getval(cmdmap, "key", key); o << "[{prefix=" << prefix << ", key=" << key << "}]"; } else { for (unsigned i=0; i<cmd.size(); i++) { if (i) o << ' '; o << cmd[i]; } } o << " v " << version << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); encode(fsid, payload); encode(cmd, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(fsid, p); decode(cmd, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,669
26.244898
75
h
null
ceph-main/src/messages/MMonCommandAck.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMONCOMMANDACK_H #define CEPH_MMONCOMMANDACK_H #include "messages/PaxosServiceMessage.h" using ceph::common::cmdmap_from_json; using ceph::common::cmd_getval; class MMonCommandAck final : public PaxosServiceMessage { public: std::vector<std::string> cmd; errorcode32_t r; std::string rs; MMonCommandAck() : PaxosServiceMessage{MSG_MON_COMMAND_ACK, 0} {} MMonCommandAck(const std::vector<std::string>& c, int _r, std::string s, version_t v) : PaxosServiceMessage{MSG_MON_COMMAND_ACK, v}, cmd(c), r(_r), rs(s) { } private: ~MMonCommandAck() final {} public: std::string_view get_type_name() const override { return "mon_command"; } void print(std::ostream& o) const override { cmdmap_t cmdmap; std::ostringstream ss; std::string prefix; cmdmap_from_json(cmd, &cmdmap, ss); cmd_getval(cmdmap, "prefix", prefix); // Some config values contain sensitive data, so don't log them o << "mon_command_ack("; if (prefix == "config set") { std::string name; cmd_getval(cmdmap, "name", name); o << "[{prefix=" << prefix << ", name=" << name << "}]" << "=" << r << " " << rs << " v" << version << ")"; } else if (prefix == "config-key set") { std::string key; cmd_getval(cmdmap, "key", key); o << "[{prefix=" << prefix << ", key=" << key << "}]" << "=" << r << " " << rs << " v" << version << ")"; } else { o << cmd; } o << "=" << r << " " << rs << " v" << version << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); encode(r, payload); encode(rs, payload); encode(cmd, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(r, p); decode(rs, p); decode(cmd, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,425
27.880952
89
h
null
ceph-main/src/messages/MMonElection.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMONELECTION_H #define CEPH_MMONELECTION_H #include "common/ceph_releases.h" #include "msg/Message.h" #include "mon/MonMap.h" #include "mon/mon_types.h" class MMonElection final : public Message { private: static constexpr int HEAD_VERSION = 9; static constexpr int COMPAT_VERSION = 5; public: static constexpr int OP_PROPOSE = 1; static constexpr int OP_ACK = 2; static constexpr int OP_NAK = 3; static constexpr int OP_VICTORY = 4; static const char *get_opname(int o) { switch (o) { case OP_PROPOSE: return "propose"; case OP_ACK: return "ack"; case OP_NAK: return "nak"; case OP_VICTORY: return "victory"; default: ceph_abort(); return 0; } } uuid_d fsid; int32_t op; epoch_t epoch; ceph::buffer::list monmap_bl; std::set<int32_t> quorum; uint64_t quorum_features; mon_feature_t mon_features; ceph_release_t mon_release{ceph_release_t::unknown}; ceph::buffer::list sharing_bl; ceph::buffer::list scoring_bl; uint8_t strategy; std::map<std::string,std::string> metadata; MMonElection() : Message{MSG_MON_ELECTION, HEAD_VERSION, COMPAT_VERSION}, op(0), epoch(0), quorum_features(0), mon_features(0), strategy(0) { } MMonElection(int o, epoch_t e, const bufferlist& bl, uint8_t s, MonMap *m) : Message{MSG_MON_ELECTION, HEAD_VERSION, COMPAT_VERSION}, fsid(m->fsid), op(o), epoch(e), quorum_features(0), mon_features(0), scoring_bl(bl), strategy(s) { // encode using full feature set; we will reencode for dest later, // if necessary m->encode(monmap_bl, CEPH_FEATURES_ALL); } private: ~MMonElection() final {} public: std::string_view get_type_name() const override { return "election"; } void print(std::ostream& out) const override { out << "election(" << fsid << " " << get_opname(op) << " rel " << (int)mon_release << " e" << epoch << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; if (monmap_bl.length() && (features != CEPH_FEATURES_ALL)) { // reencode old-format monmap MonMap t; t.decode(monmap_bl); monmap_bl.clear(); t.encode(monmap_bl, features); } encode(fsid, payload); encode(op, payload); encode(epoch, payload); encode(monmap_bl, payload); encode(quorum, payload); encode(quorum_features, payload); encode((version_t)0, payload); // defunct encode((version_t)0, payload); // defunct encode(sharing_bl, payload); encode(mon_features, payload); encode(metadata, payload); encode(mon_release, payload); encode(scoring_bl, payload); encode(strategy, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(fsid, p); decode(op, p); decode(epoch, p); decode(monmap_bl, p); decode(quorum, p); decode(quorum_features, p); { version_t v; // defunct fields from old encoding decode(v, p); decode(v, p); } decode(sharing_bl, p); if (header.version >= 6) decode(mon_features, p); if (header.version >= 7) decode(metadata, p); if (header.version >= 8) decode(mon_release, p); else mon_release = infer_ceph_release_from_mon_features(mon_features); if (header.version >= 9) { decode(scoring_bl, p); decode(strategy, p); } else { strategy = MonMap::election_strategy::CLASSIC; } } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
4,026
26.772414
76
h
null
ceph-main/src/messages/MMonGetMap.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMONGETMAP_H #define CEPH_MMONGETMAP_H #include "msg/Message.h" #include "include/types.h" class MMonGetMap final : public Message { public: MMonGetMap() : Message{CEPH_MSG_MON_GET_MAP} { } private: ~MMonGetMap() final {} public: std::string_view get_type_name() const override { return "mon_getmap"; } void encode_payload(uint64_t features) override { } void decode_payload() override { } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
977
23.45
74
h
null
ceph-main/src/messages/MMonGetOSDMap.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2014 Red Hat * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMONGETOSDMAP_H #define CEPH_MMONGETOSDMAP_H #include <iostream> #include <string> #include <string_view> #include "msg/Message.h" #include "include/types.h" class MMonGetOSDMap final : public PaxosServiceMessage { private: epoch_t full_first, full_last; epoch_t inc_first, inc_last; public: MMonGetOSDMap() : PaxosServiceMessage{CEPH_MSG_MON_GET_OSDMAP, 0}, full_first(0), full_last(0), inc_first(0), inc_last(0) { } private: ~MMonGetOSDMap() final {} public: void request_full(epoch_t first, epoch_t last) { ceph_assert(last >= first); full_first = first; full_last = last; } void request_inc(epoch_t first, epoch_t last) { ceph_assert(last >= first); inc_first = first; inc_last = last; } epoch_t get_full_first() const { return full_first; } epoch_t get_full_last() const { return full_last; } epoch_t get_inc_first() const { return inc_first; } epoch_t get_inc_last() const { return inc_last; } std::string_view get_type_name() const override { return "mon_get_osdmap"; } void print(std::ostream& out) const override { out << "mon_get_osdmap("; if (full_first && full_last) out << "full " << full_first << "-" << full_last; if (inc_first && inc_last) out << " inc" << inc_first << "-" << inc_last; out << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); encode(full_first, payload); encode(full_last, payload); encode(inc_first, payload); encode(inc_last, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(full_first, p); decode(full_last, p); decode(inc_first, p); decode(inc_last, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,345
22.938776
78
h
null
ceph-main/src/messages/MMonGetPurgedSnaps.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #pragma once #include "PaxosServiceMessage.h" #include "include/types.h" class MMonGetPurgedSnaps final : public PaxosServiceMessage { public: epoch_t start, last; MMonGetPurgedSnaps(epoch_t s=0, epoch_t l=0) : PaxosServiceMessage{MSG_MON_GET_PURGED_SNAPS, 0}, start(s), last(l) {} private: ~MMonGetPurgedSnaps() final {} public: std::string_view get_type_name() const override { return "mon_get_purged_snaps"; } void print(std::ostream& out) const override { out << "mon_get_purged_snaps([" << start << "," << last << "])"; } void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); encode(start, payload); encode(last, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(start, p); decode(last, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); };
1,102
22.978261
70
h
null
ceph-main/src/messages/MMonGetPurgedSnapsReply.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #pragma once #include "PaxosServiceMessage.h" #include "osd/osd_types.h" #include "include/types.h" class MMonGetPurgedSnapsReply final : public PaxosServiceMessage { public: epoch_t start, last; std::map<epoch_t,mempool::osdmap::map<int64_t,snap_interval_set_t>> purged_snaps; MMonGetPurgedSnapsReply(epoch_t s=0, epoch_t l=0) : PaxosServiceMessage{MSG_MON_GET_PURGED_SNAPS_REPLY, 0}, start(s), last(l) {} private: ~MMonGetPurgedSnapsReply() final {} public: std::string_view get_type_name() const override { return "mon_get_purged_snaps_reply"; } void print(std::ostream& out) const override { out << "mon_get_purged_snaps_reply([" << start << "," << last << "])"; } void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); encode(start, payload); encode(last, payload); encode(purged_snaps, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(start, p); decode(last, p); decode(purged_snaps, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); };
1,310
25.22
83
h
null
ceph-main/src/messages/MMonGetVersion.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2011 New Dream Network * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMONGETVERSION_H #define CEPH_MMONGETVERSION_H #include "msg/Message.h" #include "include/types.h" /* * This message is sent to the monitors to verify that the client's * version of the map(s) is the latest available. For example, this * can be used to determine whether a pool actually does not exist, or * if it may have been created but the map was not received yet. */ class MMonGetVersion final : public Message { public: MMonGetVersion() : Message{CEPH_MSG_MON_GET_VERSION} {} std::string_view get_type_name() const override { return "mon_get_version"; } void print(std::ostream& o) const override { o << "mon_get_version(what=" << what << " handle=" << handle << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; encode(handle, payload); encode(what, payload); } void decode_payload() override { auto p = payload.cbegin(); using ceph::decode; decode(handle, p); decode(what, p); } ceph_tid_t handle = 0; std::string what; private: ~MMonGetVersion() final {} }; #endif
1,500
23.606557
72
h
null
ceph-main/src/messages/MMonGetVersionReply.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2011 New Dream Network * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMONGETVERSIONREPLY_H #define CEPH_MMONGETVERSIONREPLY_H #include "msg/Message.h" #include "include/types.h" /* * This message is sent from the monitors to clients in response to a * MMonGetVersion. The latest version of the requested thing is sent * back. */ class MMonGetVersionReply final : public Message { private: static constexpr int HEAD_VERSION = 2; public: MMonGetVersionReply() : Message{CEPH_MSG_MON_GET_VERSION_REPLY, HEAD_VERSION} { } std::string_view get_type_name() const override { return "mon_get_version_reply"; } void print(std::ostream& o) const override { o << "mon_get_version_reply(handle=" << handle << " version=" << version << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; encode(handle, payload); encode(version, payload); encode(oldest_version, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(handle, p); decode(version, p); if (header.version >= 2) decode(oldest_version, p); } ceph_tid_t handle = 0; version_t version = 0; version_t oldest_version = 0; private: ~MMonGetVersionReply() final {} }; #endif
1,633
23.38806
84
h
null
ceph-main/src/messages/MMonGlobalID.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMONGLOBALID_H #define CEPH_MMONGLOBALID_H #include "messages/PaxosServiceMessage.h" class MMonGlobalID final : public PaxosServiceMessage { public: uint64_t old_max_id = 0; MMonGlobalID() : PaxosServiceMessage{MSG_MON_GLOBAL_ID, 0} {} private: ~MMonGlobalID() final {} public: std::string_view get_type_name() const override { return "global_id"; } void print(std::ostream& out) const override { out << "global_id (" << old_max_id << ")"; } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(old_max_id, p); } void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); encode(old_max_id, payload); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
1,309
24.686275
73
h
null
ceph-main/src/messages/MMonHealth.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2012 Inktank, Inc. * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMON_HEALTH_H #define CEPH_MMON_HEALTH_H #include "msg/Message.h" #include "messages/MMonQuorumService.h" #include "mon/mon_types.h" class MMonHealth final : public MMonQuorumService { public: static constexpr int HEAD_VERSION = 1; int service_type = 0; int service_op = 0; // service specific data DataStats data_stats; MMonHealth() : MMonQuorumService{MSG_MON_HEALTH, HEAD_VERSION} { } private: ~MMonHealth() final { } public: std::string_view get_type_name() const override { return "mon_health"; } void print(std::ostream &o) const override { o << "mon_health(" << " e " << get_epoch() << " r " << get_round() << " )"; } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); service_decode(p); decode(service_type, p); decode(service_op, p); decode(data_stats, p); } void encode_payload(uint64_t features) override { using ceph::encode; service_encode(); encode(service_type, payload); encode(service_op, payload); encode(data_stats, payload); } }; #endif /* CEPH_MMON_HEALTH_H */
1,532
22.953125
74
h
null
ceph-main/src/messages/MMonHealthChecks.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #ifndef CEPH_MMON_HEALTH_CHECKS_H #define CEPH_MMON_HEALTH_CHECKS_H #include "messages/PaxosServiceMessage.h" #include "mon/health_check.h" class MMonHealthChecks final : public PaxosServiceMessage { public: static constexpr int HEAD_VERSION = 1; static constexpr int COMPAT_VERSION = 1; health_check_map_t health_checks; MMonHealthChecks() : PaxosServiceMessage{MSG_MON_HEALTH_CHECKS, HEAD_VERSION, COMPAT_VERSION} { } MMonHealthChecks(health_check_map_t& m) : PaxosServiceMessage{MSG_MON_HEALTH_CHECKS, HEAD_VERSION, COMPAT_VERSION}, health_checks(m) {} private: ~MMonHealthChecks() final { } public: std::string_view get_type_name() const override { return "mon_health_checks"; } void print(std::ostream &o) const override { o << "mon_health_checks(" << health_checks.checks.size() << " checks)"; } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(health_checks, p); } void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); encode(health_checks, payload); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
1,357
25.115385
81
h
null
ceph-main/src/messages/MMonJoin.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMONJOIN_H #define CEPH_MMONJOIN_H #include "messages/PaxosServiceMessage.h" class MMonJoin final : public PaxosServiceMessage { public: static constexpr int HEAD_VERSION = 3; static constexpr int COMPAT_VERSION = 2; uuid_d fsid; std::string name; entity_addrvec_t addrs; /* The location members are for stretch mode. crush_loc is the location * (generally just a "datacenter=<foo>" statement) of the monitor. The * force_loc is whether the mon cluster should replace a previously-known * location. Generally the monitor will force an update if it's given a * location from the CLI on boot-up, and then never force again (so that it * can be moved/updated via the ceph tool from elsewhere). */ std::map<std::string,std::string> crush_loc; bool force_loc{false}; MMonJoin() : PaxosServiceMessage{MSG_MON_JOIN, 0, HEAD_VERSION, COMPAT_VERSION} {} MMonJoin(uuid_d &f, std::string n, const entity_addrvec_t& av) : PaxosServiceMessage{MSG_MON_JOIN, 0, HEAD_VERSION, COMPAT_VERSION}, fsid(f), name(n), addrs(av) { } MMonJoin(uuid_d &f, std::string n, const entity_addrvec_t& av, const std::map<std::string,std::string>& cloc, bool force) : PaxosServiceMessage{MSG_MON_JOIN, 0, HEAD_VERSION, COMPAT_VERSION}, fsid(f), name(n), addrs(av), crush_loc(cloc), force_loc(force) { } private: ~MMonJoin() final {} public: std::string_view get_type_name() const override { return "mon_join"; } void print(std::ostream& o) const override { o << "mon_join(" << name << " " << addrs << " " << crush_loc << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); encode(fsid, payload); encode(name, payload); assert(HAVE_FEATURE(features, SERVER_NAUTILUS)); header.version = HEAD_VERSION; header.compat_version = COMPAT_VERSION; encode(addrs, payload, features); encode(crush_loc, payload); encode(force_loc, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(fsid, p); decode(name, p); assert(header.version > 1); decode(addrs, p); if (header.version >= 3) { decode(crush_loc, p); decode(force_loc, p); } } }; #endif
2,725
31.070588
84
h
null
ceph-main/src/messages/MMonMap.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMONMAP_H #define CEPH_MMONMAP_H #include "include/encoding.h" #include "include/ceph_features.h" #include "msg/Message.h" #include "msg/MessageRef.h" #include "mon/MonMap.h" class MMonMap final : public Message { public: ceph::buffer::list monmapbl; MMonMap() : Message{CEPH_MSG_MON_MAP} { } explicit MMonMap(ceph::buffer::list &bl) : Message{CEPH_MSG_MON_MAP} { monmapbl = std::move(bl); } private: ~MMonMap() final {} public: std::string_view get_type_name() const override { return "mon_map"; } void encode_payload(uint64_t features) override { if (monmapbl.length() && ((features & CEPH_FEATURE_MONENC) == 0 || (features & CEPH_FEATURE_MSG_ADDR2) == 0)) { // reencode old-format monmap MonMap t; t.decode(monmapbl); monmapbl.clear(); t.encode(monmapbl, features); } using ceph::encode; encode(monmapbl, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(monmapbl, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
1,585
24.174603
72
h
null
ceph-main/src/messages/MMonMgrReport.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2017 Greg Farnum/Red Hat <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMONMGRREPORT_H #define CEPH_MMONMGRREPORT_H #include "messages/PaxosServiceMessage.h" #include "include/types.h" #include "include/health.h" #include "mon/health_check.h" #include "mon/PGMap.h" class MMonMgrReport final : public PaxosServiceMessage { private: static constexpr int HEAD_VERSION = 3; static constexpr int COMPAT_VERSION = 1; public: // PGMapDigest is in data payload health_check_map_t health_checks; ceph::buffer::list service_map_bl; // encoded ServiceMap std::map<std::string,ProgressEvent> progress_events; uint64_t gid = 0; MMonMgrReport() : PaxosServiceMessage{MSG_MON_MGR_REPORT, 0, HEAD_VERSION, COMPAT_VERSION} {} private: ~MMonMgrReport() final {} public: std::string_view get_type_name() const override { return "monmgrreport"; } void print(std::ostream& out) const override { out << get_type_name() << "(gid " << gid << ", " << health_checks.checks.size() << " checks, " << progress_events.size() << " progress events)"; } void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); encode(health_checks, payload); encode(service_map_bl, payload); encode(progress_events, payload); encode(gid, payload); if (!HAVE_FEATURE(features, SERVER_NAUTILUS) || !HAVE_FEATURE(features, SERVER_MIMIC)) { // PGMapDigest had a backwards-incompatible change between // luminous and mimic, and conditionally encodes based on // provided features, so reencode the one in our data payload. // The mgr isn't able to do this at the time the encoded // PGMapDigest is constructed because we don't know which mon we // will target. Note that this only triggers if the user // upgrades ceph-mgr before ceph-mon (tsk tsk). PGMapDigest digest; auto p = data.cbegin(); decode(digest, p); ceph::buffer::list bl; encode(digest, bl, features); set_data(bl); } } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(health_checks, p); decode(service_map_bl, p); if (header.version >= 2) { decode(progress_events, p); } if (header.version >= 3) { decode(gid, p); } } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,827
28.768421
78
h
null
ceph-main/src/messages/MMonPaxos.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMONPAXOS_H #define CEPH_MMONPAXOS_H #include "messages/PaxosServiceMessage.h" #include "mon/mon_types.h" #include "include/ceph_features.h" class MMonPaxos final : public Message { private: static constexpr int HEAD_VERSION = 4; static constexpr int COMPAT_VERSION = 3; public: // op types static constexpr int OP_COLLECT = 1; // proposer: propose round static constexpr int OP_LAST = 2; // voter: accept proposed round static constexpr int OP_BEGIN = 3; // proposer: value proposed for this round static constexpr int OP_ACCEPT = 4; // voter: accept propsed value static constexpr int OP_COMMIT = 5; // proposer: notify learners of agreed value static constexpr int OP_LEASE = 6; // leader: extend peon lease static constexpr int OP_LEASE_ACK = 7; // peon: lease ack static const char *get_opname(int op) { switch (op) { case OP_COLLECT: return "collect"; case OP_LAST: return "last"; case OP_BEGIN: return "begin"; case OP_ACCEPT: return "accept"; case OP_COMMIT: return "commit"; case OP_LEASE: return "lease"; case OP_LEASE_ACK: return "lease_ack"; default: ceph_abort(); return 0; } } epoch_t epoch = 0; // monitor epoch __s32 op = 0; // paxos op version_t first_committed = 0; // i've committed to version_t last_committed = 0; // i've committed to version_t pn_from = 0; // i promise to accept after version_t pn = 0; // with with proposal version_t uncommitted_pn = 0; // previous pn, if we are a LAST with an uncommitted value utime_t lease_timestamp; utime_t sent_timestamp; version_t latest_version = 0; ceph::buffer::list latest_value; std::map<version_t,ceph::buffer::list> values; ceph::buffer::list feature_map; MMonPaxos() : Message{MSG_MON_PAXOS, HEAD_VERSION, COMPAT_VERSION} { } MMonPaxos(epoch_t e, int o, utime_t now) : Message{MSG_MON_PAXOS, HEAD_VERSION, COMPAT_VERSION}, epoch(e), op(o), first_committed(0), last_committed(0), pn_from(0), pn(0), uncommitted_pn(0), sent_timestamp(now), latest_version(0) { } private: ~MMonPaxos() final {} public: std::string_view get_type_name() const override { return "paxos"; } void print(std::ostream& out) const override { out << "paxos(" << get_opname(op) << " lc " << last_committed << " fc " << first_committed << " pn " << pn << " opn " << uncommitted_pn; if (latest_version) out << " latest " << latest_version << " (" << latest_value.length() << " bytes)"; out << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; header.version = HEAD_VERSION; encode(epoch, payload); encode(op, payload); encode(first_committed, payload); encode(last_committed, payload); encode(pn_from, payload); encode(pn, payload); encode(uncommitted_pn, payload); encode(lease_timestamp, payload); encode(sent_timestamp, payload); encode(latest_version, payload); encode(latest_value, payload); encode(values, payload); encode(feature_map, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(epoch, p); decode(op, p); decode(first_committed, p); decode(last_committed, p); decode(pn_from, p); decode(pn, p); decode(uncommitted_pn, p); decode(lease_timestamp, p); decode(sent_timestamp, p); decode(latest_version, p); decode(latest_value, p); decode(values, p); if (header.version >= 4) { decode(feature_map, p); } } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
4,178
29.727941
94
h
null
ceph-main/src/messages/MMonPing.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /** * This is used to send pings between monitors for * heartbeat purposes. We include a timestamp and distinguish between * outgoing pings and responses to those. If you set the * min_message in the constructor, the message will inflate itself * to the specified size -- this is good for dealing with network * issues with jumbo frames. See http://tracker.ceph.com/issues/20087 * */ #ifndef CEPH_MMONPING_H #define CEPH_MMONPING_H #include "common/Clock.h" #include "msg/Message.h" #include "mon/ConnectionTracker.h" class MMonPing final : public Message { private: static constexpr int HEAD_VERSION = 1; static constexpr int COMPAT_VERSION = 1; public: enum { PING = 1, PING_REPLY = 2, }; const char *get_op_name(int op) const { switch (op) { case PING: return "ping"; case PING_REPLY: return "ping_reply"; default: return "???"; } } __u8 op = 0; utime_t stamp; bufferlist tracker_bl; uint32_t min_message_size = 0; MMonPing(__u8 o, utime_t s, const bufferlist& tbl, uint32_t min_message) : Message{MSG_MON_PING, HEAD_VERSION, COMPAT_VERSION}, op(o), stamp(s), tracker_bl(tbl), min_message_size(min_message) {} MMonPing(__u8 o, utime_t s, const bufferlist& tbl) : Message{MSG_MON_PING, HEAD_VERSION, COMPAT_VERSION}, op(o), stamp(s), tracker_bl(tbl) {} MMonPing() : Message{MSG_MON_PING, HEAD_VERSION, COMPAT_VERSION} {} private: ~MMonPing() final {} public: void decode_payload() override { auto p = payload.cbegin(); decode(op, p); decode(stamp, p); decode(tracker_bl, p); int payload_mid_length = p.get_off(); uint32_t size; decode(size, p); p += size; min_message_size = size + payload_mid_length; } void encode_payload(uint64_t features) override { using ceph::encode; encode(op, payload); encode(stamp, payload); encode(tracker_bl, payload); size_t s = 0; if (min_message_size > payload.length()) { s = min_message_size - payload.length(); } encode((uint32_t)s, payload); if (s) { // this should be big enough for normal min_message padding sizes. since // we are targeting jumbo ethernet frames around 9000 bytes, 16k should // be more than sufficient! the compiler will statically zero this so // that at runtime we are only adding a bufferptr reference to it. static char zeros[16384] = {}; while (s > sizeof(zeros)) { payload.append(buffer::create_static(sizeof(zeros), zeros)); s -= sizeof(zeros); } if (s) { payload.append(buffer::create_static(s, zeros)); } } } std::string_view get_type_name() const override { return "mon_ping"; } void print(std::ostream& out) const override { out << "mon_ping(" << get_op_name(op) << " stamp " << stamp << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
3,080
27.009091
78
h
null
ceph-main/src/messages/MMonProbe.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMONPROBE_H #define CEPH_MMONPROBE_H #include "include/ceph_features.h" #include "common/ceph_releases.h" #include "msg/Message.h" #include "mon/MonMap.h" class MMonProbe final : public Message { public: static constexpr int HEAD_VERSION = 8; static constexpr int COMPAT_VERSION = 5; enum { OP_PROBE = 1, OP_REPLY = 2, OP_SLURP = 3, OP_SLURP_LATEST = 4, OP_DATA = 5, OP_MISSING_FEATURES = 6, }; static const char *get_opname(int o) { switch (o) { case OP_PROBE: return "probe"; case OP_REPLY: return "reply"; case OP_SLURP: return "slurp"; case OP_SLURP_LATEST: return "slurp_latest"; case OP_DATA: return "data"; case OP_MISSING_FEATURES: return "missing_features"; default: ceph_abort(); return 0; } } uuid_d fsid; int32_t op = 0; std::string name; std::set<int32_t> quorum; int leader = -1; ceph::buffer::list monmap_bl; version_t paxos_first_version = 0; version_t paxos_last_version = 0; bool has_ever_joined = 0; uint64_t required_features = 0; ceph_release_t mon_release{ceph_release_t::unknown}; MMonProbe() : Message{MSG_MON_PROBE, HEAD_VERSION, COMPAT_VERSION} {} MMonProbe(const uuid_d& f, int o, const std::string& n, bool hej, ceph_release_t mr) : Message{MSG_MON_PROBE, HEAD_VERSION, COMPAT_VERSION}, fsid(f), op(o), name(n), paxos_first_version(0), paxos_last_version(0), has_ever_joined(hej), required_features(0), mon_release{mr} {} private: ~MMonProbe() final {} public: std::string_view get_type_name() const override { return "mon_probe"; } void print(std::ostream& out) const override { out << "mon_probe(" << get_opname(op) << " " << fsid << " name " << name; if (quorum.size()) out << " quorum " << quorum; out << " leader " << leader; if (op == OP_REPLY) { out << " paxos(" << " fc " << paxos_first_version << " lc " << paxos_last_version << " )"; } if (!has_ever_joined) out << " new"; if (required_features) out << " required_features " << required_features; if (mon_release != ceph_release_t::unknown) out << " mon_release " << mon_release; out << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; if (monmap_bl.length() && ((features & CEPH_FEATURE_MONENC) == 0 || (features & CEPH_FEATURE_MSG_ADDR2) == 0)) { // reencode old-format monmap MonMap t; t.decode(monmap_bl); monmap_bl.clear(); t.encode(monmap_bl, features); } encode(fsid, payload); encode(op, payload); encode(name, payload); encode(quorum, payload); encode(monmap_bl, payload); encode(has_ever_joined, payload); encode(paxos_first_version, payload); encode(paxos_last_version, payload); encode(required_features, payload); encode(mon_release, payload); encode(leader, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(fsid, p); decode(op, p); decode(name, p); decode(quorum, p); decode(monmap_bl, p); decode(has_ever_joined, p); decode(paxos_first_version, p); decode(paxos_last_version, p); if (header.version >= 6) decode(required_features, p); else required_features = 0; if (header.version >= 7) decode(mon_release, p); else mon_release = ceph_release_t::unknown; if (header.version >= 8) { decode(leader, p); } else if (quorum.size()) { leader = *quorum.begin(); } } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
4,154
25.980519
86
h
null
ceph-main/src/messages/MMonQuorumService.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2012 Inktank, Inc. * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMON_QUORUM_SERVICE_H #define CEPH_MMON_QUORUM_SERVICE_H #include "msg/Message.h" class MMonQuorumService : public Message { public: epoch_t epoch = 0; version_t round = 0; protected: MMonQuorumService(int type, int head) : Message{type, head, 1} {} ~MMonQuorumService() override {} public: void set_epoch(epoch_t e) { epoch = e; } void set_round(version_t r) { round = r; } epoch_t get_epoch() const { return epoch; } version_t get_round() const { return round; } void service_encode() { using ceph::encode; encode(epoch, payload); encode(round, payload); } void service_decode(ceph::buffer::list::const_iterator &p) { using ceph::decode; decode(epoch, p); decode(round, p); } void encode_payload(uint64_t features) override { ceph_abort_msg("MMonQuorumService message must always be a base class"); } void decode_payload() override { ceph_abort_msg("MMonQuorumService message must always be a base class"); } std::string_view get_type_name() const override { return "quorum_service"; } }; #endif /* CEPH_MMON_QUORUM_SERVICE_H */
1,557
20.943662
78
h
null
ceph-main/src/messages/MMonScrub.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2013 Inktank, Inc. * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. */ #ifndef CEPH_MMONSCRUB_H #define CEPH_MMONSCRUB_H #include "msg/Message.h" #include "mon/mon_types.h" class MMonScrub : public Message { private: static constexpr int HEAD_VERSION = 2; static constexpr int COMPAT_VERSION = 2; public: typedef enum { OP_SCRUB = 1, // leader->peon: scrub (a range of) keys OP_RESULT = 2, // peon->leader: result of a scrub } op_type_t; static const char *get_opname(op_type_t op) { switch (op) { case OP_SCRUB: return "scrub"; case OP_RESULT: return "result"; default: ceph_abort_msg("unknown op type"); return NULL; } } op_type_t op = OP_SCRUB; version_t version = 0; ScrubResult result; int32_t num_keys; std::pair<std::string,std::string> key; MMonScrub() : Message{MSG_MON_SCRUB, HEAD_VERSION, COMPAT_VERSION}, num_keys(-1) { } MMonScrub(op_type_t op, version_t v, int32_t num_keys) : Message{MSG_MON_SCRUB, HEAD_VERSION, COMPAT_VERSION}, op(op), version(v), num_keys(num_keys) { } std::string_view get_type_name() const override { return "mon_scrub"; } void print(std::ostream& out) const override { out << "mon_scrub(" << get_opname((op_type_t)op); out << " v " << version; if (op == OP_RESULT) out << " " << result; out << " num_keys " << num_keys; out << " key (" << key << ")"; out << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; uint8_t o = op; encode(o, payload); encode(version, payload); encode(result, payload); encode(num_keys, payload); encode(key, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); uint8_t o; decode(o, p); op = (op_type_t)o; decode(version, p); decode(result, p); decode(num_keys, p); decode(key, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif /* CEPH_MMONSCRUB_H */
2,395
24.763441
73
h
null
ceph-main/src/messages/MMonSubscribe.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMONSUBSCRIBE_H #define CEPH_MMONSUBSCRIBE_H #include "msg/Message.h" #include "include/ceph_features.h" /* * compatibility with old crap */ struct ceph_mon_subscribe_item_old { ceph_le64 unused; ceph_le64 have; __u8 onetime; } __attribute__ ((packed)); WRITE_RAW_ENCODER(ceph_mon_subscribe_item_old) class MMonSubscribe final : public Message { public: static constexpr int HEAD_VERSION = 3; static constexpr int COMPAT_VERSION = 1; std::string hostname; std::map<std::string, ceph_mon_subscribe_item> what; MMonSubscribe() : Message{CEPH_MSG_MON_SUBSCRIBE, HEAD_VERSION, COMPAT_VERSION} { } private: ~MMonSubscribe() final {} public: void sub_want(const char *w, version_t start, unsigned flags) { what[w].start = start; what[w].flags = flags; } std::string_view get_type_name() const override { return "mon_subscribe"; } void print(std::ostream& o) const override { o << "mon_subscribe(" << what << ")"; } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); if (header.version < 2) { std::map<std::string, ceph_mon_subscribe_item_old> oldwhat; decode(oldwhat, p); what.clear(); for (auto q = oldwhat.begin(); q != oldwhat.end(); q++) { if (q->second.have) what[q->first].start = q->second.have + 1; else what[q->first].start = 0; what[q->first].flags = 0; if (q->second.onetime) what[q->first].flags |= CEPH_SUBSCRIBE_ONETIME; } return; } decode(what, p); if (header.version >= 3) { decode(hostname, p); } } void encode_payload(uint64_t features) override { using ceph::encode; if ((features & CEPH_FEATURE_SUBSCRIBE2) == 0) { header.version = 0; std::map<std::string, ceph_mon_subscribe_item_old> oldwhat; for (auto q = what.begin(); q != what.end(); q++) { if (q->second.start) // warning: start=1 -> have=0, which was ambiguous oldwhat[q->first].have = q->second.start - 1; else oldwhat[q->first].have = 0; oldwhat[q->first].onetime = q->second.flags & CEPH_SUBSCRIBE_ONETIME; } encode(oldwhat, payload); return; } header.version = HEAD_VERSION; encode(what, payload); encode(hostname, payload); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,812
26.048077
85
h
null
ceph-main/src/messages/MMonSubscribeAck.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MMONSUBSCRIBEACK_H #define CEPH_MMONSUBSCRIBEACK_H #include "msg/Message.h" class MMonSubscribeAck final : public Message { public: __u32 interval; uuid_d fsid; MMonSubscribeAck() : Message{CEPH_MSG_MON_SUBSCRIBE_ACK}, interval(0) { } MMonSubscribeAck(uuid_d& f, int i) : Message{CEPH_MSG_MON_SUBSCRIBE_ACK}, interval(i), fsid(f) { } private: ~MMonSubscribeAck() final {} public: std::string_view get_type_name() const override { return "mon_subscribe_ack"; } void print(std::ostream& o) const override { o << "mon_subscribe_ack(" << interval << "s)"; } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(interval, p); decode(fsid, p); } void encode_payload(uint64_t features) override { using ceph::encode; encode(interval, payload); encode(fsid, payload); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
1,450
24.910714
81
h
null
ceph-main/src/messages/MMonSync.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2012 Inktank, Inc. * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. */ #ifndef CEPH_MMONSYNC_H #define CEPH_MMONSYNC_H #include "msg/Message.h" class MMonSync : public Message { private: static constexpr int HEAD_VERSION = 2; static constexpr int COMPAT_VERSION = 2; public: /** * Operation types */ enum { OP_GET_COOKIE_FULL = 1, // -> start a session (full scan) OP_GET_COOKIE_RECENT = 2, // -> start a session (only recent paxos events) OP_COOKIE = 3, // <- pass the iterator cookie, or OP_GET_CHUNK = 4, // -> get some keys OP_CHUNK = 5, // <- return some keys OP_LAST_CHUNK = 6, // <- return the last set of keys OP_NO_COOKIE = 8, // <- sorry, no cookie }; /** * Obtain a string corresponding to the operation type @p op * * @param op Operation type * @returns A string */ static const char *get_opname(int op) { switch (op) { case OP_GET_COOKIE_FULL: return "get_cookie_full"; case OP_GET_COOKIE_RECENT: return "get_cookie_recent"; case OP_COOKIE: return "cookie"; case OP_GET_CHUNK: return "get_chunk"; case OP_CHUNK: return "chunk"; case OP_LAST_CHUNK: return "last_chunk"; case OP_NO_COOKIE: return "no_cookie"; default: ceph_abort_msg("unknown op type"); return NULL; } } uint32_t op = 0; uint64_t cookie = 0; version_t last_committed = 0; std::pair<std::string,std::string> last_key; ceph::buffer::list chunk_bl; entity_inst_t reply_to; MMonSync() : Message{MSG_MON_SYNC, HEAD_VERSION, COMPAT_VERSION} { } MMonSync(uint32_t op, uint64_t c = 0) : Message{MSG_MON_SYNC, HEAD_VERSION, COMPAT_VERSION}, op(op), cookie(c), last_committed(0) { } std::string_view get_type_name() const override { return "mon_sync"; } void print(std::ostream& out) const override { out << "mon_sync(" << get_opname(op); if (cookie) out << " cookie " << cookie; if (last_committed > 0) out << " lc " << last_committed; if (chunk_bl.length()) out << " bl " << chunk_bl.length() << " bytes"; if (!last_key.first.empty() || !last_key.second.empty()) out << " last_key " << last_key.first << "," << last_key.second; out << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; encode(op, payload); encode(cookie, payload); encode(last_committed, payload); encode(last_key.first, payload); encode(last_key.second, payload); encode(chunk_bl, payload); encode(reply_to, payload, features); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(op, p); decode(cookie, p); decode(last_committed, p); decode(last_key.first, p); decode(last_key.second, p); decode(chunk_bl, p); decode(reply_to, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif /* CEPH_MMONSYNC_H */
3,336
27.521368
78
h
null
ceph-main/src/messages/MMonUsedPendingKeys.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #pragma once #include "messages/PaxosServiceMessage.h" class MMonUsedPendingKeys final : public PaxosServiceMessage { public: std::map<EntityName,CryptoKey> used_pending_keys; MMonUsedPendingKeys() : PaxosServiceMessage{MSG_MON_USED_PENDING_KEYS, 0} {} private: ~MMonUsedPendingKeys() final {} public: std::string_view get_type_name() const override { return "used_pending_keys"; } void print(std::ostream& out) const override { out << "used_pending_keys(" << used_pending_keys.size() << " keys)"; } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(used_pending_keys, p); } void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); encode(used_pending_keys, payload); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); };
1,362
26.816327
81
h
null
ceph-main/src/messages/MOSDAlive.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDALIVE_H #define CEPH_MOSDALIVE_H #include "messages/PaxosServiceMessage.h" class MOSDAlive final : public PaxosServiceMessage { public: epoch_t want = 0; MOSDAlive(epoch_t h, epoch_t w) : PaxosServiceMessage{MSG_OSD_ALIVE, h}, want(w) {} MOSDAlive() : MOSDAlive{0, 0} {} private: ~MOSDAlive() final {} public: void encode_payload(uint64_t features) override { paxos_encode(); using ceph::encode; encode(want, payload); } void decode_payload() override { auto p = payload.cbegin(); paxos_decode(p); using ceph::decode; decode(want, p); } std::string_view get_type_name() const override { return "osd_alive"; } void print(std::ostream &out) const override { out << "osd_alive(want up_thru " << want << " have " << version << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
1,364
24.277778
85
h
null
ceph-main/src/messages/MOSDBackoff.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2017 Red Hat * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDBACKOFF_H #define CEPH_MOSDBACKOFF_H #include "MOSDFastDispatchOp.h" #include "osd/osd_types.h" class MOSDBackoff : public MOSDFastDispatchOp { public: static constexpr int HEAD_VERSION = 1; static constexpr int COMPAT_VERSION = 1; spg_t pgid; epoch_t map_epoch = 0; uint8_t op = 0; ///< CEPH_OSD_BACKOFF_OP_* uint64_t id = 0; ///< unique id within this session hobject_t begin, end; ///< [) range to block, unless ==, block single obj spg_t get_spg() const override { return pgid; } epoch_t get_map_epoch() const override { return map_epoch; } MOSDBackoff() : MOSDFastDispatchOp{CEPH_MSG_OSD_BACKOFF, HEAD_VERSION, COMPAT_VERSION} {} MOSDBackoff(spg_t pgid_, epoch_t ep, uint8_t op_, uint64_t id_, hobject_t begin_, hobject_t end_) : MOSDFastDispatchOp{CEPH_MSG_OSD_BACKOFF, HEAD_VERSION, COMPAT_VERSION}, pgid(pgid_), map_epoch(ep), op(op_), id(id_), begin(begin_), end(end_) { } void encode_payload(uint64_t features) override { using ceph::encode; encode(pgid, payload); encode(map_epoch, payload); encode(op, payload); encode(id, payload); encode(begin, payload); encode(end, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(pgid, p); decode(map_epoch, p); decode(op, p); decode(id, p); decode(begin, p); decode(end, p); } std::string_view get_type_name() const override { return "osd_backoff"; } void print(std::ostream& out) const override { out << "osd_backoff(" << pgid << " " << ceph_osd_backoff_op_name(op) << " id " << id << " [" << begin << "," << end << ")" << " e" << map_epoch << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,295
25.390805
79
h
null
ceph-main/src/messages/MOSDBeacon.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #pragma once #include "PaxosServiceMessage.h" class MOSDBeacon : public PaxosServiceMessage { private: static constexpr int HEAD_VERSION = 3; static constexpr int COMPAT_VERSION = 1; public: std::vector<pg_t> pgs; epoch_t min_last_epoch_clean = 0; utime_t last_purged_snaps_scrub; int osd_beacon_report_interval = 0; MOSDBeacon() : PaxosServiceMessage{MSG_OSD_BEACON, 0, HEAD_VERSION, COMPAT_VERSION} {} MOSDBeacon(epoch_t e, epoch_t min_lec, utime_t ls, int interval) : PaxosServiceMessage{MSG_OSD_BEACON, e, HEAD_VERSION, COMPAT_VERSION}, min_last_epoch_clean(min_lec), last_purged_snaps_scrub(ls), osd_beacon_report_interval(interval) {} void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); encode(pgs, payload); encode(min_last_epoch_clean, payload); encode(last_purged_snaps_scrub, payload); encode(osd_beacon_report_interval, payload); } void decode_payload() override { auto p = payload.cbegin(); using ceph::decode; paxos_decode(p); decode(pgs, p); decode(min_last_epoch_clean, p); if (header.version >= 2) { decode(last_purged_snaps_scrub, p); } if (header.version >= 3) { decode(osd_beacon_report_interval, p); } else { osd_beacon_report_interval = 0; } } std::string_view get_type_name() const override { return "osd_beacon"; } void print(std::ostream &out) const { out << get_type_name() << "(pgs " << pgs << " lec " << min_last_epoch_clean << " last_purged_snaps_scrub " << last_purged_snaps_scrub << " osd_beacon_report_interval " << osd_beacon_report_interval << " v" << version << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); };
1,954
29.076923
74
h
null
ceph-main/src/messages/MOSDBoot.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDBOOT_H #define CEPH_MOSDBOOT_H #include "messages/PaxosServiceMessage.h" #include "include/ceph_features.h" #include "include/types.h" #include "osd/osd_types.h" class MOSDBoot final : public PaxosServiceMessage { private: static constexpr int HEAD_VERSION = 7; static constexpr int COMPAT_VERSION = 7; public: OSDSuperblock sb; entity_addrvec_t hb_back_addrs, hb_front_addrs; entity_addrvec_t cluster_addrs; epoch_t boot_epoch; // last epoch this daemon was added to the map (if any) std::map<std::string,std::string> metadata; ///< misc metadata about this osd uint64_t osd_features; MOSDBoot() : PaxosServiceMessage{MSG_OSD_BOOT, 0, HEAD_VERSION, COMPAT_VERSION}, boot_epoch(0), osd_features(0) { } MOSDBoot(const OSDSuperblock& s, epoch_t e, epoch_t be, const entity_addrvec_t& hb_back_addr_ref, const entity_addrvec_t& hb_front_addr_ref, const entity_addrvec_t& cluster_addr_ref, uint64_t feat) : PaxosServiceMessage{MSG_OSD_BOOT, e, HEAD_VERSION, COMPAT_VERSION}, sb(s), hb_back_addrs(hb_back_addr_ref), hb_front_addrs(hb_front_addr_ref), cluster_addrs(cluster_addr_ref), boot_epoch(be), osd_features(feat) { } private: ~MOSDBoot() final { } public: std::string_view get_type_name() const override { return "osd_boot"; } void print(std::ostream& out) const override { out << "osd_boot(osd." << sb.whoami << " booted " << boot_epoch << " features " << osd_features << " v" << version << ")"; } void encode_payload(uint64_t features) override { header.version = HEAD_VERSION; header.compat_version = COMPAT_VERSION; using ceph::encode; paxos_encode(); assert(HAVE_FEATURE(features, SERVER_NAUTILUS)); encode(sb, payload); encode(hb_back_addrs, payload, features); encode(cluster_addrs, payload, features); encode(boot_epoch, payload); encode(hb_front_addrs, payload, features); encode(metadata, payload); encode(osd_features, payload); } void decode_payload() override { auto p = payload.cbegin(); using ceph::decode; paxos_decode(p); assert(header.version >= 7); decode(sb, p); decode(hb_back_addrs, p); decode(cluster_addrs, p); decode(boot_epoch, p); decode(hb_front_addrs, p); decode(metadata, p); decode(osd_features, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,929
28.59596
79
h
null
ceph-main/src/messages/MOSDECSubOpRead.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2013 Inktank Storage, Inc. * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef MOSDECSUBOPREAD_H #define MOSDECSUBOPREAD_H #include "MOSDFastDispatchOp.h" #include "osd/ECMsgTypes.h" class MOSDECSubOpRead : public MOSDFastDispatchOp { private: static constexpr int HEAD_VERSION = 3; static constexpr int COMPAT_VERSION = 1; public: spg_t pgid; epoch_t map_epoch = 0, min_epoch = 0; ECSubRead op; int get_cost() const override { return 0; } epoch_t get_map_epoch() const override { return map_epoch; } epoch_t get_min_epoch() const override { return min_epoch; } spg_t get_spg() const override { return pgid; } MOSDECSubOpRead() : MOSDFastDispatchOp{MSG_OSD_EC_READ, HEAD_VERSION, COMPAT_VERSION} {} void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(pgid, p); decode(map_epoch, p); decode(op, p); if (header.version >= 3) { decode(min_epoch, p); decode_trace(p); } else { min_epoch = map_epoch; } } void encode_payload(uint64_t features) override { using ceph::encode; encode(pgid, payload); encode(map_epoch, payload); encode(op, payload, features); encode(min_epoch, payload); encode_trace(payload, features); } std::string_view get_type_name() const override { return "MOSDECSubOpRead"; } void print(std::ostream& out) const override { out << "MOSDECSubOpRead(" << pgid << " " << map_epoch << "/" << min_epoch << " " << op; out << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,005
22.6
79
h
null
ceph-main/src/messages/MOSDECSubOpReadReply.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2013 Inktank Storage, Inc. * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef MOSDECSUBOPREADREPLY_H #define MOSDECSUBOPREADREPLY_H #include "MOSDFastDispatchOp.h" #include "osd/ECMsgTypes.h" class MOSDECSubOpReadReply : public MOSDFastDispatchOp { private: static constexpr int HEAD_VERSION = 2; static constexpr int COMPAT_VERSION = 1; public: spg_t pgid; epoch_t map_epoch = 0, min_epoch = 0; ECSubReadReply op; int get_cost() const override { return 0; } epoch_t get_map_epoch() const override { return map_epoch; } epoch_t get_min_epoch() const override { return min_epoch; } spg_t get_spg() const override { return pgid; } MOSDECSubOpReadReply() : MOSDFastDispatchOp{MSG_OSD_EC_READ_REPLY, HEAD_VERSION, COMPAT_VERSION} {} void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(pgid, p); decode(map_epoch, p); decode(op, p); if (header.version >= 2) { decode(min_epoch, p); decode_trace(p); } else { min_epoch = map_epoch; } } void encode_payload(uint64_t features) override { using ceph::encode; encode(pgid, payload); encode(map_epoch, payload); encode(op, payload); encode(min_epoch, payload); encode_trace(payload, features); } std::string_view get_type_name() const override { return "MOSDECSubOpReadReply"; } void print(std::ostream& out) const override { out << "MOSDECSubOpReadReply(" << pgid << " " << map_epoch << "/" << min_epoch << " " << op; out << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,036
22.964706
84
h
null
ceph-main/src/messages/MOSDECSubOpWrite.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2013 Inktank Storage, Inc. * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef MOSDECSUBOPWRITE_H #define MOSDECSUBOPWRITE_H #include "MOSDFastDispatchOp.h" #include "osd/ECMsgTypes.h" class MOSDECSubOpWrite : public MOSDFastDispatchOp { private: static constexpr int HEAD_VERSION = 2; static constexpr int COMPAT_VERSION = 1; public: spg_t pgid; epoch_t map_epoch = 0, min_epoch = 0; ECSubWrite op; int get_cost() const override { return 0; } epoch_t get_map_epoch() const override { return map_epoch; } epoch_t get_min_epoch() const override { return min_epoch; } spg_t get_spg() const override { return pgid; } MOSDECSubOpWrite() : MOSDFastDispatchOp{MSG_OSD_EC_WRITE, HEAD_VERSION, COMPAT_VERSION} {} MOSDECSubOpWrite(ECSubWrite &in_op) : MOSDFastDispatchOp{MSG_OSD_EC_WRITE, HEAD_VERSION, COMPAT_VERSION} { op.claim(in_op); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(pgid, p); decode(map_epoch, p); decode(op, p); if (header.version >= 2) { decode(min_epoch, p); decode_trace(p); } else { min_epoch = map_epoch; } } void encode_payload(uint64_t features) override { using ceph::encode; encode(pgid, payload); encode(map_epoch, payload); encode(op, payload); encode(min_epoch, payload); encode_trace(payload, features); } std::string_view get_type_name() const override { return "MOSDECSubOpWrite"; } void print(std::ostream& out) const override { out << "MOSDECSubOpWrite(" << pgid << " " << map_epoch << "/" << min_epoch << " " << op; out << ")"; } void clear_buffers() override { op.t = ObjectStore::Transaction(); op.log_entries.clear(); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,247
22.914894
80
h
null
ceph-main/src/messages/MOSDECSubOpWriteReply.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2013 Inktank Storage, Inc. * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef MOSDECSUBOPWRITEREPLY_H #define MOSDECSUBOPWRITEREPLY_H #include "MOSDFastDispatchOp.h" #include "osd/ECMsgTypes.h" class MOSDECSubOpWriteReply : public MOSDFastDispatchOp { private: static constexpr int HEAD_VERSION = 2; static constexpr int COMPAT_VERSION = 1; public: spg_t pgid; epoch_t map_epoch = 0, min_epoch = 0; ECSubWriteReply op; int get_cost() const override { return 0; } epoch_t get_map_epoch() const override { return map_epoch; } epoch_t get_min_epoch() const override { return min_epoch; } spg_t get_spg() const override { return pgid; } MOSDECSubOpWriteReply() : MOSDFastDispatchOp{MSG_OSD_EC_WRITE_REPLY, HEAD_VERSION, COMPAT_VERSION} {} void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(pgid, p); decode(map_epoch, p); decode(op, p); if (header.version >= 2) { decode(min_epoch, p); decode_trace(p); } else { min_epoch = map_epoch; } } void encode_payload(uint64_t features) override { using ceph::encode; encode(pgid, payload); encode(map_epoch, payload); encode(op, payload); encode(min_epoch, payload); encode_trace(payload, features); } std::string_view get_type_name() const override { return "MOSDECSubOpWriteReply"; } void print(std::ostream& out) const override { out << "MOSDECSubOpWriteReply(" << pgid << " " << map_epoch << "/" << min_epoch << " " << op; out << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,042
23.035294
85
h
null
ceph-main/src/messages/MOSDFailure.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDFAILURE_H #define CEPH_MOSDFAILURE_H #include "messages/PaxosServiceMessage.h" class MOSDFailure final : public PaxosServiceMessage { private: static constexpr int HEAD_VERSION = 4; static constexpr int COMPAT_VERSION = 4; public: enum { FLAG_ALIVE = 0, // use this on its own to mark as "I'm still alive" FLAG_FAILED = 1, // if set, failure; if not, recovery FLAG_IMMEDIATE = 2, // known failure, not a timeout }; uuid_d fsid; int32_t target_osd; entity_addrvec_t target_addrs; __u8 flags = 0; epoch_t epoch = 0; int32_t failed_for = 0; // known to be failed since at least this long MOSDFailure() : PaxosServiceMessage(MSG_OSD_FAILURE, 0, HEAD_VERSION) { } MOSDFailure(const uuid_d &fs, int osd, const entity_addrvec_t& av, int duration, epoch_t e) : PaxosServiceMessage(MSG_OSD_FAILURE, e, HEAD_VERSION, COMPAT_VERSION), fsid(fs), target_osd(osd), target_addrs(av), flags(FLAG_FAILED), epoch(e), failed_for(duration) { } MOSDFailure(const uuid_d &fs, int osd, const entity_addrvec_t& av, int duration, epoch_t e, __u8 extra_flags) : PaxosServiceMessage(MSG_OSD_FAILURE, e, HEAD_VERSION, COMPAT_VERSION), fsid(fs), target_osd(osd), target_addrs(av), flags(extra_flags), epoch(e), failed_for(duration) { } private: ~MOSDFailure() final {} public: int get_target_osd() { return target_osd; } const entity_addrvec_t& get_target_addrs() { return target_addrs; } bool if_osd_failed() const { return flags & FLAG_FAILED; } bool is_immediate() const { return flags & FLAG_IMMEDIATE; } epoch_t get_epoch() const { return epoch; } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(fsid, p); assert(header.version >= 4); decode(target_osd, p); decode(target_addrs, p); decode(epoch, p); decode(flags, p); decode(failed_for, p); } void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); assert(HAVE_FEATURE(features, SERVER_NAUTILUS)); header.version = HEAD_VERSION; header.compat_version = COMPAT_VERSION; encode(fsid, payload); encode(target_osd, payload, features); encode(target_addrs, payload, features); encode(epoch, payload); encode(flags, payload); encode(failed_for, payload); } std::string_view get_type_name() const override { return "osd_failure"; } void print(std::ostream& out) const override { out << "osd_failure(" << (if_osd_failed() ? "failed " : "recovered ") << (is_immediate() ? "immediate " : "timeout ") << "osd." << target_osd << " " << target_addrs << " for " << failed_for << "sec e" << epoch << " v" << version << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
3,391
28.495652
76
h
null
ceph-main/src/messages/MOSDFastDispatchOp.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #ifndef CEPH_MOSDFASTDISPATCHOP_H #define CEPH_MOSDFASTDISPATCHOP_H #include "msg/Message.h" #include "osd/osd_types.h" class MOSDFastDispatchOp : public Message { public: MOSDFastDispatchOp(int t, int version, int compat_version) : Message{t, version, compat_version} {} virtual epoch_t get_map_epoch() const = 0; virtual epoch_t get_min_epoch() const { return get_map_epoch(); } virtual spg_t get_spg() const = 0; }; #endif
548
22.869565
70
h
null
ceph-main/src/messages/MOSDForceRecovery.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2017 OVH * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDFORCERECOVERY_H #define CEPH_MOSDFORCERECOVERY_H #include "msg/Message.h" /* * instruct an OSD to boost/unboost recovery/backfill priority of some or all pg(s) */ // boost priority of recovery static const int OFR_RECOVERY = 1; // boost priority of backfill static const int OFR_BACKFILL = 2; // cancel priority boost, requeue if necessary static const int OFR_CANCEL = 4; class MOSDForceRecovery final : public Message { public: static constexpr int HEAD_VERSION = 2; static constexpr int COMPAT_VERSION = 2; uuid_d fsid; std::vector<spg_t> forced_pgs; uint8_t options = 0; MOSDForceRecovery() : Message{MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION} {} MOSDForceRecovery(const uuid_d& f, char opts) : Message{MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION}, fsid(f), options(opts) {} MOSDForceRecovery(const uuid_d& f, std::vector<spg_t>& pgs, char opts) : Message{MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION}, fsid(f), forced_pgs(pgs), options(opts) {} private: ~MOSDForceRecovery() final {} public: std::string_view get_type_name() const { return "force_recovery"; } void print(std::ostream& out) const { out << "force_recovery("; if (forced_pgs.empty()) out << "osd"; else out << forced_pgs; if (options & OFR_RECOVERY) out << " recovery"; if (options & OFR_BACKFILL) out << " backfill"; if (options & OFR_CANCEL) out << " cancel"; out << ")"; } void encode_payload(uint64_t features) { using ceph::encode; if (!HAVE_FEATURE(features, SERVER_MIMIC)) { header.version = 1; header.compat_version = 1; std::vector<pg_t> pgs; for (auto pgid : forced_pgs) { pgs.push_back(pgid.pgid); } encode(fsid, payload); encode(pgs, payload); encode(options, payload); return; } header.version = HEAD_VERSION; header.compat_version = COMPAT_VERSION; encode(fsid, payload); encode(forced_pgs, payload); encode(options, payload); } void decode_payload() { using ceph::decode; auto p = payload.cbegin(); if (header.version == 1) { std::vector<pg_t> pgs; decode(fsid, p); decode(pgs, p); decode(options, p); for (auto pg : pgs) { // note: this only works with replicated pools. if a pre-mimic mon // tries to force a mimic+ osd on an ec pool it will not work. forced_pgs.push_back(spg_t(pg)); } return; } decode(fsid, p); decode(forced_pgs, p); decode(options, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif /* CEPH_MOSDFORCERECOVERY_H_ */
3,127
26.2
88
h
null
ceph-main/src/messages/MOSDFull.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #ifndef CEPH_MOSDFULL_H #define CEPH_MOSDFULL_H #include "messages/PaxosServiceMessage.h" #include "osd/OSDMap.h" // tell the mon to update the full/nearfull bits. note that in the // future this message could be generalized to other state bits, but // for now name it for its sole application. class MOSDFull final : public PaxosServiceMessage { public: epoch_t map_epoch = 0; uint32_t state = 0; private: ~MOSDFull() final {} public: MOSDFull(epoch_t e, unsigned s) : PaxosServiceMessage{MSG_OSD_FULL, e}, map_epoch(e), state(s) { } MOSDFull() : PaxosServiceMessage{MSG_OSD_FULL, 0} {} public: void encode_payload(uint64_t features) { using ceph::encode; paxos_encode(); encode(map_epoch, payload); encode(state, payload); } void decode_payload() { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(map_epoch, p); decode(state, p); } std::string_view get_type_name() const { return "osd_full"; } void print(std::ostream &out) const { std::set<std::string> states; OSDMap::calc_state_set(state, states); out << "osd_full(e" << map_epoch << " " << states << " v" << version << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
1,419
24.818182
80
h
null
ceph-main/src/messages/MOSDMap.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDMAP_H #define CEPH_MOSDMAP_H #include "msg/Message.h" #include "osd/OSDMap.h" #include "include/ceph_features.h" class MOSDMap final : public Message { private: static constexpr int HEAD_VERSION = 4; static constexpr int COMPAT_VERSION = 3; public: uuid_d fsid; uint64_t encode_features = 0; std::map<epoch_t, ceph::buffer::list> maps; std::map<epoch_t, ceph::buffer::list> incremental_maps; /** * cluster_osdmap_trim_lower_bound * * Encodes a lower bound on the monitor's osdmap trim bound. Recipients * can safely trim up to this bound. The sender stores maps back to * cluster_osdmap_trim_lower_bound. * * This field was formerly named oldest_map and encoded the oldest map * stored by the sender. The primary usage of this field, however, was to * allow the recipient to trim. The secondary usage was to inform the * recipient of how many maps the sender stored in case it needed to request * more. For both purposes, it should be safe for an older OSD to interpret * this field as oldest_map, and it should be safe for a new osd to interpret * the oldest_map field sent by an older osd as * cluster_osdmap_trim_lower_bound. * See bug https://tracker.ceph.com/issues/49689 */ epoch_t cluster_osdmap_trim_lower_bound = 0; epoch_t newest_map = 0; epoch_t get_first() const { epoch_t e = 0; auto i = maps.cbegin(); if (i != maps.cend()) e = i->first; i = incremental_maps.begin(); if (i != incremental_maps.end() && (e == 0 || i->first < e)) e = i->first; return e; } epoch_t get_last() const { epoch_t e = 0; auto i = maps.crbegin(); if (i != maps.crend()) e = i->first; i = incremental_maps.rbegin(); if (i != incremental_maps.rend() && (e == 0 || i->first > e)) e = i->first; return e; } MOSDMap() : Message{CEPH_MSG_OSD_MAP, HEAD_VERSION, COMPAT_VERSION} { } MOSDMap(const uuid_d &f, const uint64_t features) : Message{CEPH_MSG_OSD_MAP, HEAD_VERSION, COMPAT_VERSION}, fsid(f), encode_features(features), cluster_osdmap_trim_lower_bound(0), newest_map(0) { } private: ~MOSDMap() final {} public: // marshalling void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(fsid, p); decode(incremental_maps, p); decode(maps, p); if (header.version >= 2) { decode(cluster_osdmap_trim_lower_bound, p); decode(newest_map, p); } else { cluster_osdmap_trim_lower_bound = 0; newest_map = 0; } if (header.version >= 4) { // removed in octopus mempool::osdmap::map<int64_t,snap_interval_set_t> gap_removed_snaps; decode(gap_removed_snaps, p); } } void encode_payload(uint64_t features) override { using ceph::encode; header.version = HEAD_VERSION; header.compat_version = COMPAT_VERSION; encode(fsid, payload); if (OSDMap::get_significant_features(encode_features) != OSDMap::get_significant_features(features)) { if ((features & CEPH_FEATURE_PGID64) == 0 || (features & CEPH_FEATURE_PGPOOL3) == 0) { header.version = 1; // old old_client version header.compat_version = 1; } else if ((features & CEPH_FEATURE_OSDENC) == 0) { header.version = 2; // old pg_pool_t header.compat_version = 2; } // reencode maps using old format // // FIXME: this can probably be done more efficiently higher up // the stack, or maybe replaced with something that only // includes the pools the client cares about. for (auto p = incremental_maps.begin(); p != incremental_maps.end(); ++p) { OSDMap::Incremental inc; auto q = p->second.cbegin(); inc.decode(q); // always encode with subset of osdmaps canonical features uint64_t f = inc.encode_features & features; p->second.clear(); if (inc.fullmap.length()) { // embedded full std::map? OSDMap m; m.decode(inc.fullmap); inc.fullmap.clear(); m.encode(inc.fullmap, f | CEPH_FEATURE_RESERVED); } if (inc.crush.length()) { // embedded crush std::map CrushWrapper c; auto p = inc.crush.cbegin(); c.decode(p); inc.crush.clear(); c.encode(inc.crush, f); } inc.encode(p->second, f | CEPH_FEATURE_RESERVED); } for (auto p = maps.begin(); p != maps.end(); ++p) { OSDMap m; m.decode(p->second); // always encode with subset of osdmaps canonical features uint64_t f = m.get_encoding_features() & features; p->second.clear(); m.encode(p->second, f | CEPH_FEATURE_RESERVED); } } encode(incremental_maps, payload); encode(maps, payload); if (header.version >= 2) { encode(cluster_osdmap_trim_lower_bound, payload); encode(newest_map, payload); } if (header.version >= 4) { encode((uint32_t)0, payload); } } std::string_view get_type_name() const override { return "osdmap"; } void print(std::ostream& out) const override { out << "osd_map(" << get_first() << ".." << get_last(); if (cluster_osdmap_trim_lower_bound || newest_map) out << " src has " << cluster_osdmap_trim_lower_bound << ".." << newest_map; out << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
5,746
31.106145
81
h
null
ceph-main/src/messages/MOSDMarkMeDead.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #pragma once #include "messages/PaxosServiceMessage.h" class MOSDMarkMeDead final : public PaxosServiceMessage { private: static constexpr int HEAD_VERSION = 1; static constexpr int COMPAT_VERSION = 1; public: uuid_d fsid; int32_t target_osd; epoch_t epoch = 0; MOSDMarkMeDead() : PaxosServiceMessage{MSG_OSD_MARK_ME_DEAD, 0, HEAD_VERSION, COMPAT_VERSION} { } MOSDMarkMeDead(const uuid_d &fs, int osd, epoch_t e) : PaxosServiceMessage{MSG_OSD_MARK_ME_DEAD, e, HEAD_VERSION, COMPAT_VERSION}, fsid(fs), target_osd(osd), epoch(e) {} private: ~MOSDMarkMeDead() final {} public: epoch_t get_epoch() const { return epoch; } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(fsid, p); decode(target_osd, p); decode(epoch, p); } void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); header.version = HEAD_VERSION; header.compat_version = COMPAT_VERSION; encode(fsid, payload); encode(target_osd, payload, features); encode(epoch, payload); } std::string_view get_type_name() const override { return "MOSDMarkMeDead"; } void print(std::ostream& out) const override { out << "MOSDMarkMeDead(" << "osd." << target_osd << ", epoch " << epoch << ", fsid=" << fsid << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); };
1,600
24.015625
78
h
null
ceph-main/src/messages/MOSDMarkMeDown.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2013 Inktank Storage, Inc. * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDMARKMEDOWN_H #define CEPH_MOSDMARKMEDOWN_H #include "messages/PaxosServiceMessage.h" class MOSDMarkMeDown final : public PaxosServiceMessage { private: static constexpr int HEAD_VERSION = 4; static constexpr int COMPAT_VERSION = 3; public: uuid_d fsid; int32_t target_osd; entity_addrvec_t target_addrs; epoch_t epoch = 0; bool request_ack = false; // ack requested bool down_and_dead = false; // mark down and dead MOSDMarkMeDown() : PaxosServiceMessage{MSG_OSD_MARK_ME_DOWN, 0, HEAD_VERSION, COMPAT_VERSION} { } MOSDMarkMeDown(const uuid_d &fs, int osd, const entity_addrvec_t& av, epoch_t e, bool request_ack) : PaxosServiceMessage{MSG_OSD_MARK_ME_DOWN, e, HEAD_VERSION, COMPAT_VERSION}, fsid(fs), target_osd(osd), target_addrs(av), epoch(e), request_ack(request_ack) {} MOSDMarkMeDown(const uuid_d &fs, int osd, const entity_addrvec_t& av, epoch_t e, bool request_ack, bool down_and_dead) : PaxosServiceMessage{MSG_OSD_MARK_ME_DOWN, e, HEAD_VERSION, COMPAT_VERSION}, fsid(fs), target_osd(osd), target_addrs(av), epoch(e), request_ack(request_ack), down_and_dead(down_and_dead) {} private: ~MOSDMarkMeDown() final {} public: epoch_t get_epoch() const { return epoch; } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); assert(header.version >= 3); decode(fsid, p); decode(target_osd, p); decode(target_addrs, p); decode(epoch, p); decode(request_ack, p); if(header.version >= 4) decode(down_and_dead, p); } void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); assert(HAVE_FEATURE(features, SERVER_NAUTILUS)); header.version = HEAD_VERSION; header.compat_version = COMPAT_VERSION; encode(fsid, payload); encode(target_osd, payload, features); encode(target_addrs, payload, features); encode(epoch, payload); encode(request_ack, payload); encode(down_and_dead, payload); } std::string_view get_type_name() const override { return "MOSDMarkMeDown"; } void print(std::ostream& out) const override { out << "MOSDMarkMeDown(" << "request_ack=" << request_ack << ", down_and_dead=" << down_and_dead << ", osd." << target_osd << ", " << target_addrs << ", fsid=" << fsid << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,937
28.979592
78
h
null
ceph-main/src/messages/MOSDOp.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDOP_H #define CEPH_MOSDOP_H #include <atomic> #include "MOSDFastDispatchOp.h" #include "include/ceph_features.h" #include "common/hobject.h" /* * OSD op * * oid - object id * op - OSD_OP_DELETE, etc. * */ class MOSDOpReply; namespace _mosdop { template<typename V> class MOSDOp final : public MOSDFastDispatchOp { private: static constexpr int HEAD_VERSION = 8; static constexpr int COMPAT_VERSION = 3; private: uint32_t client_inc = 0; __u32 osdmap_epoch = 0; __u32 flags = 0; utime_t mtime; int32_t retry_attempt = -1; // 0 is first attempt. -1 if we don't know. hobject_t hobj; spg_t pgid; ceph::buffer::list::const_iterator p; // Decoding flags. Decoding is only needed for messages caught by pipe reader. // Transition from true -> false without locks being held // Can never see final_decode_needed == false and partial_decode_needed == true std::atomic<bool> partial_decode_needed; std::atomic<bool> final_decode_needed; // public: V ops; private: snapid_t snap_seq; std::vector<snapid_t> snaps; uint64_t features; bool bdata_encode; osd_reqid_t reqid; // reqid explicitly set by sender public: friend MOSDOpReply; ceph_tid_t get_client_tid() { return header.tid; } void set_snapid(const snapid_t& s) { hobj.snap = s; } void set_snaps(const std::vector<snapid_t>& i) { snaps = i; } void set_snap_seq(const snapid_t& s) { snap_seq = s; } void set_reqid(const osd_reqid_t rid) { reqid = rid; } void set_spg(spg_t p) { pgid = p; } // Fields decoded in partial decoding pg_t get_pg() const { ceph_assert(!partial_decode_needed); return pgid.pgid; } spg_t get_spg() const override { ceph_assert(!partial_decode_needed); return pgid; } pg_t get_raw_pg() const { ceph_assert(!partial_decode_needed); return pg_t(hobj.get_hash(), pgid.pgid.pool()); } epoch_t get_map_epoch() const override { ceph_assert(!partial_decode_needed); return osdmap_epoch; } int get_flags() const { ceph_assert(!partial_decode_needed); return flags; } osd_reqid_t get_reqid() const { ceph_assert(!partial_decode_needed); if (reqid.name != entity_name_t() || reqid.tid != 0) { return reqid; } else { if (!final_decode_needed) ceph_assert(reqid.inc == (int32_t)client_inc); // decode() should have done this return osd_reqid_t(get_orig_source(), reqid.inc, header.tid); } } // Fields decoded in final decoding int get_client_inc() const { ceph_assert(!final_decode_needed); return client_inc; } utime_t get_mtime() const { ceph_assert(!final_decode_needed); return mtime; } object_locator_t get_object_locator() const { ceph_assert(!final_decode_needed); if (hobj.oid.name.empty()) return object_locator_t(hobj.pool, hobj.nspace, hobj.get_hash()); else return object_locator_t(hobj); } const object_t& get_oid() const { ceph_assert(!final_decode_needed); return hobj.oid; } const hobject_t &get_hobj() const { return hobj; } snapid_t get_snapid() const { ceph_assert(!final_decode_needed); return hobj.snap; } const snapid_t& get_snap_seq() const { ceph_assert(!final_decode_needed); return snap_seq; } const std::vector<snapid_t> &get_snaps() const { ceph_assert(!final_decode_needed); return snaps; } /** * get retry attempt * * 0 is the first attempt. * * @return retry attempt, or -1 if we don't know */ int get_retry_attempt() const { return retry_attempt; } uint64_t get_features() const { if (features) return features; #ifdef WITH_SEASTAR ceph_abort("In crimson, conn is independently maintained outside Message"); #else return get_connection()->get_features(); #endif } MOSDOp() : MOSDFastDispatchOp(CEPH_MSG_OSD_OP, HEAD_VERSION, COMPAT_VERSION), partial_decode_needed(true), final_decode_needed(true), bdata_encode(false) { } MOSDOp(int inc, long tid, const hobject_t& ho, spg_t& _pgid, epoch_t _osdmap_epoch, int _flags, uint64_t feat) : MOSDFastDispatchOp(CEPH_MSG_OSD_OP, HEAD_VERSION, COMPAT_VERSION), client_inc(inc), osdmap_epoch(_osdmap_epoch), flags(_flags), retry_attempt(-1), hobj(ho), pgid(_pgid), partial_decode_needed(false), final_decode_needed(false), features(feat), bdata_encode(false) { set_tid(tid); // also put the client_inc in reqid.inc, so that get_reqid() can // be used before the full message is decoded. reqid.inc = inc; } private: ~MOSDOp() final {} public: void set_mtime(utime_t mt) { mtime = mt; } void set_mtime(ceph::real_time mt) { mtime = ceph::real_clock::to_timespec(mt); } // ops void add_simple_op(int o, uint64_t off, uint64_t len) { OSDOp osd_op; osd_op.op.op = o; osd_op.op.extent.offset = off; osd_op.op.extent.length = len; ops.push_back(osd_op); } void write(uint64_t off, uint64_t len, ceph::buffer::list& bl) { add_simple_op(CEPH_OSD_OP_WRITE, off, len); data = std::move(bl); header.data_off = off; } void writefull(ceph::buffer::list& bl) { add_simple_op(CEPH_OSD_OP_WRITEFULL, 0, bl.length()); data = std::move(bl); header.data_off = 0; } void zero(uint64_t off, uint64_t len) { add_simple_op(CEPH_OSD_OP_ZERO, off, len); } void truncate(uint64_t off) { add_simple_op(CEPH_OSD_OP_TRUNCATE, off, 0); } void remove() { add_simple_op(CEPH_OSD_OP_DELETE, 0, 0); } void read(uint64_t off, uint64_t len) { add_simple_op(CEPH_OSD_OP_READ, off, len); } void stat() { add_simple_op(CEPH_OSD_OP_STAT, 0, 0); } bool has_flag(__u32 flag) const { return flags & flag; }; bool is_retry_attempt() const { return flags & CEPH_OSD_FLAG_RETRY; } void set_retry_attempt(unsigned a) { if (a) flags |= CEPH_OSD_FLAG_RETRY; else flags &= ~CEPH_OSD_FLAG_RETRY; retry_attempt = a; } // marshalling void encode_payload(uint64_t features) override { using ceph::encode; if( false == bdata_encode ) { OSDOp::merge_osd_op_vector_in_data(ops, data); bdata_encode = true; } if ((features & CEPH_FEATURE_OBJECTLOCATOR) == 0) { // here is the old structure we are encoding to: // #if 0 struct ceph_osd_request_head { ceph_le32 client_inc; /* client incarnation */ struct ceph_object_layout layout; /* pgid */ ceph_le32 osdmap_epoch; /* client's osdmap epoch */ ceph_le32 flags; struct ceph_timespec mtime; /* for mutations only */ struct ceph_eversion reassert_version; /* if we are replaying op */ ceph_le32 object_len; /* length of object name */ ceph_le64 snapid; /* snapid to read */ ceph_le64 snap_seq; /* writer's snap context */ ceph_le32 num_snaps; ceph_le16 num_ops; struct ceph_osd_op ops[]; /* followed by ops[], obj, ticket, snaps */ } __attribute__ ((packed)); #endif header.version = 1; encode(client_inc, payload); __u32 su = 0; encode(get_raw_pg(), payload); encode(su, payload); encode(osdmap_epoch, payload); encode(flags, payload); encode(mtime, payload); encode(eversion_t(), payload); // reassert_version __u32 oid_len = hobj.oid.name.length(); encode(oid_len, payload); encode(hobj.snap, payload); encode(snap_seq, payload); __u32 num_snaps = snaps.size(); encode(num_snaps, payload); //::encode(ops, payload); __u16 num_ops = ops.size(); encode(num_ops, payload); for (unsigned i = 0; i < ops.size(); i++) encode(ops[i].op, payload); ceph::encode_nohead(hobj.oid.name, payload); ceph::encode_nohead(snaps, payload); } else if ((features & CEPH_FEATURE_NEW_OSDOP_ENCODING) == 0) { header.version = 6; encode(client_inc, payload); encode(osdmap_epoch, payload); encode(flags, payload); encode(mtime, payload); encode(eversion_t(), payload); // reassert_version encode(get_object_locator(), payload); encode(get_raw_pg(), payload); encode(hobj.oid, payload); __u16 num_ops = ops.size(); encode(num_ops, payload); for (unsigned i = 0; i < ops.size(); i++) encode(ops[i].op, payload); encode(hobj.snap, payload); encode(snap_seq, payload); encode(snaps, payload); encode(retry_attempt, payload); encode(features, payload); if (reqid.name != entity_name_t() || reqid.tid != 0) { encode(reqid, payload); } else { // don't include client_inc in the reqid for the legacy v6 // encoding or else we'll confuse older peers. encode(osd_reqid_t(), payload); } } else if (!HAVE_FEATURE(features, RESEND_ON_SPLIT)) { // reordered, v7 message encoding header.version = 7; encode(get_raw_pg(), payload); encode(osdmap_epoch, payload); encode(flags, payload); encode(eversion_t(), payload); // reassert_version encode(reqid, payload); encode(client_inc, payload); encode(mtime, payload); encode(get_object_locator(), payload); encode(hobj.oid, payload); __u16 num_ops = ops.size(); encode(num_ops, payload); for (unsigned i = 0; i < ops.size(); i++) encode(ops[i].op, payload); encode(hobj.snap, payload); encode(snap_seq, payload); encode(snaps, payload); encode(retry_attempt, payload); encode(features, payload); } else { // latest v8 encoding with hobject_t hash separate from pgid, no // reassert version header.version = HEAD_VERSION; encode(pgid, payload); encode(hobj.get_hash(), payload); encode(osdmap_epoch, payload); encode(flags, payload); encode(reqid, payload); encode_trace(payload, features); // -- above decoded up front; below decoded post-dispatch thread -- encode(client_inc, payload); encode(mtime, payload); encode(get_object_locator(), payload); encode(hobj.oid, payload); __u16 num_ops = ops.size(); encode(num_ops, payload); for (unsigned i = 0; i < ops.size(); i++) encode(ops[i].op, payload); encode(hobj.snap, payload); encode(snap_seq, payload); encode(snaps, payload); encode(retry_attempt, payload); encode(features, payload); } } void decode_payload() override { using ceph::decode; ceph_assert(partial_decode_needed && final_decode_needed); p = std::cbegin(payload); // Always keep here the newest version of decoding order/rule if (header.version == HEAD_VERSION) { decode(pgid, p); // actual pgid uint32_t hash; decode(hash, p); // raw hash value hobj.set_hash(hash); decode(osdmap_epoch, p); decode(flags, p); decode(reqid, p); decode_trace(p); } else if (header.version == 7) { decode(pgid.pgid, p); // raw pgid hobj.set_hash(pgid.pgid.ps()); decode(osdmap_epoch, p); decode(flags, p); eversion_t reassert_version; decode(reassert_version, p); decode(reqid, p); } else if (header.version < 2) { // old decode decode(client_inc, p); old_pg_t opgid; ceph::decode_raw(opgid, p); pgid.pgid = opgid; __u32 su; decode(su, p); decode(osdmap_epoch, p); decode(flags, p); decode(mtime, p); eversion_t reassert_version; decode(reassert_version, p); __u32 oid_len; decode(oid_len, p); decode(hobj.snap, p); decode(snap_seq, p); __u32 num_snaps; decode(num_snaps, p); //::decode(ops, p); __u16 num_ops; decode(num_ops, p); ops.resize(num_ops); for (unsigned i = 0; i < num_ops; i++) decode(ops[i].op, p); ceph::decode_nohead(oid_len, hobj.oid.name, p); ceph::decode_nohead(num_snaps, snaps, p); // recalculate pgid hash value pgid.pgid.set_ps(ceph_str_hash(CEPH_STR_HASH_RJENKINS, hobj.oid.name.c_str(), hobj.oid.name.length())); hobj.pool = pgid.pgid.pool(); hobj.set_hash(pgid.pgid.ps()); retry_attempt = -1; features = 0; OSDOp::split_osd_op_vector_in_data(ops, data); // we did the full decode final_decode_needed = false; // put client_inc in reqid.inc for get_reqid()'s benefit reqid = osd_reqid_t(); reqid.inc = client_inc; } else if (header.version < 7) { decode(client_inc, p); decode(osdmap_epoch, p); decode(flags, p); decode(mtime, p); eversion_t reassert_version; decode(reassert_version, p); object_locator_t oloc; decode(oloc, p); if (header.version < 3) { old_pg_t opgid; ceph::decode_raw(opgid, p); pgid.pgid = opgid; } else { decode(pgid.pgid, p); } decode(hobj.oid, p); //::decode(ops, p); __u16 num_ops; decode(num_ops, p); ops.resize(num_ops); for (unsigned i = 0; i < num_ops; i++) decode(ops[i].op, p); decode(hobj.snap, p); decode(snap_seq, p); decode(snaps, p); if (header.version >= 4) decode(retry_attempt, p); else retry_attempt = -1; if (header.version >= 5) decode(features, p); else features = 0; if (header.version >= 6) decode(reqid, p); else reqid = osd_reqid_t(); hobj.pool = pgid.pgid.pool(); hobj.set_key(oloc.key); hobj.nspace = oloc.nspace; hobj.set_hash(pgid.pgid.ps()); OSDOp::split_osd_op_vector_in_data(ops, data); // we did the full decode final_decode_needed = false; // put client_inc in reqid.inc for get_reqid()'s benefit if (reqid.name == entity_name_t() && reqid.tid == 0) reqid.inc = client_inc; } partial_decode_needed = false; } bool finish_decode() { using ceph::decode; ceph_assert(!partial_decode_needed); // partial decoding required if (!final_decode_needed) return false; // Message is already final decoded ceph_assert(header.version >= 7); decode(client_inc, p); decode(mtime, p); object_locator_t oloc; decode(oloc, p); decode(hobj.oid, p); __u16 num_ops; decode(num_ops, p); ops.resize(num_ops); for (unsigned i = 0; i < num_ops; i++) decode(ops[i].op, p); decode(hobj.snap, p); decode(snap_seq, p); decode(snaps, p); decode(retry_attempt, p); decode(features, p); hobj.pool = pgid.pgid.pool(); hobj.set_key(oloc.key); hobj.nspace = oloc.nspace; OSDOp::split_osd_op_vector_in_data(ops, data); final_decode_needed = false; return true; } void clear_buffers() override { OSDOp::clear_data(ops); bdata_encode = false; } std::string_view get_type_name() const override { return "osd_op"; } void print(std::ostream& out) const override { out << "osd_op("; if (!partial_decode_needed) { out << get_reqid() << ' '; out << pgid; if (!final_decode_needed) { out << ' '; out << hobj << " " << ops << " snapc " << get_snap_seq() << "=" << snaps; if (is_retry_attempt()) out << " RETRY=" << get_retry_attempt(); } else { out << " " << get_raw_pg() << " (undecoded)"; } out << " " << ceph_osd_flag_string(get_flags()); out << " e" << osdmap_epoch; } out << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; } using MOSDOp = _mosdop::MOSDOp<std::vector<OSDOp>>; #endif
16,164
25.37031
82
h
null
ceph-main/src/messages/MOSDOpReply.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDOPREPLY_H #define CEPH_MOSDOPREPLY_H #include "msg/Message.h" #include "MOSDOp.h" #include "common/errno.h" /* * OSD op reply * * oid - object id * op - OSD_OP_DELETE, etc. * */ class MOSDOpReply final : public Message { private: static constexpr int HEAD_VERSION = 8; static constexpr int COMPAT_VERSION = 2; object_t oid; pg_t pgid; std::vector<OSDOp> ops; bool bdata_encode; int64_t flags = 0; errorcode32_t result; eversion_t bad_replay_version; eversion_t replay_version; version_t user_version = 0; epoch_t osdmap_epoch = 0; int32_t retry_attempt = -1; bool do_redirect; request_redirect_t redirect; public: const object_t& get_oid() const { return oid; } const pg_t& get_pg() const { return pgid; } int get_flags() const { return flags; } bool is_ondisk() const { return get_flags() & CEPH_OSD_FLAG_ONDISK; } bool is_onnvram() const { return get_flags() & CEPH_OSD_FLAG_ONNVRAM; } int get_result() const { return result; } const eversion_t& get_replay_version() const { return replay_version; } const version_t& get_user_version() const { return user_version; } void set_result(int r) { result = r; } void set_reply_versions(eversion_t v, version_t uv) { replay_version = v; user_version = uv; /* We go through some shenanigans here for backwards compatibility * with old clients, who do not look at our replay_version and * user_version but instead see what we now call the * bad_replay_version. On pools without caching * the user_version infrastructure is a slightly-laggy copy of * the regular pg version/at_version infrastructure; the difference * being it is not updated on watch ops like that is -- but on updates * it is set equal to at_version. This means that for non-watch write ops * on classic pools, all three of replay_version, user_version, and * bad_replay_version are identical. But for watch ops the replay_version * has been updated, while the user_at_version has not, and the semantics * we promised old clients are that the version they see is not an update. * So set the bad_replay_version to be the same as the user_at_version. */ bad_replay_version = v; if (uv) { bad_replay_version.version = uv; } } /* Don't fill in replay_version for non-write ops */ void set_enoent_reply_versions(const eversion_t& v, const version_t& uv) { user_version = uv; bad_replay_version = v; } void set_redirect(const request_redirect_t& redir) { redirect = redir; } const request_redirect_t& get_redirect() const { return redirect; } bool is_redirect_reply() const { return do_redirect; } void add_flags(int f) { flags |= f; } void claim_op_out_data(std::vector<OSDOp>& o) { ceph_assert(ops.size() == o.size()); for (unsigned i = 0; i < o.size(); i++) { ops[i].outdata = std::move(o[i].outdata); } } void claim_ops(std::vector<OSDOp>& o) { o.swap(ops); bdata_encode = false; } void set_op_returns(const std::vector<pg_log_op_return_item_t>& op_returns) { if (op_returns.size()) { ceph_assert(ops.empty() || ops.size() == op_returns.size()); ops.resize(op_returns.size()); for (unsigned i = 0; i < op_returns.size(); ++i) { ops[i].rval = op_returns[i].rval; ops[i].outdata = op_returns[i].bl; } } } /** * get retry attempt * * If we don't know the attempt (because the server is old), return -1. */ int get_retry_attempt() const { return retry_attempt; } // osdmap epoch_t get_map_epoch() const { return osdmap_epoch; } /*osd_reqid_t get_reqid() { return osd_reqid_t(get_dest(), head.client_inc, head.tid); } */ public: MOSDOpReply() : Message{CEPH_MSG_OSD_OPREPLY, HEAD_VERSION, COMPAT_VERSION}, bdata_encode(false) { do_redirect = false; } MOSDOpReply(const MOSDOp *req, int r, epoch_t e, int acktype, bool ignore_out_data) : Message{CEPH_MSG_OSD_OPREPLY, HEAD_VERSION, COMPAT_VERSION}, oid(req->hobj.oid), pgid(req->pgid.pgid), ops(req->ops), bdata_encode(false) { set_tid(req->get_tid()); result = r; flags = (req->flags & ~(CEPH_OSD_FLAG_ONDISK|CEPH_OSD_FLAG_ONNVRAM|CEPH_OSD_FLAG_ACK)) | acktype; osdmap_epoch = e; user_version = 0; retry_attempt = req->get_retry_attempt(); do_redirect = false; for (unsigned i = 0; i < ops.size(); i++) { // zero out input data ops[i].indata.clear(); if (ignore_out_data) { // original request didn't set the RETURNVEC flag ops[i].outdata.clear(); } } } private: ~MOSDOpReply() final {} public: void encode_payload(uint64_t features) override { using ceph::encode; if(false == bdata_encode) { OSDOp::merge_osd_op_vector_out_data(ops, data); bdata_encode = true; } if ((features & CEPH_FEATURE_PGID64) == 0) { header.version = 1; ceph_osd_reply_head head; memset(&head, 0, sizeof(head)); head.layout.ol_pgid = pgid.get_old_pg().v; head.flags = flags; head.osdmap_epoch = osdmap_epoch; head.reassert_version = bad_replay_version; head.result = result; head.num_ops = ops.size(); head.object_len = oid.name.length(); encode(head, payload); for (unsigned i = 0; i < head.num_ops; i++) { encode(ops[i].op, payload); } ceph::encode_nohead(oid.name, payload); } else { header.version = HEAD_VERSION; encode(oid, payload); encode(pgid, payload); encode(flags, payload); encode(result, payload); encode(bad_replay_version, payload); encode(osdmap_epoch, payload); __u32 num_ops = ops.size(); encode(num_ops, payload); for (unsigned i = 0; i < num_ops; i++) encode(ops[i].op, payload); encode(retry_attempt, payload); for (unsigned i = 0; i < num_ops; i++) encode(ops[i].rval, payload); encode(replay_version, payload); encode(user_version, payload); if ((features & CEPH_FEATURE_NEW_OSDOPREPLY_ENCODING) == 0) { header.version = 6; encode(redirect, payload); } else { do_redirect = !redirect.empty(); encode(do_redirect, payload); if (do_redirect) { encode(redirect, payload); } } encode_trace(payload, features); } } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); // Always keep here the newest version of decoding order/rule if (header.version == HEAD_VERSION) { decode(oid, p); decode(pgid, p); decode(flags, p); decode(result, p); decode(bad_replay_version, p); decode(osdmap_epoch, p); __u32 num_ops = ops.size(); decode(num_ops, p); ops.resize(num_ops); for (unsigned i = 0; i < num_ops; i++) decode(ops[i].op, p); decode(retry_attempt, p); for (unsigned i = 0; i < num_ops; ++i) decode(ops[i].rval, p); OSDOp::split_osd_op_vector_out_data(ops, data); decode(replay_version, p); decode(user_version, p); decode(do_redirect, p); if (do_redirect) decode(redirect, p); decode_trace(p); } else if (header.version < 2) { ceph_osd_reply_head head; decode(head, p); ops.resize(head.num_ops); for (unsigned i = 0; i < head.num_ops; i++) { decode(ops[i].op, p); } ceph::decode_nohead(head.object_len, oid.name, p); pgid = pg_t(head.layout.ol_pgid); result = (int32_t)head.result; flags = head.flags; replay_version = head.reassert_version; user_version = replay_version.version; osdmap_epoch = head.osdmap_epoch; retry_attempt = -1; } else { decode(oid, p); decode(pgid, p); decode(flags, p); decode(result, p); decode(bad_replay_version, p); decode(osdmap_epoch, p); __u32 num_ops = ops.size(); decode(num_ops, p); ops.resize(num_ops); for (unsigned i = 0; i < num_ops; i++) decode(ops[i].op, p); if (header.version >= 3) decode(retry_attempt, p); else retry_attempt = -1; if (header.version >= 4) { for (unsigned i = 0; i < num_ops; ++i) decode(ops[i].rval, p); OSDOp::split_osd_op_vector_out_data(ops, data); } if (header.version >= 5) { decode(replay_version, p); decode(user_version, p); } else { replay_version = bad_replay_version; user_version = replay_version.version; } if (header.version == 6) { decode(redirect, p); do_redirect = !redirect.empty(); } if (header.version >= 7) { decode(do_redirect, p); if (do_redirect) { decode(redirect, p); } } if (header.version >= 8) { decode_trace(p); } } } std::string_view get_type_name() const override { return "osd_op_reply"; } void print(std::ostream& out) const override { out << "osd_op_reply(" << get_tid() << " " << oid << " " << ops << " v" << get_replay_version() << " uv" << get_user_version(); if (is_ondisk()) out << " ondisk"; else if (is_onnvram()) out << " onnvram"; else out << " ack"; out << " = " << get_result(); if (get_result() < 0) { out << " (" << cpp_strerror(get_result()) << ")"; } if (is_redirect_reply()) { out << " redirect: { " << redirect << " }"; } out << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
10,058
27.415254
95
h
null
ceph-main/src/messages/MOSDPGBackfill.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDPGBACKFILL_H #define CEPH_MOSDPGBACKFILL_H #include "MOSDFastDispatchOp.h" class MOSDPGBackfill final : public MOSDFastDispatchOp { private: static constexpr int HEAD_VERSION = 3; static constexpr int COMPAT_VERSION = 3; public: enum { OP_BACKFILL_PROGRESS = 2, OP_BACKFILL_FINISH = 3, OP_BACKFILL_FINISH_ACK = 4, }; const char *get_op_name(int o) const { switch (o) { case OP_BACKFILL_PROGRESS: return "progress"; case OP_BACKFILL_FINISH: return "finish"; case OP_BACKFILL_FINISH_ACK: return "finish_ack"; default: return "???"; } } __u32 op = 0; epoch_t map_epoch = 0, query_epoch = 0; spg_t pgid; hobject_t last_backfill; pg_stat_t stats; epoch_t get_map_epoch() const override { return map_epoch; } epoch_t get_min_epoch() const override { return query_epoch; } spg_t get_spg() const override { return pgid; } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(op, p); decode(map_epoch, p); decode(query_epoch, p); decode(pgid.pgid, p); decode(last_backfill, p); // For compatibility with version 1 decode(stats.stats, p); decode(stats, p); // Handle hobject_t format change if (!last_backfill.is_max() && last_backfill.pool == -1) last_backfill.pool = pgid.pool(); decode(pgid.shard, p); } void encode_payload(uint64_t features) override { using ceph::encode; encode(op, payload); encode(map_epoch, payload); encode(query_epoch, payload); encode(pgid.pgid, payload); encode(last_backfill, payload); // For compatibility with version 1 encode(stats.stats, payload); encode(stats, payload); encode(pgid.shard, payload); } MOSDPGBackfill() : MOSDFastDispatchOp{MSG_OSD_PG_BACKFILL, HEAD_VERSION, COMPAT_VERSION} {} MOSDPGBackfill(__u32 o, epoch_t e, epoch_t qe, spg_t p) : MOSDFastDispatchOp{MSG_OSD_PG_BACKFILL, HEAD_VERSION, COMPAT_VERSION}, op(o), map_epoch(e), query_epoch(e), pgid(p) {} private: ~MOSDPGBackfill() final {} public: std::string_view get_type_name() const override { return "pg_backfill"; } void print(std::ostream& out) const override { out << "pg_backfill(" << get_op_name(op) << " " << pgid << " e " << map_epoch << "/" << query_epoch << " lb " << last_backfill << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,955
24.050847
78
h
null
ceph-main/src/messages/MOSDPGBackfillRemove.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2017 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDPGBACKFILLREMOVE_H #define CEPH_MOSDPGBACKFILLREMOVE_H #include "MOSDFastDispatchOp.h" /* * instruct non-primary to remove some objects during backfill */ class MOSDPGBackfillRemove final : public MOSDFastDispatchOp { public: static constexpr int HEAD_VERSION = 1; static constexpr int COMPAT_VERSION = 1; spg_t pgid; ///< target spg_t epoch_t map_epoch = 0; std::list<std::pair<hobject_t,eversion_t>> ls; ///< objects to remove epoch_t get_map_epoch() const override { return map_epoch; } spg_t get_spg() const override { return pgid; } MOSDPGBackfillRemove() : MOSDFastDispatchOp{MSG_OSD_PG_BACKFILL_REMOVE, HEAD_VERSION, COMPAT_VERSION} {} MOSDPGBackfillRemove(spg_t pgid, epoch_t map_epoch) : MOSDFastDispatchOp{MSG_OSD_PG_BACKFILL_REMOVE, HEAD_VERSION, COMPAT_VERSION}, pgid(pgid), map_epoch(map_epoch) {} private: ~MOSDPGBackfillRemove() final {} public: std::string_view get_type_name() const override { return "backfill_remove"; } void print(std::ostream& out) const override { out << "backfill_remove(" << pgid << " e" << map_epoch << " " << ls << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; encode(pgid, payload); encode(map_epoch, payload); encode(ls, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(pgid, p); decode(map_epoch, p); decode(ls, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,051
24.333333
79
h
null
ceph-main/src/messages/MOSDPGCreate2.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #pragma once #include "msg/Message.h" #include "osd/osd_types.h" /* * PGCreate2 - instruct an OSD to create some pgs */ class MOSDPGCreate2 final : public Message { public: static constexpr int HEAD_VERSION = 2; static constexpr int COMPAT_VERSION = 1; epoch_t epoch = 0; std::map<spg_t,std::pair<epoch_t,utime_t>> pgs; std::map<spg_t,std::pair<pg_history_t,PastIntervals>> pg_extra; MOSDPGCreate2() : Message{MSG_OSD_PG_CREATE2, HEAD_VERSION, COMPAT_VERSION} {} MOSDPGCreate2(epoch_t e) : Message{MSG_OSD_PG_CREATE2, HEAD_VERSION, COMPAT_VERSION}, epoch(e) { } private: ~MOSDPGCreate2() final {} public: std::string_view get_type_name() const override { return "pg_create2"; } void print(std::ostream& out) const override { out << "pg_create2(e" << epoch << " " << pgs << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; encode(epoch, payload); encode(pgs, payload); encode(pg_extra, payload); } void decode_payload() override { auto p = payload.cbegin(); using ceph::decode; decode(epoch, p); decode(pgs, p); if (header.version >= 2) { decode(pg_extra, p); } } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); };
1,418
23.894737
70
h
null
ceph-main/src/messages/MOSDPGCreated.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #pragma once #include "osd/osd_types.h" #include "messages/PaxosServiceMessage.h" class MOSDPGCreated : public PaxosServiceMessage { public: pg_t pgid; MOSDPGCreated() : PaxosServiceMessage{MSG_OSD_PG_CREATED, 0} {} MOSDPGCreated(pg_t pgid) : PaxosServiceMessage{MSG_OSD_PG_CREATED, 0}, pgid(pgid) {} std::string_view get_type_name() const override { return "pg_created"; } void print(std::ostream& out) const override { out << "osd_pg_created(" << pgid << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); encode(pgid, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(pgid, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); };
981
24.842105
74
h
null
ceph-main/src/messages/MOSDPGInfo.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDPGINFO_H #define CEPH_MOSDPGINFO_H #include "msg/Message.h" #include "osd/osd_types.h" class MOSDPGInfo final : public Message { private: static constexpr int HEAD_VERSION = 6; static constexpr int COMPAT_VERSION = 6; epoch_t epoch = 0; public: using pg_list_t = std::vector<pg_notify_t>; pg_list_t pg_list; epoch_t get_epoch() const { return epoch; } MOSDPGInfo() : MOSDPGInfo{0, {}} {} MOSDPGInfo(epoch_t mv) : MOSDPGInfo(mv, {}) {} MOSDPGInfo(epoch_t mv, pg_list_t&& l) : Message{MSG_OSD_PG_INFO, HEAD_VERSION, COMPAT_VERSION}, epoch{mv}, pg_list{std::move(l)} { set_priority(CEPH_MSG_PRIO_HIGH); } private: ~MOSDPGInfo() final {} public: std::string_view get_type_name() const override { return "pg_info"; } void print(std::ostream& out) const override { out << "pg_info("; for (auto i = pg_list.begin(); i != pg_list.end(); ++i) { if (i != pg_list.begin()) out << " "; out << *i; } out << " epoch " << epoch << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; header.version = HEAD_VERSION; encode(epoch, payload); assert(HAVE_FEATURE(features, SERVER_OCTOPUS)); encode(pg_list, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(epoch, p); decode(pg_list, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
1,980
22.305882
71
h
null
ceph-main/src/messages/MOSDPGInfo2.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #pragma once #include "messages/MOSDPeeringOp.h" #include "osd/PGPeeringEvent.h" class MOSDPGInfo2 final : public MOSDPeeringOp { private: static constexpr int HEAD_VERSION = 1; static constexpr int COMPAT_VERSION = 1; public: spg_t spgid; epoch_t epoch_sent; epoch_t min_epoch; pg_info_t info; std::optional<pg_lease_t> lease; std::optional<pg_lease_ack_t> lease_ack; spg_t get_spg() const override { return spgid; } epoch_t get_map_epoch() const override { return epoch_sent; } epoch_t get_min_epoch() const override { return min_epoch; } PGPeeringEvent *get_event() override { return new PGPeeringEvent( epoch_sent, min_epoch, MInfoRec( pg_shard_t(get_source().num(), info.pgid.shard), info, epoch_sent, lease, lease_ack)); } MOSDPGInfo2() : MOSDPeeringOp{MSG_OSD_PG_INFO2, HEAD_VERSION, COMPAT_VERSION} { set_priority(CEPH_MSG_PRIO_HIGH); } MOSDPGInfo2( spg_t s, pg_info_t q, epoch_t sent, epoch_t min, std::optional<pg_lease_t> l, std::optional<pg_lease_ack_t> la) : MOSDPeeringOp{MSG_OSD_PG_INFO2, HEAD_VERSION, COMPAT_VERSION}, spgid(s), epoch_sent(sent), min_epoch(min), info(q), lease(l), lease_ack(la) { set_priority(CEPH_MSG_PRIO_HIGH); } private: ~MOSDPGInfo2() final {} public: std::string_view get_type_name() const override { return "pg_info2"; } void inner_print(std::ostream& out) const override { out << spgid << " " << info; } void encode_payload(uint64_t features) override { using ceph::encode; encode(spgid, payload); encode(epoch_sent, payload); encode(min_epoch, payload); encode(info, payload); encode(lease, payload); encode(lease_ack, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(spgid, p); decode(epoch_sent, p); decode(min_epoch, p); decode(info, p); decode(lease, p); decode(lease_ack, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); };
2,246
21.69697
70
h
null
ceph-main/src/messages/MOSDPGLease.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #pragma once #include "msg/Message.h" #include "osd/osd_types.h" class MOSDPGLease final : public MOSDPeeringOp { private: static constexpr int HEAD_VERSION = 1; static constexpr int COMPAT_VERSION = 1; epoch_t epoch = 0; spg_t spgid; pg_lease_t lease; public: spg_t get_spg() const { return spgid; } epoch_t get_map_epoch() const { return epoch; } epoch_t get_min_epoch() const { return epoch; } PGPeeringEvent *get_event() override { return new PGPeeringEvent( epoch, epoch, MLease(epoch, get_source().num(), lease)); } MOSDPGLease() : MOSDPeeringOp{MSG_OSD_PG_LEASE, HEAD_VERSION, COMPAT_VERSION} {} MOSDPGLease(version_t mv, spg_t p, pg_lease_t lease) : MOSDPeeringOp{MSG_OSD_PG_LEASE, HEAD_VERSION, COMPAT_VERSION}, epoch(mv), spgid(p), lease(lease) { } private: ~MOSDPGLease() final {} public: std::string_view get_type_name() const override { return "pg_lease"; } void inner_print(std::ostream& out) const override { out << lease; } void encode_payload(uint64_t features) override { using ceph::encode; encode(epoch, payload); encode(spgid, payload); encode(lease, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(epoch, p); decode(spgid, p); decode(lease, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); };
1,589
22.043478
72
h
null
ceph-main/src/messages/MOSDPGLeaseAck.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #pragma once #include "msg/Message.h" #include "osd/osd_types.h" class MOSDPGLeaseAck final : public MOSDPeeringOp { private: static constexpr int HEAD_VERSION = 1; static constexpr int COMPAT_VERSION = 1; epoch_t epoch = 0; spg_t spgid; pg_lease_ack_t lease_ack; public: spg_t get_spg() const { return spgid; } epoch_t get_map_epoch() const { return epoch; } epoch_t get_min_epoch() const { return epoch; } PGPeeringEvent *get_event() override { return new PGPeeringEvent( epoch, epoch, MLeaseAck(epoch, get_source().num(), lease_ack)); } MOSDPGLeaseAck() : MOSDPeeringOp{MSG_OSD_PG_LEASE_ACK, HEAD_VERSION, COMPAT_VERSION} {} MOSDPGLeaseAck(version_t mv, spg_t p, pg_lease_ack_t lease_ack) : MOSDPeeringOp{MSG_OSD_PG_LEASE_ACK, HEAD_VERSION, COMPAT_VERSION}, epoch(mv), spgid(p), lease_ack(lease_ack) { } private: ~MOSDPGLeaseAck() final {} public: std::string_view get_type_name() const override { return "pg_lease_ack"; } void inner_print(std::ostream& out) const override { out << lease_ack; } void encode_payload(uint64_t features) override { using ceph::encode; encode(epoch, payload); encode(spgid, payload); encode(lease_ack, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(epoch, p); decode(spgid, p); decode(lease_ack, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); };
1,659
23.057971
76
h
null
ceph-main/src/messages/MOSDPGLog.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDPGLOG_H #define CEPH_MOSDPGLOG_H #include "messages/MOSDPeeringOp.h" #include "osd/PGPeeringEvent.h" class MOSDPGLog final : public MOSDPeeringOp { private: static constexpr int HEAD_VERSION = 6; static constexpr int COMPAT_VERSION = 6; epoch_t epoch = 0; /// query_epoch is the epoch of the query being responded to, or /// the current epoch if this is not being sent in response to a /// query. This allows the recipient to disregard responses to old /// queries. epoch_t query_epoch = 0; public: shard_id_t to; shard_id_t from; pg_info_t info; pg_log_t log; pg_missing_t missing; PastIntervals past_intervals; std::optional<pg_lease_t> lease; epoch_t get_epoch() const { return epoch; } spg_t get_pgid() const { return spg_t(info.pgid.pgid, to); } epoch_t get_query_epoch() const { return query_epoch; } spg_t get_spg() const override { return spg_t(info.pgid.pgid, to); } epoch_t get_map_epoch() const override { return epoch; } epoch_t get_min_epoch() const override { return query_epoch; } PGPeeringEvent *get_event() override { return new PGPeeringEvent( epoch, query_epoch, MLogRec(pg_shard_t(get_source().num(), from), this), true, new PGCreateInfo( get_spg(), query_epoch, info.history, past_intervals, false)); } MOSDPGLog() : MOSDPeeringOp{MSG_OSD_PG_LOG, HEAD_VERSION, COMPAT_VERSION} { set_priority(CEPH_MSG_PRIO_HIGH); } MOSDPGLog(shard_id_t to, shard_id_t from, version_t mv, const pg_info_t& i, epoch_t query_epoch) : MOSDPeeringOp{MSG_OSD_PG_LOG, HEAD_VERSION, COMPAT_VERSION}, epoch(mv), query_epoch(query_epoch), to(to), from(from), info(i) { set_priority(CEPH_MSG_PRIO_HIGH); } private: ~MOSDPGLog() final {} public: std::string_view get_type_name() const override { return "PGlog"; } void inner_print(std::ostream& out) const override { // NOTE: log is not const, but operator<< doesn't touch fields // swapped out by OSD code. out << "log " << log << " pi " << past_intervals; if (lease) { out << " " << *lease; } } void encode_payload(uint64_t features) override { using ceph::encode; encode(epoch, payload); encode(info, payload); encode(log, payload); encode(missing, payload, features); assert(HAVE_FEATURE(features, SERVER_NAUTILUS)); encode(query_epoch, payload); encode(past_intervals, payload); encode(to, payload); encode(from, payload); encode(lease, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(epoch, p); decode(info, p); log.decode(p, info.pgid.pool()); missing.decode(p, info.pgid.pool()); decode(query_epoch, p); decode(past_intervals, p); decode(to, p); decode(from, p); assert(header.version >= 6); decode(lease, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
3,482
25.587786
77
h
null
ceph-main/src/messages/MOSDPGNotify.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDPGPEERNOTIFY_H #define CEPH_MOSDPGPEERNOTIFY_H #include "msg/Message.h" #include "osd/osd_types.h" /* * PGNotify - notify primary of my PGs and versions. */ class MOSDPGNotify final : public Message { private: static constexpr int HEAD_VERSION = 7; static constexpr int COMPAT_VERSION = 7; epoch_t epoch = 0; /// query_epoch is the epoch of the query being responded to, or /// the current epoch if this is not being sent in response to a /// query. This allows the recipient to disregard responses to old /// queries. using pg_list_t = std::vector<pg_notify_t>; pg_list_t pg_list; public: version_t get_epoch() const { return epoch; } const pg_list_t& get_pg_list() const { return pg_list; } MOSDPGNotify() : MOSDPGNotify(0, {}) {} MOSDPGNotify(epoch_t e, pg_list_t&& l) : Message{MSG_OSD_PG_NOTIFY, HEAD_VERSION, COMPAT_VERSION}, epoch(e), pg_list(std::move(l)) { set_priority(CEPH_MSG_PRIO_HIGH); } private: ~MOSDPGNotify() final {} public: std::string_view get_type_name() const override { return "PGnot"; } void encode_payload(uint64_t features) override { using ceph::encode; header.version = HEAD_VERSION; encode(epoch, payload); assert(HAVE_FEATURE(features, SERVER_OCTOPUS)); encode(pg_list, payload); } void decode_payload() override { auto p = payload.cbegin(); using ceph::decode; decode(epoch, p); decode(pg_list, p); } void print(std::ostream& out) const override { out << "pg_notify("; for (auto i = pg_list.begin(); i != pg_list.end(); ++i) { if (i != pg_list.begin()) out << " "; out << *i; } out << " epoch " << epoch << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,294
23.945652
71
h
null
ceph-main/src/messages/MOSDPGNotify2.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #pragma once #include "messages/MOSDPeeringOp.h" #include "osd/PGPeeringEvent.h" class MOSDPGNotify2 final : public MOSDPeeringOp { private: static constexpr int HEAD_VERSION = 1; static constexpr int COMPAT_VERSION = 1; public: spg_t spgid; pg_notify_t notify; spg_t get_spg() const override { return spgid; } epoch_t get_map_epoch() const override { return notify.epoch_sent; } epoch_t get_min_epoch() const override { return notify.query_epoch; } PGPeeringEvent *get_event() override { return new PGPeeringEvent( notify.epoch_sent, notify.query_epoch, MNotifyRec( spgid, pg_shard_t(get_source().num(), notify.from), notify, #ifdef WITH_SEASTAR features #else get_connection()->get_features() #endif ), true, new PGCreateInfo( spgid, notify.epoch_sent, notify.info.history, notify.past_intervals, false)); } MOSDPGNotify2() : MOSDPeeringOp{MSG_OSD_PG_NOTIFY2, HEAD_VERSION, COMPAT_VERSION} { set_priority(CEPH_MSG_PRIO_HIGH); } MOSDPGNotify2( spg_t s, pg_notify_t n) : MOSDPeeringOp{MSG_OSD_PG_NOTIFY2, HEAD_VERSION, COMPAT_VERSION}, spgid(s), notify(n) { set_priority(CEPH_MSG_PRIO_HIGH); } private: ~MOSDPGNotify2() final {} public: std::string_view get_type_name() const override { return "pg_notify2"; } void inner_print(std::ostream& out) const override { out << spgid << " " << notify; } void encode_payload(uint64_t features) override { using ceph::encode; encode(spgid, payload); encode(notify, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(spgid, p); decode(notify, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); };
1,949
20.666667
70
h
null
ceph-main/src/messages/MOSDPGPull.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2013 Inktank Storage, Inc. * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef MOSDPGPULL_H #define MOSDPGPULL_H #include "MOSDFastDispatchOp.h" class MOSDPGPull : public MOSDFastDispatchOp { private: static constexpr int HEAD_VERSION = 3; static constexpr int COMPAT_VERSION = 2; std::vector<PullOp> pulls; public: pg_shard_t from; spg_t pgid; epoch_t map_epoch = 0, min_epoch = 0; uint64_t cost = 0; epoch_t get_map_epoch() const override { return map_epoch; } epoch_t get_min_epoch() const override { return min_epoch; } spg_t get_spg() const override { return pgid; } std::vector<PullOp> take_pulls() { return std::move(pulls); } void set_pulls(std::vector<PullOp>&& pull_ops) { pulls = std::move(pull_ops); } MOSDPGPull() : MOSDFastDispatchOp{MSG_OSD_PG_PULL, HEAD_VERSION, COMPAT_VERSION} {} void compute_cost(CephContext *cct) { cost = 0; for (auto i = pulls.begin(); i != pulls.end(); ++i) { cost += i->cost(cct); } } int get_cost() const override { return cost; } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(pgid.pgid, p); decode(map_epoch, p); decode(pulls, p); decode(cost, p); decode(pgid.shard, p); decode(from, p); if (header.version >= 3) { decode(min_epoch, p); } else { min_epoch = map_epoch; } } void encode_payload(uint64_t features) override { using ceph::encode; encode(pgid.pgid, payload); encode(map_epoch, payload); encode(pulls, payload, features); encode(cost, payload); encode(pgid.shard, payload); encode(from, payload); encode(min_epoch, payload); } std::string_view get_type_name() const override { return "MOSDPGPull"; } void print(std::ostream& out) const override { out << "MOSDPGPull(" << pgid << " e" << map_epoch << "/" << min_epoch << " cost " << cost << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,426
21.682243
74
h
null
ceph-main/src/messages/MOSDPGPush.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2013 Inktank Storage, Inc. * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef MOSDPGPUSH_H #define MOSDPGPUSH_H #include "MOSDFastDispatchOp.h" class MOSDPGPush : public MOSDFastDispatchOp { private: static constexpr int HEAD_VERSION = 4; static constexpr int COMPAT_VERSION = 2; public: pg_shard_t from; spg_t pgid; epoch_t map_epoch = 0, min_epoch = 0; std::vector<PushOp> pushes; bool is_repair = false; private: uint64_t cost = 0; public: void compute_cost(CephContext *cct) { cost = 0; for (auto i = pushes.begin(); i != pushes.end(); ++i) { cost += i->cost(cct); } } int get_cost() const override { return cost; } epoch_t get_map_epoch() const override { return map_epoch; } epoch_t get_min_epoch() const override { return min_epoch; } spg_t get_spg() const override { return pgid; } void set_cost(uint64_t c) { cost = c; } MOSDPGPush() : MOSDFastDispatchOp{MSG_OSD_PG_PUSH, HEAD_VERSION, COMPAT_VERSION} {} void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(pgid.pgid, p); decode(map_epoch, p); decode(pushes, p); decode(cost, p); decode(pgid.shard, p); decode(from, p); if (header.version >= 3) { decode(min_epoch, p); } else { min_epoch = map_epoch; } if (header.version >= 4) { decode(is_repair, p); } else { is_repair = false; } } void encode_payload(uint64_t features) override { using ceph::encode; encode(pgid.pgid, payload); encode(map_epoch, payload); encode(pushes, payload, features); encode(cost, payload); encode(pgid.shard, payload); encode(from, payload); encode(min_epoch, payload); encode(is_repair, payload); } std::string_view get_type_name() const override { return "MOSDPGPush"; } void print(std::ostream& out) const override { out << "MOSDPGPush(" << pgid << " " << map_epoch << "/" << min_epoch << " " << pushes; out << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,503
21.159292
74
h
null
ceph-main/src/messages/MOSDPGPushReply.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2013 Inktank Storage, Inc. * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef MOSDPGPUSHREPLY_H #define MOSDPGPUSHREPLY_H #include "MOSDFastDispatchOp.h" class MOSDPGPushReply : public MOSDFastDispatchOp { private: static constexpr int HEAD_VERSION = 3; static constexpr int COMPAT_VERSION = 2; public: pg_shard_t from; spg_t pgid; epoch_t map_epoch = 0, min_epoch = 0; std::vector<PushReplyOp> replies; uint64_t cost = 0; epoch_t get_map_epoch() const override { return map_epoch; } epoch_t get_min_epoch() const override { return min_epoch; } spg_t get_spg() const override { return pgid; } MOSDPGPushReply() : MOSDFastDispatchOp{MSG_OSD_PG_PUSH_REPLY, HEAD_VERSION, COMPAT_VERSION} {} void compute_cost(CephContext *cct) { cost = 0; for (auto i = replies.begin(); i != replies.end(); ++i) { cost += i->cost(cct); } } int get_cost() const override { return cost; } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(pgid.pgid, p); decode(map_epoch, p); decode(replies, p); decode(cost, p); decode(pgid.shard, p); decode(from, p); if (header.version >= 3) { decode(min_epoch, p); } else { min_epoch = map_epoch; } } void encode_payload(uint64_t features) override { using ceph::encode; encode(pgid.pgid, payload); encode(map_epoch, payload); encode(replies, payload); encode(cost, payload); encode(pgid.shard, payload); encode(from, payload); encode(min_epoch, payload); } void print(std::ostream& out) const override { out << "MOSDPGPushReply(" << pgid << " " << map_epoch << "/" << min_epoch << " " << replies; out << ")"; } std::string_view get_type_name() const override { return "MOSDPGPushReply"; } }; #endif
2,197
22.136842
79
h
null
ceph-main/src/messages/MOSDPGQuery.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDPGQUERY_H #define CEPH_MOSDPGQUERY_H #include "common/hobject.h" #include "msg/Message.h" /* * PGQuery - query another OSD as to the contents of their PGs */ class MOSDPGQuery final : public Message { private: static constexpr int HEAD_VERSION = 4; static constexpr int COMPAT_VERSION = 4; version_t epoch = 0; public: version_t get_epoch() const { return epoch; } using pg_list_t = std::map<spg_t, pg_query_t>; pg_list_t pg_list; MOSDPGQuery() : Message{MSG_OSD_PG_QUERY, HEAD_VERSION, COMPAT_VERSION} { set_priority(CEPH_MSG_PRIO_HIGH); } MOSDPGQuery(epoch_t e, pg_list_t&& ls) : Message{MSG_OSD_PG_QUERY, HEAD_VERSION, COMPAT_VERSION}, epoch(e), pg_list(std::move(ls)) { set_priority(CEPH_MSG_PRIO_HIGH); } private: ~MOSDPGQuery() final {} public: std::string_view get_type_name() const override { return "pg_query"; } void print(std::ostream& out) const override { out << "pg_query("; for (auto p = pg_list.begin(); p != pg_list.end(); ++p) { if (p != pg_list.begin()) out << ","; out << p->first; } out << " epoch " << epoch << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; encode(epoch, payload); encode(pg_list, payload, features); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(epoch, p); decode(pg_list, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,012
23.253012
72
h
null
ceph-main/src/messages/MOSDPGQuery2.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #pragma once #include "messages/MOSDPeeringOp.h" #include "osd/PGPeeringEvent.h" class MOSDPGQuery2 final : public MOSDPeeringOp { private: static constexpr int HEAD_VERSION = 1; static constexpr int COMPAT_VERSION = 1; public: spg_t spgid; pg_query_t query; spg_t get_spg() const override { return spgid; } epoch_t get_map_epoch() const override { return query.epoch_sent; } epoch_t get_min_epoch() const override { return query.epoch_sent; } PGPeeringEvent *get_event() override { return new PGPeeringEvent( query.epoch_sent, query.epoch_sent, MQuery( spgid, pg_shard_t(get_source().num(), query.from), query, query.epoch_sent), false); } MOSDPGQuery2() : MOSDPeeringOp{MSG_OSD_PG_QUERY2, HEAD_VERSION, COMPAT_VERSION} { set_priority(CEPH_MSG_PRIO_HIGH); } MOSDPGQuery2( spg_t s, pg_query_t q) : MOSDPeeringOp{MSG_OSD_PG_QUERY2, HEAD_VERSION, COMPAT_VERSION}, spgid(s), query(q) { set_priority(CEPH_MSG_PRIO_HIGH); } private: ~MOSDPGQuery2() final {} public: std::string_view get_type_name() const override { return "pg_query2"; } void inner_print(std::ostream& out) const override { out << spgid << " " << query; } void encode_payload(uint64_t features) override { using ceph::encode; encode(spgid, payload); encode(query, payload, features); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(spgid, p); decode(query, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); };
1,761
21.303797
70
h
null
ceph-main/src/messages/MOSDPGReadyToMerge.h
// -*- 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); };
1,812
28.241935
85
h
null
ceph-main/src/messages/MOSDPGRecoveryDelete.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #ifndef CEPH_MOSDPGRECOVERYDELETE_H #define CEPH_MOSDPGRECOVERYDELETE_H #include "MOSDFastDispatchOp.h" /* * instruct non-primary to remove some objects during recovery */ class MOSDPGRecoveryDelete final : public MOSDFastDispatchOp { public: static constexpr int HEAD_VERSION = 2; static constexpr int COMPAT_VERSION = 1; pg_shard_t from; spg_t pgid; ///< target spg_t epoch_t map_epoch, min_epoch; std::list<std::pair<hobject_t, eversion_t>> objects; ///< objects to remove private: uint64_t cost = 0; public: int get_cost() const override { return cost; } epoch_t get_map_epoch() const override { return map_epoch; } epoch_t get_min_epoch() const override { return min_epoch; } spg_t get_spg() const override { return pgid; } void set_cost(uint64_t c) { cost = c; } MOSDPGRecoveryDelete() : MOSDFastDispatchOp{MSG_OSD_PG_RECOVERY_DELETE, HEAD_VERSION, COMPAT_VERSION} {} MOSDPGRecoveryDelete(pg_shard_t from, spg_t pgid, epoch_t map_epoch, epoch_t min_epoch) : MOSDFastDispatchOp{MSG_OSD_PG_RECOVERY_DELETE, HEAD_VERSION, COMPAT_VERSION}, from(from), pgid(pgid), map_epoch(map_epoch), min_epoch(min_epoch) {} private: ~MOSDPGRecoveryDelete() final {} public: std::string_view get_type_name() const { return "recovery_delete"; } void print(std::ostream& out) const { out << "MOSDPGRecoveryDelete(" << pgid << " e" << map_epoch << "," << min_epoch << " " << objects << ")"; } void encode_payload(uint64_t features) { using ceph::encode; encode(from, payload); encode(pgid, payload); encode(map_epoch, payload); encode(min_epoch, payload); encode(cost, payload); encode(objects, payload); } void decode_payload() { using ceph::decode; auto p = payload.cbegin(); decode(from, p); decode(pgid, p); decode(map_epoch, p); decode(min_epoch, p); decode(cost, p); decode(objects, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,226
22.442105
80
h
null
ceph-main/src/messages/MOSDPGRecoveryDeleteReply.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #ifndef MOSDRECOVERYDELETEREPLY_H #define MOSDRECOVERYDELETEREPLY_H #include "MOSDFastDispatchOp.h" class MOSDPGRecoveryDeleteReply : public MOSDFastDispatchOp { public: static constexpr int HEAD_VERSION = 2; static constexpr int COMPAT_VERSION = 1; pg_shard_t from; spg_t pgid; epoch_t map_epoch = 0; epoch_t min_epoch = 0; std::list<std::pair<hobject_t, eversion_t> > objects; epoch_t get_map_epoch() const override { return map_epoch; } epoch_t get_min_epoch() const override { return min_epoch; } spg_t get_spg() const override { return pgid; } MOSDPGRecoveryDeleteReply() : MOSDFastDispatchOp{MSG_OSD_PG_RECOVERY_DELETE_REPLY, HEAD_VERSION, COMPAT_VERSION} {} void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(pgid.pgid, p); decode(map_epoch, p); decode(min_epoch, p); decode(objects, p); decode(pgid.shard, p); decode(from, p); } void encode_payload(uint64_t features) override { using ceph::encode; encode(pgid.pgid, payload); encode(map_epoch, payload); encode(min_epoch, payload); encode(objects, payload); encode(pgid.shard, payload); encode(from, payload); } void print(std::ostream& out) const override { out << "MOSDPGRecoveryDeleteReply(" << pgid << " e" << map_epoch << "," << min_epoch << " " << objects << ")"; } std::string_view get_type_name() const override { return "recovery_delete_reply"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
1,719
24.294118
88
h
null
ceph-main/src/messages/MOSDPGRemove.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDPGREMOVE_H #define CEPH_MOSDPGREMOVE_H #include "common/hobject.h" #include "msg/Message.h" class MOSDPGRemove final : public Message { private: static constexpr int HEAD_VERSION = 3; static constexpr int COMPAT_VERSION = 3; epoch_t epoch = 0; public: std::vector<spg_t> pg_list; epoch_t get_epoch() const { return epoch; } MOSDPGRemove() : Message{MSG_OSD_PG_REMOVE, HEAD_VERSION, COMPAT_VERSION} {} MOSDPGRemove(epoch_t e, std::vector<spg_t>& l) : Message{MSG_OSD_PG_REMOVE, HEAD_VERSION, COMPAT_VERSION} { this->epoch = e; pg_list.swap(l); } private: ~MOSDPGRemove() final {} public: std::string_view get_type_name() const override { return "PGrm"; } void encode_payload(uint64_t features) override { using ceph::encode; encode(epoch, payload); encode(pg_list, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(epoch, p); decode(pg_list, p); } void print(std::ostream& out) const override { out << "osd pg remove(" << "epoch " << epoch << "; "; for (auto i = pg_list.begin(); i != pg_list.end(); ++i) { out << "pg" << *i << "; "; } out << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
1,780
23.736111
71
h
null
ceph-main/src/messages/MOSDPGScan.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDPGSCAN_H #define CEPH_MOSDPGSCAN_H #include "MOSDFastDispatchOp.h" class MOSDPGScan final : public MOSDFastDispatchOp { private: static constexpr int HEAD_VERSION = 2; static constexpr int COMPAT_VERSION = 2; public: enum { OP_SCAN_GET_DIGEST = 1, // just objects and versions OP_SCAN_DIGEST = 2, // result }; const char *get_op_name(int o) const { switch (o) { case OP_SCAN_GET_DIGEST: return "get_digest"; case OP_SCAN_DIGEST: return "digest"; default: return "???"; } } __u32 op = 0; epoch_t map_epoch = 0, query_epoch = 0; pg_shard_t from; spg_t pgid; hobject_t begin, end; epoch_t get_map_epoch() const override { return map_epoch; } epoch_t get_min_epoch() const override { return query_epoch; } spg_t get_spg() const override { return pgid; } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(op, p); decode(map_epoch, p); decode(query_epoch, p); decode(pgid.pgid, p); decode(begin, p); decode(end, p); // handle hobject_t format upgrade if (!begin.is_max() && begin.pool == -1) begin.pool = pgid.pool(); if (!end.is_max() && end.pool == -1) end.pool = pgid.pool(); decode(from, p); decode(pgid.shard, p); } void encode_payload(uint64_t features) override { using ceph::encode; encode(op, payload); encode(map_epoch, payload); assert(HAVE_FEATURE(features, SERVER_NAUTILUS)); encode(query_epoch, payload); encode(pgid.pgid, payload); encode(begin, payload); encode(end, payload); encode(from, payload); encode(pgid.shard, payload); } MOSDPGScan() : MOSDFastDispatchOp{MSG_OSD_PG_SCAN, HEAD_VERSION, COMPAT_VERSION} {} MOSDPGScan(__u32 o, pg_shard_t from, epoch_t e, epoch_t qe, spg_t p, hobject_t be, hobject_t en) : MOSDFastDispatchOp{MSG_OSD_PG_SCAN, HEAD_VERSION, COMPAT_VERSION}, op(o), map_epoch(e), query_epoch(qe), from(from), pgid(p), begin(be), end(en) { } private: ~MOSDPGScan() final {} public: std::string_view get_type_name() const override { return "pg_scan"; } void print(std::ostream& out) const override { out << "pg_scan(" << get_op_name(op) << " " << pgid << " " << begin << "-" << end << " e " << map_epoch << "/" << query_epoch << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,953
24.465517
74
h
null
ceph-main/src/messages/MOSDPGTemp.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDPGTEMP_H #define CEPH_MOSDPGTEMP_H #include "messages/PaxosServiceMessage.h" class MOSDPGTemp final : public PaxosServiceMessage { public: epoch_t map_epoch = 0; std::map<pg_t, std::vector<int32_t> > pg_temp; bool forced = false; MOSDPGTemp(epoch_t e) : PaxosServiceMessage{MSG_OSD_PGTEMP, e, HEAD_VERSION, COMPAT_VERSION}, map_epoch(e) {} MOSDPGTemp() : MOSDPGTemp(0) {} private: ~MOSDPGTemp() final {} public: void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); encode(map_epoch, payload); encode(pg_temp, payload); encode(forced, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(map_epoch, p); decode(pg_temp, p); if (header.version >= 2) { decode(forced, p); } } std::string_view get_type_name() const override { return "osd_pgtemp"; } void print(std::ostream &out) const override { out << "osd_pgtemp(e" << map_epoch << " " << pg_temp << " v" << version << ")"; } private: static constexpr int HEAD_VERSION = 2; static constexpr int COMPAT_VERSION = 1; template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
1,737
23.828571
83
h
null
ceph-main/src/messages/MOSDPGTrim.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDPGTRIM_H #define CEPH_MOSDPGTRIM_H #include "msg/Message.h" #include "messages/MOSDPeeringOp.h" #include "osd/PGPeeringEvent.h" class MOSDPGTrim final : public MOSDPeeringOp { private: static constexpr int HEAD_VERSION = 2; static constexpr int COMPAT_VERSION = 2; public: epoch_t epoch = 0; spg_t pgid; eversion_t trim_to; epoch_t get_epoch() const { return epoch; } spg_t get_spg() const { return pgid; } epoch_t get_map_epoch() const { return epoch; } epoch_t get_min_epoch() const { return epoch; } PGPeeringEvent *get_event() override { return new PGPeeringEvent( epoch, epoch, MTrim(epoch, get_source().num(), pgid.shard, trim_to)); } MOSDPGTrim() : MOSDPeeringOp{MSG_OSD_PG_TRIM, HEAD_VERSION, COMPAT_VERSION} {} MOSDPGTrim(version_t mv, spg_t p, eversion_t tt) : MOSDPeeringOp{MSG_OSD_PG_TRIM, HEAD_VERSION, COMPAT_VERSION}, epoch(mv), pgid(p), trim_to(tt) { } private: ~MOSDPGTrim() final {} public: std::string_view get_type_name() const override { return "pg_trim"; } void inner_print(std::ostream& out) const override { out << trim_to; } void encode_payload(uint64_t features) override { using ceph::encode; encode(epoch, payload); encode(pgid.pgid, payload); encode(trim_to, payload); encode(pgid.shard, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(epoch, p); decode(pgid.pgid, p); decode(trim_to, p); decode(pgid.shard, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,112
24.457831
80
h
null
ceph-main/src/messages/MOSDPGUpdateLogMissing.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDPGUPDATELOGMISSING_H #define CEPH_MOSDPGUPDATELOGMISSING_H #include "MOSDFastDispatchOp.h" class MOSDPGUpdateLogMissing final : public MOSDFastDispatchOp { private: static constexpr int HEAD_VERSION = 3; static constexpr int COMPAT_VERSION = 1; public: epoch_t map_epoch = 0, min_epoch = 0; spg_t pgid; shard_id_t from; ceph_tid_t rep_tid = 0; mempool::osd_pglog::list<pg_log_entry_t> entries; // piggybacked osd/pg state eversion_t pg_trim_to; // primary->replica: trim to here eversion_t pg_roll_forward_to; // primary->replica: trim rollback info to here epoch_t get_epoch() const { return map_epoch; } spg_t get_pgid() const { return pgid; } epoch_t get_query_epoch() const { return map_epoch; } ceph_tid_t get_tid() const { return rep_tid; } epoch_t get_map_epoch() const override { return map_epoch; } epoch_t get_min_epoch() const override { return min_epoch; } spg_t get_spg() const override { return pgid; } MOSDPGUpdateLogMissing() : MOSDFastDispatchOp{MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION, COMPAT_VERSION} {} MOSDPGUpdateLogMissing( const mempool::osd_pglog::list<pg_log_entry_t> &entries, spg_t pgid, shard_id_t from, epoch_t epoch, epoch_t min_epoch, ceph_tid_t rep_tid, eversion_t pg_trim_to, eversion_t pg_roll_forward_to) : MOSDFastDispatchOp{MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION, COMPAT_VERSION}, map_epoch(epoch), min_epoch(min_epoch), pgid(pgid), from(from), rep_tid(rep_tid), entries(entries), pg_trim_to(pg_trim_to), pg_roll_forward_to(pg_roll_forward_to) {} private: ~MOSDPGUpdateLogMissing() final {} public: std::string_view get_type_name() const override { return "PGUpdateLogMissing"; } void print(std::ostream& out) const override { out << "pg_update_log_missing(" << pgid << " epoch " << map_epoch << "/" << min_epoch << " rep_tid " << rep_tid << " entries " << entries << " trim_to " << pg_trim_to << " roll_forward_to " << pg_roll_forward_to << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; encode(map_epoch, payload); encode(pgid, payload); encode(from, payload); encode(rep_tid, payload); encode(entries, payload); encode(min_epoch, payload); encode(pg_trim_to, payload); encode(pg_roll_forward_to, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(map_epoch, p); decode(pgid, p); decode(from, p); decode(rep_tid, p); decode(entries, p); if (header.version >= 2) { decode(min_epoch, p); } else { min_epoch = map_epoch; } if (header.version >= 3) { decode(pg_trim_to, p); decode(pg_roll_forward_to, p); } } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
3,400
26.208
82
h
null
ceph-main/src/messages/MOSDPGUpdateLogMissingReply.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDPGUPDATELOGMISSINGREPLY_H #define CEPH_MOSDPGUPDATELOGMISSINGREPLY_H #include "MOSDFastDispatchOp.h" class MOSDPGUpdateLogMissingReply final : public MOSDFastDispatchOp { private: static constexpr int HEAD_VERSION = 3; static constexpr int COMPAT_VERSION = 1; public: epoch_t map_epoch = 0, min_epoch = 0; spg_t pgid; shard_id_t from; ceph_tid_t rep_tid = 0; // piggybacked osd state eversion_t last_complete_ondisk; epoch_t get_epoch() const { return map_epoch; } spg_t get_pgid() const { return pgid; } epoch_t get_query_epoch() const { return map_epoch; } ceph_tid_t get_tid() const { return rep_tid; } pg_shard_t get_from() const { return pg_shard_t(get_source().num(), from); } epoch_t get_map_epoch() const override { return map_epoch; } epoch_t get_min_epoch() const override { return min_epoch; } spg_t get_spg() const override { return pgid; } MOSDPGUpdateLogMissingReply() : MOSDFastDispatchOp{MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY, HEAD_VERSION, COMPAT_VERSION} {} MOSDPGUpdateLogMissingReply( spg_t pgid, shard_id_t from, epoch_t epoch, epoch_t min_epoch, ceph_tid_t rep_tid, eversion_t last_complete_ondisk) : MOSDFastDispatchOp{MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY, HEAD_VERSION, COMPAT_VERSION}, map_epoch(epoch), min_epoch(min_epoch), pgid(pgid), from(from), rep_tid(rep_tid), last_complete_ondisk(last_complete_ondisk) {} private: ~MOSDPGUpdateLogMissingReply() final {} public: std::string_view get_type_name() const override { return "PGUpdateLogMissingReply"; } void print(std::ostream& out) const override { out << "pg_update_log_missing_reply(" << pgid << " epoch " << map_epoch << "/" << min_epoch << " rep_tid " << rep_tid << " lcod " << last_complete_ondisk << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; encode(map_epoch, payload); encode(pgid, payload); encode(from, payload); encode(rep_tid, payload); encode(min_epoch, payload); encode(last_complete_ondisk, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(map_epoch, p); decode(pgid, p); decode(from, p); decode(rep_tid, p); if (header.version >= 2) { decode(min_epoch, p); } else { min_epoch = map_epoch; } if (header.version >= 3) { decode(last_complete_ondisk, p); } } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
3,067
25.448276
87
h
null
ceph-main/src/messages/MOSDPeeringOp.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #pragma once #include "msg/Message.h" #include "osd/osd_types.h" class PGPeeringEvent; class MOSDPeeringOp : public Message { public: MOSDPeeringOp(int t, int version, int compat_version) : Message{t, version, compat_version} {} void print(std::ostream& out) const override final { out << get_type_name() << "(" << get_spg() << " "; inner_print(out); out << " e" << get_map_epoch() << "/" << get_min_epoch() << ")"; } virtual spg_t get_spg() const = 0; virtual epoch_t get_map_epoch() const = 0; virtual epoch_t get_min_epoch() const = 0; virtual PGPeeringEvent *get_event() = 0; virtual void inner_print(std::ostream& out) const = 0; #ifdef WITH_SEASTAR // In crimson, conn is independently maintained outside Message. // Instead of get features from the connection later, set features at // the start of the operation. void set_features(uint64_t _features) { features = _features; } protected: uint64_t features; #endif };
1,080
25.365854
71
h
null
ceph-main/src/messages/MOSDPing.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ /** * This is used to send pings between daemons (so far, the OSDs) for * heartbeat purposes. We include a timestamp and distinguish between * outgoing pings and responses to those. If you set the * min_message in the constructor, the message will inflate itself * to the specified size -- this is good for dealing with network * issues with jumbo frames. See http://tracker.ceph.com/issues/20087 * */ #ifndef CEPH_MOSDPING_H #define CEPH_MOSDPING_H #include "common/Clock.h" #include "msg/Message.h" #include "osd/osd_types.h" class MOSDPing final : public Message { private: static constexpr int HEAD_VERSION = 5; static constexpr int COMPAT_VERSION = 4; public: enum { HEARTBEAT = 0, START_HEARTBEAT = 1, YOU_DIED = 2, STOP_HEARTBEAT = 3, PING = 4, PING_REPLY = 5, }; const char *get_op_name(int op) const { switch (op) { case HEARTBEAT: return "heartbeat"; case START_HEARTBEAT: return "start_heartbeat"; case STOP_HEARTBEAT: return "stop_heartbeat"; case YOU_DIED: return "you_died"; case PING: return "ping"; case PING_REPLY: return "ping_reply"; default: return "???"; } } uuid_d fsid; epoch_t map_epoch = 0; __u8 op = 0; utime_t ping_stamp; ///< when the PING was sent ceph::signedspan mono_ping_stamp; ///< relative to sender's clock ceph::signedspan mono_send_stamp; ///< replier's send stamp std::optional<ceph::signedspan> delta_ub; ///< ping sender epoch_t up_from = 0; uint32_t min_message_size = 0; MOSDPing(const uuid_d& f, epoch_t e, __u8 o, utime_t s, ceph::signedspan ms, ceph::signedspan mss, epoch_t upf, uint32_t min_message, std::optional<ceph::signedspan> delta_ub = {}) : Message{MSG_OSD_PING, HEAD_VERSION, COMPAT_VERSION}, fsid(f), map_epoch(e), op(o), ping_stamp(s), mono_ping_stamp(ms), mono_send_stamp(mss), delta_ub(delta_ub), up_from(upf), min_message_size(min_message) { } MOSDPing() : Message{MSG_OSD_PING, HEAD_VERSION, COMPAT_VERSION} {} private: ~MOSDPing() final {} public: void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(fsid, p); decode(map_epoch, p); decode(op, p); decode(ping_stamp, p); int payload_mid_length = p.get_off(); uint32_t size; decode(size, p); if (header.version >= 5) { decode(up_from, p); decode(mono_ping_stamp, p); decode(mono_send_stamp, p); decode(delta_ub, p); } p += size; min_message_size = size + payload_mid_length; } void encode_payload(uint64_t features) override { using ceph::encode; encode(fsid, payload); encode(map_epoch, payload); encode(op, payload); encode(ping_stamp, payload); size_t s = 0; if (min_message_size > payload.length()) { s = min_message_size - payload.length(); } encode((uint32_t)s, payload); encode(up_from, payload); encode(mono_ping_stamp, payload); encode(mono_send_stamp, payload); encode(delta_ub, payload); if (s) { // this should be big enough for normal min_message padding sizes. since // we are targeting jumbo ethernet frames around 9000 bytes, 16k should // be more than sufficient! the compiler will statically zero this so // that at runtime we are only adding a bufferptr reference to it. static char zeros[16384] = {}; while (s > sizeof(zeros)) { payload.append(ceph::buffer::create_static(sizeof(zeros), zeros)); s -= sizeof(zeros); } if (s) { payload.append(ceph::buffer::create_static(s, zeros)); } } } std::string_view get_type_name() const override { return "osd_ping"; } void print(std::ostream& out) const override { out << "osd_ping(" << get_op_name(op) << " e" << map_epoch << " up_from " << up_from << " ping_stamp " << ping_stamp << "/" << mono_ping_stamp << " send_stamp " << mono_send_stamp; if (delta_ub) { out << " delta_ub " << *delta_ub; } out << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
4,653
26.538462
78
h
null
ceph-main/src/messages/MOSDRepOp.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDREPOP_H #define CEPH_MOSDREPOP_H #include "MOSDFastDispatchOp.h" /* * OSD sub op - for internal ops on pobjects between primary and replicas(/stripes/whatever) */ class MOSDRepOp final : public MOSDFastDispatchOp { private: static constexpr int HEAD_VERSION = 3; static constexpr int COMPAT_VERSION = 1; public: epoch_t map_epoch, min_epoch; // metadata from original request osd_reqid_t reqid; spg_t pgid; ceph::buffer::list::const_iterator p; // Decoding flags. Decoding is only needed for messages caught by pipe reader. bool final_decode_needed; // subop pg_shard_t from; hobject_t poid; __u8 acks_wanted; // transaction to exec ceph::buffer::list logbl; pg_stat_t pg_stats; // subop metadata eversion_t version; // piggybacked osd/og state eversion_t pg_trim_to; // primary->replica: trim to here eversion_t min_last_complete_ondisk; // lower bound on committed version hobject_t new_temp_oid; ///< new temp object that we must now start tracking hobject_t discard_temp_oid; ///< previously used temp object that we can now stop tracking /// non-empty if this transaction involves a hit_set history update std::optional<pg_hit_set_history_t> updated_hit_set_history; epoch_t get_map_epoch() const override { return map_epoch; } epoch_t get_min_epoch() const override { return min_epoch; } spg_t get_spg() const override { return pgid; } int get_cost() const override { return data.length(); } void decode_payload() override { using ceph::decode; p = payload.cbegin(); // split to partial and final decode(map_epoch, p); if (header.version >= 2) { decode(min_epoch, p); decode_trace(p); } else { min_epoch = map_epoch; } decode(reqid, p); decode(pgid, p); } void finish_decode() { using ceph::decode; if (!final_decode_needed) return; // Message is already final decoded decode(poid, p); decode(acks_wanted, p); decode(version, p); decode(logbl, p); decode(pg_stats, p); decode(pg_trim_to, p); decode(new_temp_oid, p); decode(discard_temp_oid, p); decode(from, p); decode(updated_hit_set_history, p); if (header.version >= 3) { decode(min_last_complete_ondisk, p); } else { /* This field used to mean pg_roll_foward_to, but ReplicatedBackend * simply assumes that we're rolling foward to version. */ eversion_t pg_roll_forward_to; decode(pg_roll_forward_to, p); } final_decode_needed = false; } void encode_payload(uint64_t features) override { using ceph::encode; encode(map_epoch, payload); assert(HAVE_FEATURE(features, SERVER_OCTOPUS)); header.version = HEAD_VERSION; encode(min_epoch, payload); encode_trace(payload, features); encode(reqid, payload); encode(pgid, payload); encode(poid, payload); encode(acks_wanted, payload); encode(version, payload); encode(logbl, payload); encode(pg_stats, payload); encode(pg_trim_to, payload); encode(new_temp_oid, payload); encode(discard_temp_oid, payload); encode(from, payload); encode(updated_hit_set_history, payload); encode(min_last_complete_ondisk, payload); } MOSDRepOp() : MOSDFastDispatchOp{MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION}, map_epoch(0), final_decode_needed(true), acks_wanted (0) {} MOSDRepOp(osd_reqid_t r, pg_shard_t from, spg_t p, const hobject_t& po, int aw, epoch_t mape, epoch_t min_epoch, ceph_tid_t rtid, eversion_t v) : MOSDFastDispatchOp{MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION}, map_epoch(mape), min_epoch(min_epoch), reqid(r), pgid(p), final_decode_needed(false), from(from), poid(po), acks_wanted(aw), version(v) { set_tid(rtid); } void set_rollback_to(const eversion_t &rollback_to) { header.version = 2; min_last_complete_ondisk = rollback_to; } private: ~MOSDRepOp() final {} public: std::string_view get_type_name() const override { return "osd_repop"; } void print(std::ostream& out) const override { out << "osd_repop(" << reqid << " " << pgid << " e" << map_epoch << "/" << min_epoch; if (!final_decode_needed) { out << " " << poid << " v " << version; if (updated_hit_set_history) out << ", has_updated_hit_set_history"; if (header.version < 3) { out << ", rollback_to(legacy)=" << min_last_complete_ondisk; } else { out << ", mlcod=" << min_last_complete_ondisk; } } out << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
5,187
25.335025
93
h
null
ceph-main/src/messages/MOSDRepOpReply.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDREPOPREPLY_H #define CEPH_MOSDREPOPREPLY_H #include "MOSDFastDispatchOp.h" #include "MOSDRepOp.h" /* * OSD Client Subop reply * * oid - object id * op - OSD_OP_DELETE, etc. * */ class MOSDRepOpReply final : public MOSDFastDispatchOp { private: static constexpr int HEAD_VERSION = 2; static constexpr int COMPAT_VERSION = 1; public: epoch_t map_epoch, min_epoch; // subop metadata osd_reqid_t reqid; pg_shard_t from; spg_t pgid; // result __u8 ack_type; int32_t result; // piggybacked osd state eversion_t last_complete_ondisk; ceph::buffer::list::const_iterator p; // Decoding flags. Decoding is only needed for messages caught by pipe reader. bool final_decode_needed; epoch_t get_map_epoch() const override { return map_epoch; } epoch_t get_min_epoch() const override { return min_epoch; } spg_t get_spg() const override { return pgid; } void decode_payload() override { using ceph::decode; p = payload.cbegin(); decode(map_epoch, p); if (header.version >= 2) { decode(min_epoch, p); decode_trace(p); } else { min_epoch = map_epoch; } decode(reqid, p); decode(pgid, p); } void finish_decode() { using ceph::decode; if (!final_decode_needed) return; // Message is already final decoded decode(ack_type, p); decode(result, p); decode(last_complete_ondisk, p); decode(from, p); final_decode_needed = false; } void encode_payload(uint64_t features) override { using ceph::encode; encode(map_epoch, payload); header.version = HEAD_VERSION; encode(min_epoch, payload); encode_trace(payload, features); encode(reqid, payload); encode(pgid, payload); encode(ack_type, payload); encode(result, payload); encode(last_complete_ondisk, payload); encode(from, payload); } spg_t get_pg() { return pgid; } int get_ack_type() { return ack_type; } bool is_ondisk() { return ack_type & CEPH_OSD_FLAG_ONDISK; } bool is_onnvram() { return ack_type & CEPH_OSD_FLAG_ONNVRAM; } int get_result() { return result; } void set_last_complete_ondisk(eversion_t v) { last_complete_ondisk = v; } eversion_t get_last_complete_ondisk() const { return last_complete_ondisk; } public: MOSDRepOpReply( const MOSDRepOp *req, pg_shard_t from, int result_, epoch_t e, epoch_t mine, int at) : MOSDFastDispatchOp{MSG_OSD_REPOPREPLY, HEAD_VERSION, COMPAT_VERSION}, map_epoch(e), min_epoch(mine), reqid(req->reqid), from(from), pgid(req->pgid.pgid, req->from.shard), ack_type(at), result(result_), final_decode_needed(false) { set_tid(req->get_tid()); } MOSDRepOpReply() : MOSDFastDispatchOp{MSG_OSD_REPOPREPLY, HEAD_VERSION, COMPAT_VERSION}, map_epoch(0), min_epoch(0), ack_type(0), result(0), final_decode_needed(true) {} private: ~MOSDRepOpReply() final {} public: std::string_view get_type_name() const override { return "osd_repop_reply"; } void print(std::ostream& out) const override { out << "osd_repop_reply(" << reqid << " " << pgid << " e" << map_epoch << "/" << min_epoch; if (!final_decode_needed) { if (ack_type & CEPH_OSD_FLAG_ONDISK) out << " ondisk"; if (ack_type & CEPH_OSD_FLAG_ONNVRAM) out << " onnvram"; if (ack_type & CEPH_OSD_FLAG_ACK) out << " ack"; out << ", result = " << result; } out << ")"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
4,049
24.15528
80
h
null
ceph-main/src/messages/MOSDRepScrub.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDREPSCRUB_H #define CEPH_MOSDREPSCRUB_H #include "MOSDFastDispatchOp.h" /* * instruct an OSD initiate a replica scrub on a specific PG */ class MOSDRepScrub final : public MOSDFastDispatchOp { public: static constexpr int HEAD_VERSION = 9; static constexpr int COMPAT_VERSION = 6; spg_t pgid; // PG to scrub eversion_t scrub_from; // only scrub log entries after scrub_from eversion_t scrub_to; // last_update_applied when message sent (not used) epoch_t map_epoch = 0, min_epoch = 0; bool chunky; // true for chunky scrubs hobject_t start; // lower bound of scrub, inclusive hobject_t end; // upper bound of scrub, exclusive bool deep; // true if scrub should be deep bool allow_preemption = false; int32_t priority = 0; bool high_priority = false; epoch_t get_map_epoch() const override { return map_epoch; } epoch_t get_min_epoch() const override { return min_epoch; } spg_t get_spg() const override { return pgid; } MOSDRepScrub() : MOSDFastDispatchOp{MSG_OSD_REP_SCRUB, HEAD_VERSION, COMPAT_VERSION}, chunky(false), deep(false) { } MOSDRepScrub(spg_t pgid, eversion_t scrub_to, epoch_t map_epoch, epoch_t min_epoch, hobject_t start, hobject_t end, bool deep, bool preemption, int prio, bool highprio) : MOSDFastDispatchOp{MSG_OSD_REP_SCRUB, HEAD_VERSION, COMPAT_VERSION}, pgid(pgid), scrub_to(scrub_to), map_epoch(map_epoch), min_epoch(min_epoch), chunky(true), start(start), end(end), deep(deep), allow_preemption(preemption), priority(prio), high_priority(highprio) { } private: ~MOSDRepScrub() final {} public: std::string_view get_type_name() const override { return "replica scrub"; } void print(std::ostream& out) const override { out << "replica_scrub(pg: " << pgid << ",from:" << scrub_from << ",to:" << scrub_to << ",epoch:" << map_epoch << "/" << min_epoch << ",start:" << start << ",end:" << end << ",chunky:" << chunky << ",deep:" << deep << ",version:" << header.version << ",allow_preemption:" << (int)allow_preemption << ",priority=" << priority << (high_priority ? " (high)":"") << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; encode(pgid.pgid, payload); encode(scrub_from, payload); encode(scrub_to, payload); encode(map_epoch, payload); encode(chunky, payload); encode(start, payload); encode(end, payload); encode(deep, payload); encode(pgid.shard, payload); encode((uint32_t)-1, payload); // seed encode(min_epoch, payload); encode(allow_preemption, payload); encode(priority, payload); encode(high_priority, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(pgid.pgid, p); decode(scrub_from, p); decode(scrub_to, p); decode(map_epoch, p); decode(chunky, p); decode(start, p); decode(end, p); decode(deep, p); decode(pgid.shard, p); { uint32_t seed; decode(seed, p); } if (header.version >= 7) { decode(min_epoch, p); } else { min_epoch = map_epoch; } if (header.version >= 8) { decode(allow_preemption, p); } if (header.version >= 9) { decode(priority, p); decode(high_priority, p); } } }; #endif
3,918
26.405594
85
h
null
ceph-main/src/messages/MOSDRepScrubMap.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2017 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDREPSCRUBMAP_H #define CEPH_MOSDREPSCRUBMAP_H #include "MOSDFastDispatchOp.h" /* * pass a ScrubMap from a shard back to the primary */ class MOSDRepScrubMap final : public MOSDFastDispatchOp { public: static constexpr int HEAD_VERSION = 2; static constexpr int COMPAT_VERSION = 1; spg_t pgid; // primary spg_t epoch_t map_epoch = 0; pg_shard_t from; // whose scrubmap this is ceph::buffer::list scrub_map_bl; bool preempted = false; epoch_t get_map_epoch() const override { return map_epoch; } spg_t get_spg() const override { return pgid; } MOSDRepScrubMap() : MOSDFastDispatchOp{MSG_OSD_REP_SCRUBMAP, HEAD_VERSION, COMPAT_VERSION} {} MOSDRepScrubMap(spg_t pgid, epoch_t map_epoch, pg_shard_t from) : MOSDFastDispatchOp{MSG_OSD_REP_SCRUBMAP, HEAD_VERSION, COMPAT_VERSION}, pgid(pgid), map_epoch(map_epoch), from(from) {} private: ~MOSDRepScrubMap() final {} public: std::string_view get_type_name() const override { return "rep_scrubmap"; } void print(std::ostream& out) const override { out << "rep_scrubmap(" << pgid << " e" << map_epoch << " from shard " << from << (preempted ? " PREEMPTED":"") << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; encode(pgid, payload); encode(map_epoch, payload); encode(from, payload); encode(preempted, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(pgid, p); decode(map_epoch, p); decode(from, p); if (header.version >= 2) { decode(preempted, p); } } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,196
24.847059
79
h
null
ceph-main/src/messages/MOSDScrub2.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #pragma once #include "msg/Message.h" /* * instruct an OSD to scrub some or all pg(s) */ class MOSDScrub2 final : public Message { public: static constexpr int HEAD_VERSION = 1; static constexpr int COMPAT_VERSION = 1; uuid_d fsid; epoch_t epoch; std::vector<spg_t> scrub_pgs; bool repair = false; bool deep = false; MOSDScrub2() : Message{MSG_OSD_SCRUB2, HEAD_VERSION, COMPAT_VERSION} {} MOSDScrub2(const uuid_d& f, epoch_t e, std::vector<spg_t>& pgs, bool r, bool d) : Message{MSG_OSD_SCRUB2, HEAD_VERSION, COMPAT_VERSION}, fsid(f), epoch(e), scrub_pgs(pgs), repair(r), deep(d) {} private: ~MOSDScrub2() final {} public: std::string_view get_type_name() const override { return "scrub2"; } void print(std::ostream& out) const override { out << "scrub2(" << scrub_pgs; if (repair) out << " repair"; if (deep) out << " deep"; out << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; encode(fsid, payload); encode(epoch, payload); encode(scrub_pgs, payload); encode(repair, payload); encode(deep, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(fsid, p); decode(epoch, p); decode(scrub_pgs, p); decode(repair, p); decode(deep, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); };
1,559
24.16129
83
h
null
ceph-main/src/messages/MOSDScrubReserve.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MOSDSCRUBRESERVE_H #define CEPH_MOSDSCRUBRESERVE_H #include "MOSDFastDispatchOp.h" class MOSDScrubReserve : public MOSDFastDispatchOp { private: static constexpr int HEAD_VERSION = 1; static constexpr int COMPAT_VERSION = 1; public: spg_t pgid; epoch_t map_epoch; enum { REQUEST = 0, GRANT = 1, RELEASE = 2, REJECT = 3, }; int32_t type; pg_shard_t from; epoch_t get_map_epoch() const override { return map_epoch; } spg_t get_spg() const override { return pgid; } MOSDScrubReserve() : MOSDFastDispatchOp{MSG_OSD_SCRUB_RESERVE, HEAD_VERSION, COMPAT_VERSION}, map_epoch(0), type(-1) {} MOSDScrubReserve(spg_t pgid, epoch_t map_epoch, int type, pg_shard_t from) : MOSDFastDispatchOp{MSG_OSD_SCRUB_RESERVE, HEAD_VERSION, COMPAT_VERSION}, pgid(pgid), map_epoch(map_epoch), type(type), from(from) {} std::string_view get_type_name() const { return "MOSDScrubReserve"; } void print(std::ostream& out) const { out << "MOSDScrubReserve(" << pgid << " "; switch (type) { case REQUEST: out << "REQUEST "; break; case GRANT: out << "GRANT "; break; case REJECT: out << "REJECT "; break; case RELEASE: out << "RELEASE "; break; } out << "e" << map_epoch << ")"; return; } void decode_payload() { using ceph::decode; auto p = payload.cbegin(); decode(pgid, p); decode(map_epoch, p); decode(type, p); decode(from, p); } void encode_payload(uint64_t features) { using ceph::encode; encode(pgid, payload); encode(map_epoch, payload); encode(type, payload); encode(from, payload); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,279
21.8
78
h
null
ceph-main/src/messages/MPGStats.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MPGSTATS_H #define CEPH_MPGSTATS_H #include "osd/osd_types.h" #include "messages/PaxosServiceMessage.h" class MPGStats final : public PaxosServiceMessage { static constexpr int HEAD_VERSION = 2; static constexpr int COMPAT_VERSION = 1; public: uuid_d fsid; std::map<pg_t, pg_stat_t> pg_stat; osd_stat_t osd_stat; std::map<int64_t, store_statfs_t> pool_stat; epoch_t epoch = 0; MPGStats() : PaxosServiceMessage{MSG_PGSTATS, 0, HEAD_VERSION, COMPAT_VERSION} {} MPGStats(const uuid_d& f, epoch_t e) : PaxosServiceMessage{MSG_PGSTATS, 0, HEAD_VERSION, COMPAT_VERSION}, fsid(f), epoch(e) {} private: ~MPGStats() final {} public: std::string_view get_type_name() const override { return "pg_stats"; } void print(std::ostream& out) const override { out << "pg_stats(" << pg_stat.size() << " pgs seq " << osd_stat.seq << " v " << version << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); encode(fsid, payload); encode(osd_stat, payload, features); encode(pg_stat, payload); encode(epoch, payload); encode(utime_t{}, payload); encode(pool_stat, payload, features); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(fsid, p); decode(osd_stat, p); if (osd_stat.num_osds == 0) { // for the benefit of legacy OSDs who don't set this field osd_stat.num_osds = 1; } decode(pg_stat, p); decode(epoch, p); utime_t dummy; decode(dummy, p); if (header.version >= 2) decode(pool_stat, p); } }; #endif
2,087
25.769231
99
h
null
ceph-main/src/messages/MPGStatsAck.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MPGSTATSACK_H #define CEPH_MPGSTATSACK_H #include "osd/osd_types.h" class MPGStatsAck final : public Message { public: std::map<pg_t,std::pair<version_t,epoch_t> > pg_stat; MPGStatsAck() : Message{MSG_PGSTATSACK} {} private: ~MPGStatsAck() final {} public: std::string_view get_type_name() const override { return "pg_stats_ack"; } void print(std::ostream& out) const override { out << "pg_stats_ack(" << pg_stat.size() << " pgs tid " << get_tid() << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; encode(pg_stat, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(pg_stat, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
1,277
24.56
80
h
null
ceph-main/src/messages/MPing.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MPING_H #define CEPH_MPING_H #include "msg/Message.h" class MPing final : public Message { public: MPing() : Message{CEPH_MSG_PING} {} private: ~MPing() final {} public: void decode_payload() override { } void encode_payload(uint64_t features) override { } std::string_view get_type_name() const override { return "ping"; } }; #endif
791
22.294118
71
h
null
ceph-main/src/messages/MPoolOp.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MPOOLOP_H #define CEPH_MPOOLOP_H #include "messages/PaxosServiceMessage.h" class MPoolOp final : public PaxosServiceMessage { private: static constexpr int HEAD_VERSION = 4; static constexpr int COMPAT_VERSION = 2; public: uuid_d fsid; __u32 pool = 0; std::string name; __u32 op = 0; snapid_t snapid; __s16 crush_rule = 0; MPoolOp() : PaxosServiceMessage{CEPH_MSG_POOLOP, 0, HEAD_VERSION, COMPAT_VERSION} {} MPoolOp(const uuid_d& f, ceph_tid_t t, int p, std::string& n, int o, version_t v) : PaxosServiceMessage{CEPH_MSG_POOLOP, v, HEAD_VERSION, COMPAT_VERSION}, fsid(f), pool(p), name(n), op(o), snapid(0), crush_rule(0) { set_tid(t); } private: ~MPoolOp() final {} public: std::string_view get_type_name() const override { return "poolop"; } void print(std::ostream& out) const override { out << "pool_op(" << ceph_pool_op_name(op) << " pool " << pool << " tid " << get_tid() << " name " << name << " v" << version << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); encode(fsid, payload); encode(pool, payload); encode(op, payload); encode((uint64_t)0, payload); encode(snapid, payload); encode(name, payload); __u8 pad = 0; encode(pad, payload); /* for v3->v4 encoding change */ encode(crush_rule, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(fsid, p); decode(pool, p); if (header.version < 2) decode(name, p); decode(op, p); uint64_t old_auid; decode(old_auid, p); decode(snapid, p); if (header.version >= 2) decode(name, p); if (header.version >= 3) { __u8 pad; decode(pad, p); if (header.version >= 4) decode(crush_rule, p); else crush_rule = pad; } else crush_rule = -1; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,484
24.10101
83
h
null
ceph-main/src/messages/MPoolOpReply.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MPOOLOPREPLY_H #define CEPH_MPOOLOPREPLY_H #include "common/errno.h" class MPoolOpReply : public PaxosServiceMessage { public: uuid_d fsid; __u32 replyCode = 0; epoch_t epoch = 0; ceph::buffer::list response_data; MPoolOpReply() : PaxosServiceMessage{CEPH_MSG_POOLOP_REPLY, 0} {} MPoolOpReply( uuid_d& f, ceph_tid_t t, int rc, int e, version_t v) : PaxosServiceMessage{CEPH_MSG_POOLOP_REPLY, v}, fsid(f), replyCode(rc), epoch(e) { set_tid(t); } MPoolOpReply(uuid_d& f, ceph_tid_t t, int rc, int e, version_t v, ceph::buffer::list *blp) : PaxosServiceMessage{CEPH_MSG_POOLOP_REPLY, v}, fsid(f), replyCode(rc), epoch(e) { set_tid(t); if (blp) response_data = std::move(*blp); } std::string_view get_type_name() const override { return "poolopreply"; } void print(std::ostream& out) const override { out << "pool_op_reply(tid " << get_tid() << " " << cpp_strerror(-replyCode) << " v" << version << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); encode(fsid, payload); encode(replyCode, payload); encode(epoch, payload); if (response_data.length()) { encode(true, payload); encode(response_data, payload); } else encode(false, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(fsid, p); decode(replyCode, p); decode(epoch, p); bool has_response_data; decode(has_response_data, p); if (has_response_data) { decode(response_data, p); } } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,209
24.697674
75
h
null
ceph-main/src/messages/MRecoveryReserve.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MRECOVERY_H #define CEPH_MRECOVERY_H #include "msg/Message.h" #include "messages/MOSDPeeringOp.h" #include "osd/PGPeeringEvent.h" class MRecoveryReserve : public MOSDPeeringOp { private: static constexpr int HEAD_VERSION = 3; static constexpr int COMPAT_VERSION = 2; public: spg_t pgid; epoch_t query_epoch; enum { REQUEST = 0, // primary->replica: please reserve slot GRANT = 1, // replica->primary: ok, i reserved it RELEASE = 2, // primary->replica: release the slot i reserved before REVOKE = 3, // replica->primary: i'm taking back the slot i gave you }; uint32_t type; uint32_t priority = 0; spg_t get_spg() const { return pgid; } epoch_t get_map_epoch() const { return query_epoch; } epoch_t get_min_epoch() const { return query_epoch; } PGPeeringEvent *get_event() override { switch (type) { case REQUEST: return new PGPeeringEvent( query_epoch, query_epoch, RequestRecoveryPrio(priority)); case GRANT: return new PGPeeringEvent( query_epoch, query_epoch, RemoteRecoveryReserved()); case RELEASE: return new PGPeeringEvent( query_epoch, query_epoch, RecoveryDone()); case REVOKE: return new PGPeeringEvent( query_epoch, query_epoch, DeferRecovery(0.0)); default: ceph_abort(); } } MRecoveryReserve() : MOSDPeeringOp{MSG_OSD_RECOVERY_RESERVE, HEAD_VERSION, COMPAT_VERSION}, query_epoch(0), type(-1) {} MRecoveryReserve(int type, spg_t pgid, epoch_t query_epoch, unsigned prio = 0) : MOSDPeeringOp{MSG_OSD_RECOVERY_RESERVE, HEAD_VERSION, COMPAT_VERSION}, pgid(pgid), query_epoch(query_epoch), type(type), priority(prio) {} std::string_view get_type_name() const override { return "MRecoveryReserve"; } void inner_print(std::ostream& out) const override { switch (type) { case REQUEST: out << "REQUEST"; break; case GRANT: out << "GRANT"; break; case RELEASE: out << "RELEASE"; break; case REVOKE: out << "REVOKE"; break; } if (type == REQUEST) out << " prio: " << priority; } void decode_payload() override { auto p = payload.cbegin(); using ceph::decode; decode(pgid.pgid, p); decode(query_epoch, p); decode(type, p); decode(pgid.shard, p); if (header.version >= 3) { decode(priority, p); } } void encode_payload(uint64_t features) override { using ceph::encode; encode(pgid.pgid, payload); encode(query_epoch, payload); encode(type, payload); encode(pgid.shard, payload); encode(priority, payload); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
3,228
23.097015
76
h
null
ceph-main/src/messages/MRemoveSnaps.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MREMOVESNAPS_H #define CEPH_MREMOVESNAPS_H #include "messages/PaxosServiceMessage.h" class MRemoveSnaps final : public PaxosServiceMessage { public: std::map<int32_t, std::vector<snapid_t>> snaps; protected: MRemoveSnaps() : PaxosServiceMessage{MSG_REMOVE_SNAPS, 0} { } MRemoveSnaps(std::map<int, std::vector<snapid_t>>& s) : PaxosServiceMessage{MSG_REMOVE_SNAPS, 0} { snaps.swap(s); } ~MRemoveSnaps() final {} public: std::string_view get_type_name() const override { return "remove_snaps"; } void print(std::ostream& out) const override { out << "remove_snaps(" << snaps << " v" << version << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); encode(snaps, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(snaps, p); ceph_assert(p.end()); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); template<class T, typename... Args> friend MURef<T> crimson::make_message(Args&&... args); }; #endif
1,595
26.050847
76
h
null
ceph-main/src/messages/MRoute.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MROUTE_H #define CEPH_MROUTE_H #include "msg/Message.h" #include "include/encoding.h" class MRoute final : public Message { public: static constexpr int HEAD_VERSION = 3; static constexpr int COMPAT_VERSION = 3; uint64_t session_mon_tid; Message *msg; epoch_t send_osdmap_first; MRoute() : Message{MSG_ROUTE, HEAD_VERSION, COMPAT_VERSION}, session_mon_tid(0), msg(NULL), send_osdmap_first(0) {} MRoute(uint64_t t, Message *m) : Message{MSG_ROUTE, HEAD_VERSION, COMPAT_VERSION}, session_mon_tid(t), msg(m), send_osdmap_first(0) {} private: ~MRoute() final { if (msg) msg->put(); } public: void decode_payload() override { auto p = payload.cbegin(); using ceph::decode; decode(session_mon_tid, p); entity_inst_t dest_unused; decode(dest_unused, p); bool m; decode(m, p); if (m) msg = decode_message(NULL, 0, p); decode(send_osdmap_first, p); } void encode_payload(uint64_t features) override { using ceph::encode; encode(session_mon_tid, payload); entity_inst_t dest_unused; encode(dest_unused, payload, features); bool m = msg ? true : false; encode(m, payload); if (msg) encode_message(msg, features, payload); encode(send_osdmap_first, payload); } std::string_view get_type_name() const override { return "route"; } void print(std::ostream& o) const override { if (msg) o << "route(" << *msg; else o << "route(no-reply"; if (send_osdmap_first) o << " send_osdmap_first " << send_osdmap_first; if (session_mon_tid) o << " tid " << session_mon_tid << ")"; else o << " tid (none)"; } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
2,273
23.989011
71
h
null
ceph-main/src/messages/MServiceMap.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #pragma once #include "msg/Message.h" #include "mgr/ServiceMap.h" class MServiceMap final : public Message { public: ServiceMap service_map; MServiceMap() : Message{MSG_SERVICE_MAP} { } explicit MServiceMap(const ServiceMap& sm) : Message{MSG_SERVICE_MAP}, service_map(sm) { } private: ~MServiceMap() final {} public: std::string_view get_type_name() const override { return "service_map"; } void print(std::ostream& out) const override { out << "service_map(e" << service_map.epoch << " " << service_map.services.size() << " svc)"; } void encode_payload(uint64_t features) override { using ceph::encode; encode(service_map, payload, features); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(service_map, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); };
1,034
24.875
75
h
null
ceph-main/src/messages/MStatfs.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MSTATFS_H #define CEPH_MSTATFS_H #include <optional> #include <sys/statvfs.h> /* or <sys/statfs.h> */ #include "messages/PaxosServiceMessage.h" class MStatfs final : public PaxosServiceMessage { private: static constexpr int HEAD_VERSION = 2; static constexpr int COMPAT_VERSION = 1; public: uuid_d fsid; std::optional<int64_t> data_pool; MStatfs() : PaxosServiceMessage{CEPH_MSG_STATFS, 0, HEAD_VERSION, COMPAT_VERSION} {} MStatfs(const uuid_d& f, ceph_tid_t t, std::optional<int64_t> _data_pool, version_t v) : PaxosServiceMessage{CEPH_MSG_STATFS, v, HEAD_VERSION, COMPAT_VERSION}, fsid(f), data_pool(_data_pool) { set_tid(t); } private: ~MStatfs() final {} public: std::string_view get_type_name() const override { return "statfs"; } void print(std::ostream& out) const override { out << "statfs(" << get_tid() << " pool " << (data_pool ? *data_pool : -1) << " v" << version << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; paxos_encode(); encode(fsid, payload); encode(data_pool, payload); } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); paxos_decode(p); decode(fsid, p); if (header.version >= 2) { decode(data_pool, p); } else { data_pool = std::optional<int64_t> (); } } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
1,937
25.547945
86
h
null
ceph-main/src/messages/MStatfsReply.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil <[email protected]> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MSTATFSREPLY_H #define CEPH_MSTATFSREPLY_H class MStatfsReply : public Message { public: struct ceph_mon_statfs_reply h{}; MStatfsReply() : Message{CEPH_MSG_STATFS_REPLY} {} MStatfsReply(uuid_d &f, ceph_tid_t t, epoch_t epoch) : Message{CEPH_MSG_STATFS_REPLY} { memcpy(&h.fsid, f.bytes(), sizeof(h.fsid)); header.tid = t; h.version = epoch; } std::string_view get_type_name() const override { return "statfs_reply"; } void print(std::ostream& out) const override { out << "statfs_reply(" << header.tid << ")"; } void encode_payload(uint64_t features) override { using ceph::encode; encode(h, payload); } void decode_payload() override { auto p = payload.cbegin(); decode(h, p); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif
1,312
25.26
76
h
null
ceph-main/src/messages/MTimeCheck.h
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2012 Inktank, Inc. * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef CEPH_MTIMECHECK_H #define CEPH_MTIMECHECK_H class MTimeCheck final : public Message { public: static constexpr int HEAD_VERSION = 1; enum { OP_PING = 1, OP_PONG = 2, OP_REPORT = 3, }; int op = 0; version_t epoch = 0; version_t round = 0; utime_t timestamp; map<entity_inst_t, double> skews; map<entity_inst_t, double> latencies; MTimeCheck() : Message{MSG_TIMECHECK, HEAD_VERSION} {} MTimeCheck(int op) : Message{MSG_TIMECHECK, HEAD_VERSION}, op(op) {} private: ~MTimeCheck() final {} public: std::string_view get_type_name() const override { return "time_check"; } const char *get_op_name() const { switch (op) { case OP_PING: return "ping"; case OP_PONG: return "pong"; case OP_REPORT: return "report"; } return "???"; } void print(std::ostream &o) const override { o << "time_check( " << get_op_name() << " e " << epoch << " r " << round; if (op == OP_PONG) { o << " ts " << timestamp; } else if (op == OP_REPORT) { o << " #skews " << skews.size() << " #latencies " << latencies.size(); } o << " )"; } void decode_payload() override { using ceph::decode; auto p = payload.cbegin(); decode(op, p); decode(epoch, p); decode(round, p); decode(timestamp, p); decode(skews, p); decode(latencies, p); } void encode_payload(uint64_t features) override { using ceph::encode; encode(op, payload); encode(epoch, payload); encode(round, payload); encode(timestamp, payload); encode(skews, payload, features); encode(latencies, payload, features); } private: template<class T, typename... Args> friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); }; #endif /* CEPH_MTIMECHECK_H */
2,211
22.784946
74
h