MCPcopy Create free account
hub / github.com/ElementsProject/elements / WriteBatch

Method WriteBatch

src/dbwrapper.cpp:187–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187bool CDBWrapper::WriteBatch(CDBBatch& batch, bool fSync)
188{
189 const bool log_memory = LogAcceptCategory(BCLog::LEVELDB);
190 double mem_before = 0;
191 if (log_memory) {
192 mem_before = DynamicMemoryUsage() / 1024.0 / 1024;
193 }
194 leveldb::Status status = pdb->Write(fSync ? syncoptions : writeoptions, &batch.batch);
195 dbwrapper_private::HandleError(status);
196 if (log_memory) {
197 double mem_after = DynamicMemoryUsage() / 1024.0 / 1024;
198 LogPrint(BCLog::LEVELDB, "WriteBatch memory usage: db=%s, before=%.1fMiB, after=%.1fMiB\n",
199 m_name, mem_before, mem_after);
200 }
201 return true;
202}
203
204size_t CDBWrapper::DynamicMemoryUsage() const
205{

Callers 2

BatchWriteMethod · 0.45
UpgradeMethod · 0.45

Calls 3

LogAcceptCategoryFunction · 0.85
HandleErrorFunction · 0.85
WriteMethod · 0.45

Tested by

no test coverage detected