[ANN] rev 0.3.0: Now with filesystem monitoring

Discussion in 'Ruby' started by Tony Arcieri, Aug 29, 2009.

  1. Tony Arcieri

    Tony Arcieri Guest

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

    Rev is a high-performance event library for Ruby, providing event loops for
    monitoring network, timer, and now filesystem events. Rev is based on the
    libev C library.

    http://github.com/tarcieri/rev/

    Rev 0.3.0 provides some bugfixes and performance improvements as well as a
    slew of new features, including many new extensions to existing APIs that
    provide for better integration with the Ruby environment, and a new
    filesystem monitoring API built on the facilities provided by the libev
    event library, including inotify support on Linux.

    The new StatWatcher API allows you to monitor any file or directory for
    changes and receive events when changes occur:

    -- snip --

    class MyStatWatcher < Rev::StatWatcher
    def on_change
    begin
    puts "#{path} has new status #{File.stat(path).inspect}"
    rescue Errno::ENOENT
    puts "#{path} was deleted"
    end
    end
    end

    watcher = MyStatWatcher.new "interesting/file"
    watcher.attach Rev::Loop.default
    Rev::Loop.default.run

    -- snip --

    I know there are many gems already available to provide filesystem
    monitoring, such as directory_watcher (
    http://github.com/TwP/directory_watcher/tree/master), and that EventMachine
    already provides EM.watch_file, but for the Rev users out there, you now
    have the same capabilities with Rev's asynchronous event loops.

    --
    Tony Arcieri
    Medioh/Nagravision
    Tony Arcieri, Aug 29, 2009
    #1
    1. Advertising

  2. Tony Arcieri

    Tim Pease Guest

    On Sat, Aug 29, 2009 at 12:12 AM, Tony Arcieri<> wrote:
    > Rev is a high-performance event library for Ruby, providing event loops f=

    or
    > monitoring network, timer, and now filesystem events. =A0Rev is based on =

    the
    > libev C library.
    >
    > http://github.com/tarcieri/rev/
    >
    > Rev 0.3.0 provides some bugfixes and performance improvements as well as =

    a
    > slew of new features, including many new extensions to existing APIs that
    > provide for better integration with the Ruby environment, and a new
    > filesystem monitoring API built on the facilities provided by the libev
    > event library, including inotify support on Linux.
    >


    Awesome work Tony!

    I for one welcome our new event-loop driven file notification
    overlords. Thanks for adding inotify support in an elegant manner.

    Blessings,
    TwP
    Tim Pease, Aug 29, 2009
    #2
    1. Advertising

  3. Tony Arcieri

    Rob Sanheim Guest

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

    On Sat, Aug 29, 2009 at 2:12 AM, Tony Arcieri <> wrote:

    > Rev is a high-performance event library for Ruby, providing event loops for
    > monitoring network, timer, and now filesystem events. Rev is based on the
    > libev C library.
    >
    > http://github.com/tarcieri/rev/
    >
    > Rev 0.3.0 provides some bugfixes and performance improvements as well as a
    > slew of new features, including many new extensions to existing APIs that
    > provide for better integration with the Ruby environment, and a new
    > filesystem monitoring API built on the facilities provided by the libev
    > event library, including inotify support on Linux.
    >
    > The new StatWatcher API allows you to monitor any file or directory for
    > changes and receive events when changes occur:
    >
    > -- snip --
    >
    > class MyStatWatcher < Rev::StatWatcher
    > def on_change
    > begin
    > puts "#{path} has new status #{File.stat(path).inspect}"
    > rescue Errno::ENOENT
    > puts "#{path} was deleted"
    > end
    > end
    > end
    >
    > watcher = MyStatWatcher.new "interesting/file"
    > watcher.attach Rev::Loop.default
    > Rev::Loop.default.run
    >
    > -- snip --
    >
    > I know there are many gems already available to provide filesystem
    > monitoring, such as directory_watcher (
    > http://github.com/TwP/directory_watcher/tree/master), and that
    > EventMachine
    > already provides EM.watch_file, but for the Rev users out there, you now
    > have the same capabilities with Rev's asynchronous event loops.
    >
    > --
    > Tony Arcieri
    > Medioh/Nagravision
    >


    Hi Tony

    Does this use fsevents on Mac OSX?

    Thanks,
    Rob
    Rob Sanheim, Aug 31, 2009
    #3
  4. Tony Arcieri

    Tony Arcieri Guest

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

    On Mon, Aug 31, 2009 at 10:48 AM, Rob Sanheim <> wrote:

    > Hi Tony
    >
    > Does this use fsevents on Mac OSX?
    >


    Unfortunately on all platforms besides Linux it's just using stat()
    periodically, to my knowledge.

    If you are interested in having other syscalls supported for filesystem
    monitoring, I can ask on the libev mailing list.

    --
    Tony Arcieri
    Medioh/Nagravision
    Tony Arcieri, Aug 31, 2009
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. rohit
    Replies:
    4
    Views:
    356
    momobear
    Jun 4, 2007
  2. Simon Strandgaard

    [ANN] Subversion Handy Backup, rev 8

    Simon Strandgaard, Feb 8, 2006, in forum: Ruby
    Replies:
    0
    Views:
    99
    Simon Strandgaard
    Feb 8, 2006
  3. Tony Arcieri
    Replies:
    1
    Views:
    124
    Roger Pack
    Feb 2, 2009
  4. Tony Arcieri
    Replies:
    0
    Views:
    185
    Tony Arcieri
    Oct 15, 2009
  5. Eric Wong
    Replies:
    0
    Views:
    101
    Eric Wong
    Oct 15, 2009
Loading...

Share This Page