]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
new monitor messages
authorsage <sage@29311d96-e01e-0410-9327-a35deaab8ce9>
Fri, 18 Aug 2006 15:52:14 +0000 (15:52 +0000)
committersage <sage@29311d96-e01e-0410-9327-a35deaab8ce9>
Fri, 18 Aug 2006 15:52:14 +0000 (15:52 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@796 29311d96-e01e-0410-9327-a35deaab8ce9

ceph/include/types.h
ceph/messages/MMonElectionAck.h [new file with mode: 0644]
ceph/messages/MMonElectionCollect.h [new file with mode: 0644]
ceph/messages/MMonElectionRefresh.h [new file with mode: 0644]
ceph/messages/MMonElectionStatus.h [new file with mode: 0644]
ceph/msg/Dispatcher.h
ceph/msg/Message.cc
ceph/msg/Message.h

index e7fa43406711f70e7e6b009d63c5cd4352d6fa7d..d339a4894ebfd303e90497d5f73d31913b3cc603 100644 (file)
@@ -278,12 +278,14 @@ typedef __uint64_t object_t;      // object id
 
 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) {}
 };
 
@@ -296,6 +298,17 @@ inline ostream& operator<<(ostream& out, OSDSuperblock& sb)
                         << "])";
 }
 
+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
 
diff --git a/ceph/messages/MMonElectionAck.h b/ceph/messages/MMonElectionAck.h
new file mode 100644 (file)
index 0000000..f4510e6
--- /dev/null
@@ -0,0 +1,46 @@
+// -*- 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
diff --git a/ceph/messages/MMonElectionCollect.h b/ceph/messages/MMonElectionCollect.h
new file mode 100644 (file)
index 0000000..aa722b4
--- /dev/null
@@ -0,0 +1,42 @@
+// -*- 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
diff --git a/ceph/messages/MMonElectionRefresh.h b/ceph/messages/MMonElectionRefresh.h
new file mode 100644 (file)
index 0000000..cad85f5
--- /dev/null
@@ -0,0 +1,50 @@
+// -*- 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
diff --git a/ceph/messages/MMonElectionStatus.h b/ceph/messages/MMonElectionStatus.h
new file mode 100644 (file)
index 0000000..2cac0c0
--- /dev/null
@@ -0,0 +1,49 @@
+// -*- 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
index c7d6f57783d5eedd8ffa84024b30848f77e091e9..3b3984a7ad745ffea136cf720ef6613a61e006da 100644 (file)
@@ -31,7 +31,7 @@ class Dispatcher {
   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);
index f0195f6895f629e544fb03ad47d282e24eaa474e..749fedd658fef07362c4d9dc364a0a9cf78d4a28 100644 (file)
@@ -17,6 +17,11 @@ using namespace std;
 #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"
@@ -146,6 +151,19 @@ decode_message(msg_envelope_t& env, bufferlist& payload)
        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;
index 68220c8165844430db861b40e4a6372be901ca5a..bc47cd5f4aec7508e8316d74c8fbde89d927ff89 100644 (file)
 #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
@@ -48,6 +55,9 @@
 
 #define MSG_OSD_FAILURE      27
 
+
+
+
 #define MSG_OSD_PG_NOTIFY      50
 #define MSG_OSD_PG_QUERY       51
 #define MSG_OSD_PG_SUMMARY     52