ceph/branches/riccardo/monitor2/mon/MDSMonitor.h
riccardo80 07ac5d3e74 creating branch for distributed monitor
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1068 29311d96-e01e-0410-9327-a35deaab8ce9
2007-02-01 05:43:23 +00:00

75 lines
1.6 KiB
C++

// -*- mode:C++; tab-width:8; 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 __MDSMONITOR_H
#define __MDSMONITOR_H
#include <map>
#include <set>
using namespace std;
#include "include/types.h"
#include "msg/Messenger.h"
#include "mds/MDSMap.h"
class Monitor;
class MDSMonitor : public Dispatcher {
Monitor *mon;
Messenger *messenger;
Mutex &lock;
// mds maps
public:
MDSMap mdsmap;
private:
map<epoch_t, bufferlist> maps;
//map<epoch_t, bufferlist> inc_maps;
//MDSMap::Incremental pending_inc;
map<msg_addr_t,entity_inst_t> awaiting_map;
// maps
void create_initial();
void send_current(); // send current map to waiters.
void send_full(msg_addr_t dest, const entity_inst_t& inst);
void bcast_latest_mds();
//void accept_pending(); // accept pending, new map.
//void send_incremental(epoch_t since, msg_addr_t dest);
void handle_mds_boot(class MMDSBoot *m);
void handle_mds_failure(class MMDSFailure *m);
void handle_mds_getmap(class MMDSGetMap *m);
void handle_mds_shutdown(Message *m);
public:
MDSMonitor(Monitor *mn, Messenger *m, Mutex& l) : mon(mn), messenger(m), lock(l) {
create_initial();
}
void dispatch(Message *m);
void tick(); // check state, take actions
void send_latest(msg_addr_t dest, const entity_inst_t& inst);
};
#endif