1
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2
// vim: ts=8 sw=2 smarttab
4
* Ceph - scalable distributed file system
6
* Copyright (C) 2010 Greg Farnum <gregf@hq.newdream.net>
8
* This is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public
10
* License version 2.1, as published by the Free Software
11
* Foundation. See file COPYING.
14
#ifndef JOURNAL_DUMPER_H_
15
#define JOURNAL_DUMPER_H_
17
#include "osd/OSDMap.h"
18
#include "osdc/Objecter.h"
19
#include "osdc/Journaler.h"
20
#include "msg/Dispatcher.h"
21
#include "msg/Messenger.h"
22
#include "msg/SimpleMessenger.h"
23
#include "auth/Auth.h"
26
* This class lets you dump out an mds journal for troubleshooting or whatever.
28
* It was built to work with cmds so some of the design choices are random.
29
* To use, create a Dumper, call init(), and then call dump() with the name
30
* of the file to dump to.
33
class Dumper : public Dispatcher {
38
SimpleMessenger *messenger;
44
* The messenger should be a valid SimpleMessenger. You should call bind()
45
* before passing it in, but not do anything else.
46
* The MonClient needs to be valid, and you should have called
47
* build_initial_monmap().
49
Dumper(SimpleMessenger *messenger_, MonClient *monc_) :
50
messenger(messenger_),
52
lock("Dumper::lock"), timer(lock)
57
bool ms_dispatch(Message *m) {
58
switch (m->get_type()) {
59
case CEPH_MSG_OSD_OPREPLY:
60
objecter->handle_osd_op_reply((MOSDOpReply *)m);
62
case CEPH_MSG_OSD_MAP:
63
objecter->handle_osd_map((MOSDMap*)m);
70
bool ms_handle_reset(Connection *con) { return false; }
71
void ms_handle_remote_reset(Connection *con) {}
72
bool ms_get_authorizer(int dest_type, AuthAuthorizer **authorizer,
76
void dump(const char *dumpfile);
79
#endif /* JOURNAL_DUMPER_H_ */