Engine → Assets → file_watcher.h
polling_file_watcher
| Type | Class |
| Namespace | conjure::assets |
| Include File Path | engine/include/conjure/assets/file_watcher.h |
| Source File Path | engine/src/assets/file_watcher.cpp |
| API ↗ | Database, importers and hot reload |
Syntax
Inheritance Hierarchy
file_watcher → polling_file_watcher
Constructors
| Access | Signature | Description |
|---|---|---|
| public | polling_file_watcher(
core::vfs::file_system &fileSystem,
core::jobs::job_system &jobs,
f64 intervalSeconds = DEFAULT_WATCH_INTERVAL_SECONDS); | Watches through fileSystem and runs its passes on jobs. intervalSeconds is the least time between two passes poll() starts; with 0 every poll() starts one once the previous pass has finished. NaN and negative values count as 0, values above 1e9 seconds (infinity included) as 1e9. |
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~polling_file_watcher() override; |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mFileSystem | core::vfs::file_system * | nullptr | |
| private | mHasBaseline | bool | false | |
| private | mHasPassed | bool | false | |
| private | mInterval | std:: | {} | |
| private | m | f64 | DEFAULT_ | |
| private | mJobs | core::jobs::job_system * | nullptr | |
| private | m | std::string | {} | |
| private | m | std:: | {} | |
| private | mMutex | std::mutex | {} | |
| private | mPass | core::jobs::job_handle | {} | |
| private | mPassResult | core:: | {} | |
| private | m | bool | false | |
| private | mPending | core:: | {} | |
| private | m | core:: | {} | |
| private | mReady | std::vector<file_change> | {} | |
| private | mRoots | std::vector<std::string> | {} | |
| private | mSnapshot | core:: | {} |
Functions
Public
add_root
add_rootvoid add_root(
std::string_view rootPath) override;interval_seconds
interval_seconds[[nodiscard]] f64 interval_seconds() const noexcept;The interval between passes in seconds, as the constructor clamped it.
poll
pollvoid poll(
std::vector<file_change> &outChanges) override;scan_now
scan_now[[nodiscard]] core::result<void> scan_now();One synchronous stat pass on the caller; changes become visible to the next poll(). Fails when a root cannot be enumerated.
snapshot
snapshot[[nodiscard]] core::result<void> snapshot() override;tracked_file_count
tracked_file_count[[nodiscard]] usize tracked_file_count() const noexcept;Private
apply_pass
apply_passvoid apply_pass(
core::flat_hash_map<std::string, file_state> &¤t);stat_roots
stat_roots[[nodiscard]] core::result<core::flat_hash_map<std::string, file_state>> stat_roots() const;