MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / erase

Method erase

src/storage/rocksdb.cpp:118–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118bool RocksDBStorageProvider::erase(const char *key, size_t cchKey)
119{
120 rocksdb::Status status;
121 std::unique_lock<fastlock> l(m_lock);
122 std::string prefixed_key = prefixKey(key, cchKey);
123 if (!FKeyExists(prefixed_key))
124 return false;
125 if (m_spbatch != nullptr)
126 {
127 status = m_spbatch->Delete(m_spcolfamily.get(), rocksdb::Slice(prefixed_key));
128 }
129 else
130 {
131 status = m_spdb->Delete(WriteOptions(), m_spcolfamily.get(), rocksdb::Slice(prefixed_key));
132 }
133 if (status.ok())
134 --m_count;
135 return status.ok();
136}
137
138void RocksDBStorageProvider::retrieve(const char *key, size_t cchKey, callbackSingle fn) const
139{

Callers

nothing calls this directly

Calls 3

prefixKeyFunction · 0.85
okMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected