|
qb
2.0.0.0
C++17 Actor Framework
|
CRTP base class for watching a directory for attribute changes. More...
#include <io.h>


Public Types | |
| using | base_io_t = directory_watcher<_Derived> |
| Base I/O type alias for CRTP. | |
Public Member Functions | |
| directory_watcher ()=default | |
| Default constructor. | |
| ~directory_watcher ()=default | |
| Destructor. | |
| void | start (std::string const &fpath, ev_tstamp ts=0.1) noexcept |
| Starts watching a directory for attribute changes. | |
| void | disconnect () noexcept |
| Stops watching the directory. | |
Static Public Attributes | |
| static constexpr const bool | do_read = false |
| Flag indicating this watcher type does not read directory content directly. | |
Additional Inherited Members | |
| Protected Member Functions inherited from qb::io::async::base< directory_watcher< _Derived >, event::file > | |
| base () | |
| Constructor that registers the event watcher with the current listener. | |
| ~base () | |
| Destructor that unregisters the event watcher. | |
| Protected Attributes inherited from qb::io::async::base< directory_watcher< _Derived >, event::file > | |
| event::file & | _async_event |
| Reference to the registered libev-based event watcher. | |
CRTP base class for watching a directory for attribute changes.
This template class uses an event::file (wrapping ev::stat) to monitor a specified directory path for changes in its attributes. Unlike file_watcher, it generally does not read directory contents itself but notifies the derived class of changes.
| _Derived | The derived class type (CRTP pattern) that handles the on(event::file&) notification. |
|
inlinenoexcept |
Starts watching a directory for attribute changes.
| fpath | Path to the directory to watch. |
| ts | Polling interval in seconds for checking changes. Default is 0.1 seconds. |
Initializes and starts the underlying ev::stat watcher for the specified directory path. The on(event::file&) handler will be called when changes to the directory's attributes are detected.
|
inlinenoexcept |
Stops watching the directory.
Stops the underlying ev::stat watcher. No more file events for this directory will be generated.