25 #include <leveldb/db.h> 26 #include <boost/filesystem.hpp> 33 namespace fs = boost::filesystem;
39 fs::create_directories(path);
42 o.create_if_missing =
true;
43 ldb::DB::Open(o, path, &m_db);
46 bool LevelDB::db_put(std::string
const& _name, std::string
const& _key, std::string
const& _value)
49 auto status = m_db->Put(ldb::WriteOptions(),
50 ldb::Slice((
char const*)k.data(), k.size()),
51 ldb::Slice((
char const*)_value.data(), _value.size()));
55 std::string LevelDB::db_get(std::string
const& _name, std::string
const& _key)
59 m_db->Get(ldb::ReadOptions(), ldb::Slice((
char const*)k.data(), k.size()), &ret);
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
std::hash for asio::adress
std::string getDataDir(std::string _prefix="ethereum")
std::vector< byte > bytes
bool sha3(bytesConstRef _input, bytesRef o_output)
Calculate SHA3-256 hash of the given input and load it into the given output.
#define DEV_IGNORE_EXCEPTIONS(X)