MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / DirIvCache

Class DirIvCache

libcppcryptfs/filename/dirivcache.h:59–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57
58
59class DirIvCache {
60
61private:
62
63 ULONGLONG m_ttl;
64
65 unordered_map<wstring, DirIvCacheNode*> m_map;
66
67 list<DirIvCacheNode*> m_lru_list;
68
69 list<DirIvCacheNode*> m_spare_node_list;
70
71 CRITICAL_SECTION m_crit;
72
73 long long m_lookups;
74 long long m_hits;
75
76 void normalize_key(wstring &key);
77
78 void lock();
79 void unlock();
80
81 bool check_node_clean(DirIvCacheNode *node, const wstring& path);
82 void update_lru(DirIvCacheNode *node);
83public:
84 // disallow copying
85 DirIvCache(DirIvCache const&) = delete;
86 void operator=(DirIvCache const&) = delete;
87
88 DirIvCache();
89
90 virtual ~DirIvCache();
91
92 void SetTTL(int nSecs) { m_ttl = (ULONGLONG)nSecs * 1000; };
93
94 bool lookup(LPCWSTR path, unsigned char *dir_iv);
95
96 bool store(LPCWSTR path, const unsigned char *dir_iv, const FILETIME& last_write_time);
97
98 void remove(LPCWSTR path);
99
100 long long hits() { long long rval; lock(); rval = m_hits; unlock(); return rval; }
101 long long lookups() { long long rval; lock(); rval = m_lookups; unlock(); return rval; }
102
103};
104
105

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected