FilePoller.qm.dox.h
// -*- mode: c++; indent-tabs-mode: nil -*-
/* FilePoller.qm Copyright (C) 2014 - 2017 Qore Technologies s.r.o.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
// make sure we have the required qore version
namespace FilePoller {
class FilePoller {
public:
public :
const OrderAsc = 0;
const OrderDesc = 1;
const SortNone = 0;
const SortName = 1;
const SortDate = 2;
const Options = (
"log_info",
"log_detail",
"log_debug",
"poll_interval",
"reopt",
"sleep",
"sort_order",
"sort_type",
"start_thread",
);
const RequiredKeys = (
"sleep",
"start_thread",
);
public:
private :
string path;
string mask;
int poll_interval = 10;
bool runflag = False;
bool fatal = False;
int pollcnt = 0;
int sort_type = SortName;
int sort_order = OrderAsc;
Qore::Thread::Mutex m();
int tid;
Qore::Thread::Counter sc();
int reopt;
*softint minage;
*code log_info;
*code log_detail;
*code log_debug;
*code start_thread;
*code sleep;
public:
constructor(string n_path, string n_mask, *hash n_opts);
destructor();
list getFiles(int sort = FilePoller::SortNone, int order = FilePoller::OrderAsc);
int start();
stop();
stopNoWait();
waitStop();
startInline();
bool runOnce();
private:
fileSleep(softint secs);
public:
private:
run();
public:
fileEvent(list files);
abstract singleFileEvent(hash fih);
static checkPath(string path, string type, bool write = False);
int getPollCount();
private:
logInfo(string fmt);
public:
private:
logDetail(string fmt);
public:
private:
logDebug(string fmt);
public:
};
};
// END
FilePoller
main module namespace
Definition: FilePoller.qm.dox.h:53
FilePoller::FilePoller::sleep
*code sleep
optional sleep closure
Definition: FilePoller.qm.dox.h:145
Qore::Thread::Mutex
FilePoller::FilePoller::mask
string mask
file name mask
Definition: FilePoller.qm.dox.h:97
FilePoller::FilePoller::log_info
*code log_info
optional info log closure
Definition: FilePoller.qm.dox.h:133
False
const False
sort
auto sort(auto arg)
list
list list(...)
FilePoller::FilePoller::tid
int tid
polling tid
Definition: FilePoller.qm.dox.h:121
Qore::Thread::Counter
type
string type(auto arg)
FilePoller::FilePoller::minage
*softint minage
minimum file age in seconds before the file will be included in the list returned ...
Definition: FilePoller.qm.dox.h:130
FilePoller::FilePoller::log_detail
*code log_detail
optional detail log closure
Definition: FilePoller.qm.dox.h:136
FilePoller::FilePoller::log_debug
*code log_debug
optional debug log closure
Definition: FilePoller.qm.dox.h:139
hash
hash hash(object obj)
FilePoller::FilePoller::start_thread
*code start_thread
optional start thread closure
Definition: FilePoller.qm.dox.h:142
FilePoller::FilePoller::path
string path
path to monitor
Definition: FilePoller.qm.dox.h:94
FilePoller::FilePoller::reopt
int reopt
regex options
Definition: FilePoller.qm.dox.h:127