22#include <unordered_map>
40 std::optional<PluginInfo>
get(
const std::string& path)
const;
47 void erase(
const std::string& path);
50 std::size_t
size()
const {
return entries_.size(); }
53 void clear() { entries_.clear(); }
57 bool save_to(
const std::string& file_path)
const;
71 const std::unordered_map<std::string, ScanCacheEntry>&
entries()
const {
76 std::unordered_map<std::string, ScanCacheEntry> entries_;
Definition scan_cache.hpp:32
void clear()
Drop every entry.
Definition scan_cache.hpp:53
std::size_t size() const
Total number of entries currently in memory.
Definition scan_cache.hpp:50
std::string to_json() const
static constexpr int kSchemaVersion
Schema version; entries loaded with a different version are discarded.
Definition scan_cache.hpp:35
bool load_from(const std::string &file_path)
Load a JSON file produced by save_to().
void put(const std::string &path, const PluginInfo &info)
Overwrite (or insert) an entry for path.
const std::unordered_map< std::string, ScanCacheEntry > & entries() const
Definition scan_cache.hpp:71
void erase(const std::string &path)
Remove the entry for path (noop if absent).
bool from_json(const std::string &json)
bool save_to(const std::string &file_path) const
Serialize to a JSON file.
std::optional< PluginInfo > get(const std::string &path) const
Return a cached entry if one exists whose (mtime, size) matches the file on disk today.
Bounded event contracts shared by host ingress and graph-authored nodes.
Definition anticipation_eligibility.hpp:9
Definition scanner.hpp:35
Definition scan_cache.hpp:26
int64_t mtime
Definition scan_cache.hpp:27
int64_t size
Definition scan_cache.hpp:28
PluginInfo info
Definition scan_cache.hpp:29