-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* 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
+ * License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
- *
+ *
*/
#include <sys/stat.h>
int lines = 0;
-// refresh every second
-void get_status(bool newmon=false);
-
-struct C_Refresh : public Context {
- void finish(int r) {
- get_status(true);
- }
-};
-
-SafeTimer timer(lock);
-Context *event = 0;
-
-void get_status(bool newmon)
-{
- int mon = monmap.pick_mon(newmon);
-
- vector<string> vcmd(2);
- vcmd[0] = prefix[which];
- vcmd[1] = "stat";
-
- MMonCommand *m = new MMonCommand(monmap.fsid);
- m->cmd.swap(vcmd);
- messenger->send_message(m, monmap.get_inst(mon));
-
- event = new C_Refresh;
- timer.add_event_after(.2, event);
-}
-
void handle_notify(MMonObserveNotify *notify)
{
generic_dout(0) << notify->get_source() << " -> " << get_paxos_name(notify->machine_id) << " v" << notify->ver
switch (notify->machine_id) {
case PAXOS_PGMAP:
{
- PGMap::Incremental inc;
- bufferlist::iterator p = notify->bl.begin();
+ PGMap::Incremental inc;
+ bufferlist::iterator p = notify->bl.begin();
inc.decode(p);
pgmap.apply_incremental(inc);
break;
break;
case PAXOS_CLIENTMAP:
{
- ClientMap::Incremental inc;
+ ClientMap::Incremental inc;
bufferlist::iterator p = notify->bl.begin();
inc.decode(p);
clientmap.apply_incremental(inc);
} dispatcher;
-void usage()
+void usage()
{
cerr << "usage: covserver [options] monhost] command" << std::endl;
cerr << "Options:" << std::endl;
{
bufferlist indata;
for (int i=0; i<PAXOS_NUM; i++) {
- MMonObserve *m = new MMonObserve(monmap.fsid, i, map_ver[i]);
- m->set_data(indata);
- int mon = monmap.pick_mon();
- generic_dout(0) << "mon" << mon << " <- observe " << get_paxos_name(i) << dendl;
- messenger->send_message(m, monmap.get_inst(mon));
+ MMonObserve *m = new MMonObserve(monmap.fsid, i, map_ver[i]);
+ m->set_data(indata);
+ int mon = monmap.pick_mon();
+ generic_dout(0) << "mon" << mon << " <- observe " << get_paxos_name(i) << dendl;
+ messenger->send_message(m, monmap.get_inst(mon));
}
C_ObserverRefresh *observe_refresh_event = new C_ObserverRefresh();
if (mc.get_monmap(&monmap) < 0)
return -1;
memset(map_ver, 0, sizeof(map_ver));
-
+
// start up network
rank.bind();
g_conf.daemonize = false; // not us!
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* 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
+ * License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
- *
+ *
*/
-
+
/*
* The Client Monitor is used for traking the filesystem's clients.
*/
struct client_info_t {
entity_addr_t addr;
utime_t mount_time;
-
+
void encode(bufferlist& bl) const {
::encode(addr, bl);
::encode(mount_time, bl);
else
unmount.insert(client);
}
-
+
void encode(bufferlist &bl) const {
::encode(version, bl);
::encode(next_client, bl);
client_info[p->first] = p->second;
addr_client[p->second.addr] = p->first;
}
-
+
for (set<int32_t>::iterator p = inc.unmount.begin();
p != inc.unmount.end();
++p) {