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

Method Store

libcppcryptfs/util/KeyCache.cpp:208–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206}
207
208bool KeyCache::Store(id_t id, const BYTE* ptr, size_t len)
209{
210 lock_guard<mutex> lock(m_mutex);
211
212 if (!m_enabled)
213 return true;
214
215 auto it = m_entries.find(id);
216
217 if (it == m_entries.end())
218 return false;
219
220 assert(it->second.pbuf->m_len == len);
221
222 if (it->second.pbuf->m_len < len)
223 return false;
224
225 memcpy(it->second.pbuf->m_buf, ptr, len);
226
227 it->second.valid = true;
228 it->second.accessed = true;
229 m_valid_count++;
230
231 return true;
232}
233
234bool KeyCache::Retrieve(id_t id, const vector<KeyBuf>& kbv)
235{

Callers 1

EnterInternalMethod · 0.80

Calls 1

findMethod · 0.80

Tested by

no test coverage detected