FsEventPoller Module Introduction
Module FsEventPoller
provides a high level API for event-driven file and directory monitors.
Available classes:
Constructor Option Hashes
Event options are provided to the above classes with the following option hashes:
Example
%new-style
%require-types
%strict-args
%enable-all-warnings
%requires FsEventPoller
class MyFileEventSource inherits AbstractFsEventPoller {
constructor(string root, *hash<AbstractFsEventPollerOptionInfo> opts) : AbstractFsEventPoller(root, opts) {
}
fileEvent(hash<FsEventInfo> event) {
printf("event: %y\n", event);
}
}
MyFileEventSource events("/");
Counter stop(1);
set_signal_handler(SIGINT, sub () { print("stopping\n"); stop.dec(); });
stop.waitForZero();
File Name Masks and Matching
Any AbstractFsEventPoller can be configured to match file names by:
- A Qore regex-based mask (ex:
"inventory_[A-J].*\.csv"
); Qore regex options can be provided in the reopts
option key
- A glob-style mask (ex:
"*.csv"
)
User can specify one style of mask in the constructor. A FILEPOLLER-ERROR
exception is raised whenever both masks are defined.
Default value for matching is to take all file names.
FsEventPoller Module Release Notes
Initial release