[ANN] rev 0.3.1: a libev-based event framework, now with betterfilesystem monitoring

T

Tony Arcieri

[Note: parts of this message were removed to make it a legal post.]

rev 0.3.1 is largely a maintenance/bugfix release, but it comes with a new
feature: configurable filesystem polling intervals.

The previous version introduced Rev::StatWatcher, a simple observer that
notifies you if stat() for a given path changes. Thanks to rev's
libev-based core, rev can do this while monitoring for events on any Ruby IO
object, and all in a single thread. On Linux, filesystem monitoring uses
inotify, a high-performance interface which receives event notifications
directly from the kernel. On all other platforms, libev monitors the
filesystem using stat() polling.

The previous version did not allow you to configure this polling interval,
and used a "default" of approximately 5 seconds intended to maximize
performace. This is unacceptable in some cases where you want filesystem
monitoring closer to realtime.

0.3.1 lets you create new filesystem watchers with a prespecified polling
interval:

Rev::StatWatcher.new("./path/to/interesting/file", 0.5)

This will check the status of the given path every 0.5 seconds rather than
every 5 seconds. Values below 0.1 are not particularly meaningful. On
Linux the polling interval is ignored and events are received as soon as
inotify reports them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top