1
/* This file is part of Strigi Desktop Search
3
* Copyright (C) 2006 Flavio Castelli <flavio.castelli@gmail.com>
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Library General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Library General Public License for more details.
15
* You should have received a copy of the GNU Library General Public License
16
* along with this library; see the file COPYING.LIB. If not, write to
17
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
* Boston, MA 02110-1301, USA.
20
#ifndef INOTIFYLISTENER_H
21
#define INOTIFYLISTENER_H
23
#include "fslistener.h"
24
#include "strigi_thread.h"
29
class PollingListener;
31
class InotifyEvent : public FsEvent
34
InotifyEvent(int watchID, const std::string& watchName,
35
struct inotify_event* event);
37
const std::string description();
40
struct inotify_event* event() { return m_event;}
42
int watchID() { return m_watchID;}
43
std::string watchName() { return m_watchName;}
46
struct inotify_event* m_event;
47
std::string m_watchName;
53
* @class InotifyListener
54
* @brief Uses linux kernel inotify facility in order to keep strigi's index updated.
56
class InotifyListener : public FsListener
63
explicit InotifyListener(std::set<std::string>& indexedDirs);
65
virtual ~InotifyListener();
70
void stopMonitoring();
74
FsEvent* retrieveEvent();
75
bool isEventValid(FsEvent* event);
76
bool isEventInteresting (FsEvent * event);
78
void dirRemoved (std::string dir, std::vector<Event*>& events);
81
bool addWatch (const std::string& path);