summaryrefslogtreecommitdiffstats
path: root/src/mon/ClassMonitor.h
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@hq.newdream.net>2009-05-09 01:33:30 +0200
committerSage Weil <sage@newdream.net>2009-05-12 00:30:17 +0200
commitdbe457f5d776a19a4bbdf1e87bf99a17801e43fd (patch)
treed90a924d760fd8b119d57f69a4d95c6cc4b79e3b /src/mon/ClassMonitor.h
parentc3: exec op string (diff)
downloadceph-dbe457f5d776a19a4bbdf1e87bf99a17801e43fd.tar.xz
ceph-dbe457f5d776a19a4bbdf1e87bf99a17801e43fd.zip
class: add a class monitor for the paxos services
Diffstat (limited to 'src/mon/ClassMonitor.h')
-rw-r--r--src/mon/ClassMonitor.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/mon/ClassMonitor.h b/src/mon/ClassMonitor.h
new file mode 100644
index 00000000000..f9b972d213e
--- /dev/null
+++ b/src/mon/ClassMonitor.h
@@ -0,0 +1,69 @@
+// -*- 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 __CLASSMONITOR_H
+#define __CLASSMONITOR_H
+
+#include <map>
+#include <set>
+using namespace std;
+
+#include "include/types.h"
+#include "msg/Messenger.h"
+#include "PaxosService.h"
+
+#include "include/ClassEntry.h"
+
+class MMonCommand;
+class MClass;
+
+class ClassMonitor : public PaxosService {
+private:
+ multimap<utime_t,ClassLibraryIncremental> pending_class;
+ ClassList pending_list, list;
+
+ void create_initial(bufferlist& bl);
+ bool update_from_paxos();
+ void create_pending(); // prepare a new pending
+ void encode_pending(bufferlist &bl); // propose pending update to peers
+
+ void committed();
+
+ bool preprocess_query(Message *m); // true if processed.
+ bool prepare_update(Message *m);
+
+ bool preprocess_class(MClass *m);
+ bool prepare_class(MClass *m);
+ void _updated_class(MClass *m, entity_inst_t who);
+
+ struct C_Class : public Context {
+ ClassMonitor *classmon;
+ MClass *ack;
+ entity_inst_t who;
+ C_Class(ClassMonitor *p, MClass *a, entity_inst_t w) : classmon(p), ack(a), who(w) {}
+ void finish(int r) {
+ classmon->_updated_class(ack, who);
+ }
+ };
+
+ bool preprocess_command(MMonCommand *m);
+ bool prepare_command(MMonCommand *m);
+
+ public:
+ ClassMonitor(Monitor *mn, Paxos *p) : PaxosService(mn, p) { }
+
+ void tick(); // check state, take actions
+};
+
+#endif