class OSDSuperblock {
public:
+ const static __uint64_t MAGIC = 0xeb0f505dULL;
+ __uint64_t magic;
__uint64_t fsid; // unique fs id (random number)
int whoami; // my role in this fs.
epoch_t current_epoch; // most recent epoch
epoch_t oldest_map, newest_map; // oldest/newest maps we have.
OSDSuperblock(__uint64_t f=0, int w=0) :
- fsid(f), whoami(w),
+ magic(MAGIC), fsid(f), whoami(w),
current_epoch(0), oldest_map(0), newest_map(0) {}
};
<< "])";
}
+class MonSuperblock {
+public:
+ const static __uint64_t MAGIC = 0x00eb0f5000ULL;
+ __uint64_t magic;
+ __uint64_t fsid;
+ int whoami; // mon #
+ epoch_t current_epoch;
+ MonSuperblock(__uint64_t f=0, int w=0) :
+ magic(MAGIC), fsid(f), whoami(w), current_epoch(0) {}
+};
+
// new types
--- /dev/null
+// -*- mode:C++; tab-width:4; c-basic-offset:2; indent-tabs-mode:t -*-
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2004-2006 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 __MMONELECTIONACK_H
+#define __MMONELECTIONACK_H
+
+#include "msg/Message.h"
+
+
+class MMonElectionAck : public Message {
+ public:
+ int q;
+ int refresh_num;
+
+ MMonElectionAck() {}
+ MMonElectionAck(int _q, int _n) :
+ Message(MSG_MON_ELECTION_ACK),
+ q(_q), refresh_num(_n) {}
+
+ void decode_payload() {
+ int off = 0;
+ payload.copy(off, sizeof(q), (char*)&q);
+ off += sizeof(q);
+ payload.copy(off, sizeof(refresh_num), (char*)&refresh_num);
+ off += sizeof(refresh_num);
+ }
+ void encode_payload() {
+ payload.append((char*)&q, sizeof(q));
+ payload.append((char*)&refresh_num, sizeof(refresh_num));
+ }
+
+ virtual char *get_type_name() { return "MonElAck"; }
+};
+
+#endif
--- /dev/null
+// -*- mode:C++; tab-width:4; c-basic-offset:2; indent-tabs-mode:t -*-
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2004-2006 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 __MMONELECTIONCOLLECT_H
+#define __MMONELECTIONCOLLECT_H
+
+#include "msg/Message.h"
+
+
+class MMonElectionCollect : public Message {
+ public:
+ int read_num;
+
+ MMonElectionCollect() {}
+ MMonElectionCollect(int n) :
+ Message(MSG_MON_ELECTION_COLLECT),
+ read_num(n) {}
+
+ void decode_payload() {
+ int off = 0;
+ payload.copy(off, sizeof(read_num), (char*)&read_num);
+ off += sizeof(read_num);
+ }
+ void encode_payload() {
+ payload.append((char*)&read_num, sizeof(read_num));
+ }
+
+ virtual char *get_type_name() { return "MonElCollect"; }
+};
+
+#endif
--- /dev/null
+// -*- mode:C++; tab-width:4; c-basic-offset:2; indent-tabs-mode:t -*-
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2004-2006 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 __MMONELECTIONREFRESH_H
+#define __MMONELECTIONREFRESH_H
+
+#include "msg/Message.h"
+
+
+class MMonElectionRefresh : public Message {
+ public:
+ int p;
+ int state;
+ int refresh_num;
+
+ MMonElectionRefresh() {}
+ MMonElectionRefresh(int _p, int s, int r) :
+ Message(MSG_MON_ELECTION_REFRESH),
+ p(_p), state(s), refresh_num(r) {}
+
+ void decode_payload() {
+ int off = 0;
+ payload.copy(off, sizeof(p), (char*)&p);
+ off += sizeof(p);
+ payload.copy(off, sizeof(state), (char*)&state);
+ off += sizeof(state);
+ payload.copy(off, sizeof(refresh_num), (char*)&refresh_num);
+ off += sizeof(refresh_num);
+ }
+ void encode_payload() {
+ payload.append((char*)&p, sizeof(p));
+ payload.append((char*)&state, sizeof(state));
+ payload.append((char*)&refresh_num, sizeof(refresh_num));
+ }
+
+ virtual char *get_type_name() { return "MonElRefresh"; }
+};
+
+#endif
--- /dev/null
+// -*- mode:C++; tab-width:4; c-basic-offset:2; indent-tabs-mode:t -*-
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2004-2006 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 __MMONELECTIONSTATUS_H
+#define __MMONELECTIONSTATUS_H
+
+#include "msg/Message.h"
+
+
+class MMonElectionStatus : public Message {
+ public:
+ int q;
+ int read_num;
+ map<int,int> registry;
+
+ MMonElectionStatus() {}
+ MMonElectionStatus(int _q, int r) :
+ Message(MSG_MON_ELECTION_STATUS),
+ q(_q), read_num(r) {}
+
+ void decode_payload() {
+ int off = 0;
+ payload.copy(off, sizeof(q), (char*)&q);
+ off += sizeof(q);
+ payload.copy(off, sizeof(read_num), (char*)&read_num);
+ off += sizeof(read_num);
+ ::_decode(registry, payload, off);
+ }
+ void encode_payload() {
+ payload.append((char*)&q, sizeof(q));
+ payload.append((char*)&read_num, sizeof(read_num));
+ ::_encode(registry, payload);
+ }
+
+ virtual char *get_type_name() { return "MonElStatus"; }
+};
+
+#endif
virtual Message *ms_handle_failure(msg_addr_t dest, entity_inst_t& inst) { return 0; }
// lookups
- virtual bool ms_lookup(msg_addr_t dest, entity_inst_t& inst) { assert(0); }
+ virtual bool ms_lookup(msg_addr_t dest, entity_inst_t& inst) { assert(0); return 0; }
// this is how i send messages
//int send_message(Message *m, msg_addr_t dest, int dest_port);
#include "messages/MNSLookupReply.h"
#include "messages/MNSFailure.h"
+#include "messages/MMonElectionAck.h"
+#include "messages/MMonElectionCollect.h"
+#include "messages/MMonElectionRefresh.h"
+#include "messages/MMonElectionStatus.h"
+
#include "messages/MPing.h"
#include "messages/MPingAck.h"
#include "messages/MFailure.h"
m = new MNSFailure();
break;
+ case MSG_MON_ELECTION_ACK:
+ m = new MMonElectionAck();
+ break;
+ case MSG_MON_ELECTION_COLLECT:
+ m = new MMonElectionCollect();
+ break;
+ case MSG_MON_ELECTION_REFRESH:
+ m = new MMonElectionRefresh();
+ break;
+ case MSG_MON_ELECTION_STATUS:
+ m = new MMonElectionStatus();
+ break;
+
case MSG_PING:
m = new MPing();
break;
#define MSG_SHUTDOWN 99999
+#define MSG_MON_ELECTION_ACK 15
+#define MSG_MON_ELECTION_COLLECT 16
+#define MSG_MON_ELECTION_REFRESH 17
+#define MSG_MON_ELECTION_STATUS 18
+
+
+
#define MSG_OSD_OP 20 // delete, etc.
#define MSG_OSD_OPREPLY 21 // delete, etc.
#define MSG_OSD_PING 22
#define MSG_OSD_FAILURE 27
+
+
+
#define MSG_OSD_PG_NOTIFY 50
#define MSG_OSD_PG_QUERY 51
#define MSG_OSD_PG_SUMMARY 52