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

Class KeyCache

libcppcryptfs/util/KeyCache.h:112–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110
111
112class KeyCache
113{
114public:
115 typedef unsigned long long id_t;
116private:
117 mutex m_mutex;
118 unordered_map<id_t, KeyCacheEntry> m_entries;
119 id_t m_cur_id; // we increment it and assign as unique id for registered clients
120 int m_valid_count;
121 bool m_enabled;
122 KeyCache();
123 void ClearInternal(bool disable);
124 bool InitClearThread();
125 HANDLE m_clearEvent;
126 HANDLE m_clearThread;
127public:
128 static KeyCache* GetInstance();
129 id_t Register(DWORD buf_size);
130 bool Unregister(id_t id);
131 void Enable();
132 void Clear() { ClearInternal(false); }
133 void Disable() { ClearInternal(true); }
134 bool Store(id_t id, const BYTE* ptr, size_t len);
135 bool Retrieve(id_t id, const vector<KeyBuf>& kbmb);
136 void StopClearThread();
137
138 virtual ~KeyCache();
139
140 // disallow copying
141 KeyCache(KeyCache const&) = delete;
142 void operator=(KeyCache const&) = delete;
143};
144

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected