6#include <userver/engine/io/sys_linux/inotify.hpp>
7#include <userver/fs/read.hpp>
8#include <userver/rcu/rcu_map.hpp>
9#include <userver/utils/periodic_task.hpp>
11USERVER_NAMESPACE_BEGIN
19class FsCacheClient
final {
26 FsCacheClient(std::string_view dir, std::chrono::milliseconds update_period, engine::TaskProcessor& tp);
32 FileInfoWithDataConstPtr
TryGetFile(std::string_view path)
const;
41 void HandleDelete(
const std::string& path);
43 static void HandleDeleteDirectory(engine::
io::sys_linux::Inotify& inotify,
const std::string& path);
45 void HandleCreate(
const std::string& path);
47 void HandleCreateDirectory(engine::
io::sys_linux::Inotify& inotify,
const std::string& path);
49 void HandleCreateDirectoryBlocking(engine::
io::sys_linux::Inotify& inotify,
const std::string& path);
52 const std::string dir_;
53 const std::chrono::milliseconds update_period_;
54 engine::TaskProcessor& tp_;
56 utils::PeriodicTask cache_updater_;
58 rcu::RcuMap<std::string,
const fs::FileInfoWithData> data_;
61 engine::
Task inotify_task_;