mon/OSDMonitor.o\
mon/MDSMonitor.o\
mon/ClientMonitor.o\
+ mon/PGMonitor.o\
mon/Elector.o\
mon/MonitorStore.o
#include "OSDMonitor.h"
#include "MDSMonitor.h"
#include "ClientMonitor.h"
+#include "PGMonitor.h"
#include "config.h"
#undef dout
osdmon = new OSDMonitor(this, &paxos_osdmap);
mdsmon = new MDSMonitor(this, &paxos_mdsmap);
clientmon = new ClientMonitor(this, &paxos_clientmap);
+ pgmon = new PGMonitor(this, &paxos_pgmap);
// init paxos
paxos_test.init();
paxos_osdmap.init();
paxos_mdsmap.init();
paxos_clientmap.init();
+ paxos_pgmap.init();
// i'm ready!
messenger->set_dispatcher(this);
if (osdmon) delete osdmon;
if (mdsmon) delete mdsmon;
if (clientmon) delete clientmon;
+ if (pgmon) delete pgmon;
// die.
messenger->shutdown();
paxos_mdsmap.leader_init();
paxos_osdmap.leader_init();
paxos_clientmap.leader_init();
+ paxos_pgmap.leader_init();
// init
osdmon->election_finished();
mdsmon->election_finished();
clientmon->election_finished();
+ pgmon->election_finished();
}
void Monitor::lose_election(epoch_t epoch, int l)
paxos_mdsmap.peon_init();
paxos_osdmap.peon_init();
paxos_clientmap.peon_init();
+ paxos_pgmap.peon_init();
// init
osdmon->election_finished();
mdsmon->election_finished();
clientmon->election_finished();
+ pgmon->election_finished();
}
class OSDMonitor;
class MDSMonitor;
class ClientMonitor;
-
+class PGMonitor;
class Monitor : public Dispatcher {
public:
Paxos paxos_mdsmap;
Paxos paxos_osdmap;
Paxos paxos_clientmap;
+ Paxos paxos_pgmap;
friend class Paxos;
OSDMonitor *osdmon;
MDSMonitor *mdsmon;
ClientMonitor *clientmon;
+ PGMonitor *pgmon;
friend class OSDMonitor;
friend class MDSMonitor;
friend class ClientMonitor;
+ friend class PGMonitor;
// messages
paxos_mdsmap(this, w, PAXOS_MDSMAP),
paxos_osdmap(this, w, PAXOS_OSDMAP),
paxos_clientmap(this, w, PAXOS_CLIENTMAP),
+ paxos_pgmap(this, w, PAXOS_PGMAP),
osdmon(0), mdsmon(0), clientmon(0)
{
--- /dev/null
+// -*- 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 <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 __PGMAP_H
+#define __PGMAP_H
+
+#include "osd/osd_types.h"
+
+class PGMap {
+
+public:
+ class Incremental {
+
+ };
+
+
+};
+
+#endif
--- /dev/null
+// -*- 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 <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 __PGMONITOR_H
+#define __PGMONITOR_H
+
+#include <map>
+#include <set>
+using namespace std;
+
+#include "include/types.h"
+#include "msg/Messenger.h"
+#include "PaxosService.h"
+
+#include "PGMap.h"
+
+class PGMonitor : public PaxosService {
+public:
+
+
+private:
+ PGMap pg_map;
+ PGMap::Incremental pending_inc;
+
+ void create_initial();
+ bool update_from_paxos();
+ void create_pending(); // prepare a new pending
+ void encode_pending(bufferlist &bl); // propose pending update to peers
+
+ bool preprocess_query(Message *m); // true if processed.
+ bool prepare_update(Message *m);
+
+
+ public:
+ PGMonitor(Monitor *mn, Paxos *p) : PaxosService(mn, p) { }
+
+ //void tick(); // check state, take actions
+
+};
+
+#endif
#define PAXOS_MDSMAP 1
#define PAXOS_OSDMAP 2
#define PAXOS_CLIENTMAP 3
+#define PAXOS_PGMAP 4
inline const char *get_paxos_name(int p) {
switch (p) {
case PAXOS_MDSMAP: return "mdsmap";
case PAXOS_OSDMAP: return "osdmap";
case PAXOS_CLIENTMAP: return "clientmap";
+ case PAXOS_PGMAP: return "pgmap";
default: assert(0); return 0;
}
}