-
Notifications
You must be signed in to change notification settings - Fork 5
DataSync: Added signal-triggered watched paths logging utility #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
|
|
||
| #include <filesystem> | ||
| #include <map> | ||
| #include <mutex> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be honest, I’d prefer not to complicate the DataWatcher class. It should be driven by the Manager class, which can provide all the necessary debug details. At the moment, I don’t have a concrete solution in mind—we’ll need to revisit this and find a cleaner approach. Any thoughts? I was considering whether the Manager could maintain a container of DataWatcher objects, but that seems to violate the structured concurrency model of sender/receiver. So, I think we need to explore this further. |
||
|
|
||
| namespace data_sync::watch::inotify | ||
| { | ||
|
|
@@ -131,6 +132,42 @@ class DataWatcher | |
| */ | ||
| sdbusplus::async::task<DataOperations> onDataChange(); | ||
|
|
||
| /** | ||
| * @brief API to get all the instances of the DataWatcher | ||
| * | ||
| * @returns std::vector<DataWatcher*> - A reference to the vector containing | ||
| * all instances of this class | ||
| */ | ||
| static std::vector<DataWatcher*>& getAllWatchers() | ||
| { | ||
| static std::vector<DataWatcher*> instances; | ||
| return instances; | ||
| } | ||
|
|
||
| /** | ||
| * @brief API to get the reference to the static mutex to guard | ||
| * concurrent access to shared data (i.e., the vector of DataWatcher | ||
| * instances) | ||
| * | ||
| * @returns std::mutex& - A reference to the static mutex | ||
| */ | ||
| static std::mutex& getMutex() | ||
| { | ||
| static std::mutex mtx; | ||
| return mtx; | ||
| } | ||
|
|
||
| /** | ||
| * @brief API to get the file descriptor of the inotify instance | ||
| * | ||
| * @returns std::map<WD, fs::path>& - A reference to the map of WD and their | ||
| * associated file paths. | ||
| */ | ||
| const std::map<WD, fs::path>& getWatchDescriptors() const | ||
| { | ||
| return _watchDescriptors; | ||
| } | ||
|
|
||
| private: | ||
| /** | ||
| * @brief inotify flags | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.