4 #ifndef BITCOIN_LEVELDB_H
5 #define BITCOIN_LEVELDB_H
12 #include <boost/filesystem/path.hpp>
31 template<
typename K,
typename V>
void Write(
const K& key,
const V&
value) {
38 ssValue.reserve(ssValue.GetSerializeSize(value));
42 batch.
Put(slKey, slValue);
45 template<
typename K>
void Erase(
const K& key) {
80 CLevelDB(
const boost::filesystem::path &path,
size_t nCacheSize,
bool fMemory =
false,
bool fWipe =
false);
98 CDataStream ssValue(strValue.data(), strValue.data() + strValue.size(),
SER_DISK, CLIENT_VERSION);
100 }
catch(std::exception &e) {
108 batch.
Write(key, value);
118 std::string strValue;
153 #endif // BITCOIN_LEVELDB_H
bool Read(const K &key, V &value)
CLevelDB(const boost::filesystem::path &path, size_t nCacheSize, bool fMemory=false, bool fWipe=false)
bool Write(const K &key, const V &value, bool fSync=false)
bool WriteBatch(CLevelDBBatch &batch, bool fSync=false)
Double ended buffer combining vector and stream-like interfaces.
void Write(const K &key, const V &value)
bool Exists(const K &key)
virtual Iterator * NewIterator(const ReadOptions &options)=0
void Delete(const Slice &key)
leveldb::WriteOptions writeoptions
leveldb::WriteBatch batch
bool Erase(const K &key, bool fSync=false)
leveldb::ReadOptions iteroptions
virtual Status Get(const ReadOptions &options, const Slice &key, std::string *value)=0
void reserve(size_type n)
leveldb::Iterator * NewIterator()
leveldb::ReadOptions readoptions
void HandleError(const leveldb::Status &status)
unsigned int GetSerializeSize(const T &obj)
leveldb_error(const std::string &msg)
leveldb::WriteOptions syncoptions
void Put(const Slice &key, const Slice &value)
std::string ToString() const