MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / WriteBatch

Function WriteBatch

src/tests/dbaccess_tests.cpp:47–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46template<typename KeyType, typename ValueType>
47void WriteBatch(CDBAccess &access, const dbk::PrefixType &prefixType, const map<KeyType, ValueType> &dataMap) {
48 CLevelDBBatch batch;
49 for (auto item : dataMap) {
50 string key = dbk::GenDbKey(prefixType, item.first);
51 if (db_util::IsEmpty(item.second)) {
52 batch.Erase(key);
53 } else {
54 batch.Write(key, item.second);
55 }
56 }
57 access.WriteBatch(batch);
58}
59
60BOOST_AUTO_TEST_CASE(dbaccess_test)
61{

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.70

Calls 5

GenDbKeyFunction · 0.85
IsEmptyFunction · 0.85
EraseMethod · 0.45
WriteMethod · 0.45
WriteBatchMethod · 0.45

Tested by

no test coverage detected