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

Method Read

src/persistence/leveldbwrapper.h:178–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176
177 template<typename V>
178 bool Read(std::string key, V &value) {
179 leveldb::Slice slKey(key);
180
181 string strValue;
182 leveldb::Status status = pdb->Get(readoptions, slKey, &strValue);
183 if (!status.ok()) {
184 if (status.IsNotFound())
185 return false;
186 LogPrint(BCLog::INFO,"LevelDB read failure: %s\n", status.ToString().c_str());
187 ThrowError(status);
188 }
189 try {
190 CDataStream ssValue(strValue.data(), strValue.data() + strValue.size(), SER_DISK, CLIENT_VERSION);
191 ssValue >> value;
192 } catch(std::exception &e) {
193 return false;
194 }
195 return true;
196 }
197
198 template<typename V>
199 bool Write(const std::string &key, const V &value, bool fSync = false) {

Callers

nothing calls this directly

Calls 7

ThrowErrorFunction · 0.85
IsNotFoundMethod · 0.80
dataMethod · 0.80
GetMethod · 0.45
okMethod · 0.45
ToStringMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected