class Inquirer::Daemon
- Inquirer::Daemon
- Reference
- Object
Overview
The Inquirer daemon listens for certain changes in watchables (watchable directories), which are recursively looked up from the root (origin) directory, and reports those changes to the Inquirer server.
Included Modules
Defined in:
inquirer/daemon.crConstant Summary
-
MAX_WATCHES =
(File.read("/proc/sys/fs/inotify/max_user_watches")).to_i
-
Maximum amount of watches that this system allows.
Constructors
-
.new(config : Config)
Makes an Inquirer daemon from the given config.
Class Method Summary
-
.start(config : Config)
Initializes a daemon and starts it.
Instance Method Summary
-
#handle(server : Inquirer::Server, event : Inotify::Event)
Handles a change in a watchable.
-
#register_existing_files(server : Inquirer::Server)
Registers Ven files that are already in watchables.
-
#start
Starts this daemon.
-
#stop
Gracefully stops this daemon.
-
#watchable?(path : String) : Bool
Returns whether the directory at path is watchable.
-
#watchables : Array(String)
Returns the directories that this daemon watches.
-
#watchables!
Fills up this daemon's list of watchable (see
#watchable?
) directories.
Constructor Detail
Class Method Detail
Initializes a daemon and starts it.
See initialize
, #start
.
Instance Method Detail
Handles a change in a watchable.
- If a Ven file ('[^_]*.ven') was created, modified, deleted or moved (inotify MODIFY, CREATE, DELETE and MOVE, correspondingly), the appropriate command about that change is sent to the server.
- If a watchable directory was created, a watcher is set on this directory.
- If a watchable directory was removed, its watcher is (automatically) suspended.
Returns nothing.
Registers Ven files that are already in watchables.
Any file that ends with '.ven' and is not prefixed with an underscore is considered a Ven file.
Requires watchables to be looked up beforehand.
May take a long time as well.
Starts this daemon. Detaches (daemonizes) if the config says to.
Does not check whether another daemon is running on the same port.
Returns nothing.
Returns whether the directory at path is watchable.
Directories that are not watchable:
- Those whose name is prefixed with an underscore;
- Those that are ignored through the config;
- Those that are symlinks;
- Those that are hidden.
Fills up this daemon's list of watchable (see #watchable?
)
directories.
Depth (amount of nesting) is unlimited. Searches through everything under the origin directory, so may take a long time.