]> git.proxmox.com Git - ceph.git/blob - ceph/src/tools/cephfs/JournalFilter.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / tools / cephfs / JournalFilter.h
1 // -*- mode:c++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 /*
4 * ceph - scalable distributed file system
5 *
6 * copyright (c) 2014 john spray <john.spray@inktank.com>
7 *
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.
12 */
13
14
15 #ifndef JOURNAL_FILTER_H
16 #define JOURNAL_FILTER_H
17
18 #include "mds/mdstypes.h"
19 #include "mds/LogEvent.h"
20
21 /**
22 * A set of conditions for narrowing down a search through the journal
23 */
24 class JournalFilter
25 {
26 private:
27
28 /* Filtering by journal offset range */
29 uint64_t range_start;
30 uint64_t range_end;
31 static const std::string range_separator;
32
33 /* Filtering by file (sub) path */
34 std::string path_expr;
35
36 /* Filtering by inode */
37 inodeno_t inode;
38
39 /* Filtering by type */
40 LogEvent::EventType event_type;
41
42 /* Filtering by dirfrag */
43 dirfrag_t frag;
44 std::string frag_dentry; //< optional, filter dentry name within fragment
45
46 /* Filtering by metablob client name */
47 entity_name_t client_name;
48
49 public:
50 JournalFilter() :
51 range_start(0),
52 range_end(-1),
53 inode(0),
54 event_type(0) {}
55
56 bool get_range(uint64_t &start, uint64_t &end) const;
57 bool apply(uint64_t pos, LogEvent &le) const;
58 int parse_args(
59 std::vector<const char*> &argv,
60 std::vector<const char*>::iterator &arg);
61 };
62
63 #endif // JOURNAL_FILTER_H
64