1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
16 #ifndef CEPH_MHEARTBEAT_H
17 #define CEPH_MHEARTBEAT_H
19 #include "include/types.h"
20 #include "msg/Message.h"
22 class MHeartbeat : public Message {
25 map<mds_rank_t, float> import_map;
28 mds_load_t& get_load() { return load; }
29 int get_beat() { return beat; }
31 map<mds_rank_t, float>& get_import_map() {
36 : Message(MSG_MDS_HEARTBEAT), load(utime_t()) { }
37 MHeartbeat(mds_load_t& load, int beat)
38 : Message(MSG_MDS_HEARTBEAT),
43 ~MHeartbeat() override {}
46 const char *get_type_name() const override { return "HB"; }
48 void encode_payload(uint64_t features) override {
49 ::encode(load, payload);
50 ::encode(beat, payload);
51 ::encode(import_map, payload);
53 void decode_payload() override {
54 bufferlist::iterator p = payload.begin();
55 utime_t now(ceph_clock_now());
56 ::decode(load, now, p);
58 ::decode(import_map, p);