message: Add a new MMonAdd message type

This commit is contained in:
Greg Farnum 2009-10-07 18:07:47 -07:00
parent b3dfe6eedb
commit 1053856b97
4 changed files with 53 additions and 1 deletions

View File

@ -570,6 +570,7 @@ noinst_HEADERS = \
messages/MMonObserve.h\
messages/MMonObserveNotify.h\
messages/MMonPaxos.h\
messages/MMonAdd.h\
messages/MMonSubscribe.h\
messages/MMonSubscribeAck.h\
messages/MOSDAlive.h\

47
src/messages/MMonAdd.h Normal file
View File

@ -0,0 +1,47 @@
// -*- 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) 2009 Sage Weil <sage@newdream.net>
*
* 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 __MMONADD_H
#define __MMONADD_H
#include "msg/Message.h"
#include "include/types.h"
#include "mon/MonMap.h"
#include "config.h"
class MMonAdd : public Message {
public:
entity_addr_t address;
MMonAdd() : Message(MSG_MON_ADD) {}
MMonAdd(const char *ip) : Message(MSG_MON_ADD) {
parse_ip_port(ip, address);}
MMonAdd(const struct entity_addr_t& addr) :
Message(MSG_MON_ADD), address(addr) {}
const char* get_type_name() { return "mon_add"; }
void print (ostream& o) { o << "mon_add(" << address << ")"; }
void decode_payload() {
bufferlist::iterator p = payload.begin();
::decode(address, p);
}
void encode_payload() {
::encode(address, payload);
}
};
#endif

View File

@ -26,6 +26,7 @@ using namespace std;
#include "messages/MMonCommand.h"
#include "messages/MMonCommandAck.h"
#include "messages/MMonPaxos.h"
#include "messages/MMonAdd.h"
#include "messages/MMonObserve.h"
#include "messages/MMonObserveNotify.h"
@ -218,6 +219,9 @@ Message *decode_message(ceph_msg_header& header, ceph_msg_footer& footer,
case MSG_MON_PAXOS:
m = new MMonPaxos;
break;
case MSG_MON_ADD:
m = new MMonAdd;
break;
case MSG_MON_ELECTION:
m = new MMonElection;

View File

@ -22,7 +22,7 @@
// monitor internal
#define MSG_MON_ELECTION 60
#define MSG_MON_PAXOS 61
#define MSG_MON_ADD 62
/* monitor <-> mon admin tool */
#define MSG_MON_COMMAND 50
#define MSG_MON_COMMAND_ACK 51