#pragma once #include #include #include namespace DB { template class AsyncBlockIDsCache { struct Cache; using CachePtr = std::shared_ptr; void update(); public: explicit AsyncBlockIDsCache(TStorage & storage_); void start(); void stop() { task->deactivate(); } Strings detectConflicts(const Strings & paths, UInt64 & last_version); void triggerCacheUpdate(); private: TStorage & storage; const std::chrono::milliseconds update_wait; std::mutex mu; CachePtr cache_ptr; std::condition_variable cv; UInt64 version = 0; const String path; BackgroundSchedulePool::TaskHolder task; const String log_name; LoggerPtr log; }; }