2018-04-01 15:05:24 -07:00
|
|
|
// Copyright (c) 2017 The Zcash developers
|
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2018-08-01 23:22:20 -07:00
|
|
|
#ifndef BITCOIN_PAYMENTDISCLOSUREDB_H
|
|
|
|
#define BITCOIN_PAYMENTDISCLOSUREDB_H
|
2018-04-01 15:05:24 -07:00
|
|
|
|
2018-04-03 20:14:22 -07:00
|
|
|
#include <paymentdisclosure.h>
|
2018-04-01 15:05:24 -07:00
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
#include <string>
|
|
|
|
#include <mutex>
|
|
|
|
#include <future>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include <boost/optional.hpp>
|
|
|
|
|
|
|
|
#include <leveldb/db.h>
|
|
|
|
|
|
|
|
|
|
|
|
class PaymentDisclosureDB
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
leveldb::DB* db = nullptr;
|
|
|
|
leveldb::Options options;
|
|
|
|
leveldb::ReadOptions readOptions;
|
|
|
|
leveldb::WriteOptions writeOptions;
|
|
|
|
mutable std::mutex lock_;
|
|
|
|
|
|
|
|
public:
|
|
|
|
static std::shared_ptr<PaymentDisclosureDB> sharedInstance();
|
|
|
|
|
|
|
|
PaymentDisclosureDB();
|
|
|
|
PaymentDisclosureDB(const boost::filesystem::path& dbPath);
|
|
|
|
~PaymentDisclosureDB();
|
|
|
|
|
|
|
|
bool Put(const PaymentDisclosureKey& key, const PaymentDisclosureInfo& info);
|
|
|
|
bool Get(const PaymentDisclosureKey& key, PaymentDisclosureInfo& info);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2018-08-02 07:58:53 -07:00
|
|
|
#endif // BITCOIN_PAYMENTDISCLOSUREDB_H
|