Raven Core  3.0.0
P2P Digital Currency
restricteddb.h
Go to the documentation of this file.
1 // Copyright (c) 2019 The Raven Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 
6 #ifndef RAVENCOIN_RESTRICTEDDB_H
7 #define RAVENCOIN_RESTRICTEDDB_H
8 
9 #include <dbwrapper.h>
10 
11 class CRestrictedDB : public CDBWrapper {
12 
13 public:
14  explicit CRestrictedDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false);
15 
16  CRestrictedDB(const CRestrictedDB&) = delete;
17  CRestrictedDB& operator=(const CRestrictedDB&) = delete;
18 
19  // Database of restricted asset verifier strings
20  bool WriteVerifier(const std::string& assetName, const std::string& verifier);
21  bool ReadVerifier(const std::string& assetName, std::string& verifier);
22  bool EraseVerifier(const std::string& assetName);
23 
24  // Database of Addresses and the Tag that are assigned to them
25  bool WriteAddressQualifier(const std::string &address, const std::string &tag);
26  bool ReadAddressQualifier(const std::string &address, const std::string &tag);
27  bool EraseAddressQualifier(const std::string &address, const std::string &tag);
28 
29  // Database of the Qualifier to the address that are assigned to them
30  bool WriteQualifierAddress(const std::string &address, const std::string &tag);
31  bool ReadQualifierAddress(const std::string &address, const std::string &tag);
32  bool EraseQualifierAddress(const std::string &address, const std::string &tag);
33 
34  // Database of Blacklist addresses
35  bool WriteRestrictedAddress(const std::string& address, const std::string& assetName);
36  bool ReadRestrictedAddress(const std::string& address, const std::string& assetName);
37  bool EraseRestrictedAddress(const std::string& address, const std::string& assetName);
38 
39  // Database of Restricted Trading Global Off
40  bool WriteGlobalRestriction(const std::string& assetName);
41  bool ReadGlobalRestriction(const std::string& assetName);
42  bool EraseGlobalRestriction(const std::string& assetName);
43 
44  // Write / Read Database flags
45  bool WriteFlag(const std::string &name, bool fValue);
46  bool ReadFlag(const std::string &name, bool &fValue);
47 
48  bool GetQualifierAddresses(std::string& qualifier, std::vector<std::string>& addresses);
49  bool GetAddressQualifiers(std::string& address, std::vector<std::string>& qualifiers);
50  bool GetAddressRestrictions(std::string& address, std::vector<std::string>& restrictions);
51  bool GetGlobalRestrictions(std::vector<std::string>& restrictions);
52 
53  bool CheckForAddressRootQualifier(const std::string& address, const std::string& qualifier);
54 
55  bool Flush();
56 };
57 
58 
59 #endif //RAVENCOIN_RESTRICTEDDB_H
bool WriteQualifierAddress(const std::string &address, const std::string &tag)
CRestrictedDB(size_t nCacheSize, bool fMemory=false, bool fWipe=false)
bool WriteAddressQualifier(const std::string &address, const std::string &tag)
bool WriteFlag(const std::string &name, bool fValue)
bool EraseQualifierAddress(const std::string &address, const std::string &tag)
bool EraseAddressQualifier(const std::string &address, const std::string &tag)
bool GetAddressQualifiers(std::string &address, std::vector< std::string > &qualifiers)
bool ReadGlobalRestriction(const std::string &assetName)
bool EraseGlobalRestriction(const std::string &assetName)
bool ReadVerifier(const std::string &assetName, std::string &verifier)
bool EraseVerifier(const std::string &assetName)
bool CheckForAddressRootQualifier(const std::string &address, const std::string &qualifier)
bool EraseRestrictedAddress(const std::string &address, const std::string &assetName)
bool GetQualifierAddresses(std::string &qualifier, std::vector< std::string > &addresses)
bool ReadAddressQualifier(const std::string &address, const std::string &tag)
bool WriteRestrictedAddress(const std::string &address, const std::string &assetName)
bool ReadFlag(const std::string &name, bool &fValue)
CRestrictedDB & operator=(const CRestrictedDB &)=delete
bool ReadQualifierAddress(const std::string &address, const std::string &tag)
bool GetGlobalRestrictions(std::vector< std::string > &restrictions)
bool GetAddressRestrictions(std::string &address, std::vector< std::string > &restrictions)
bool WriteGlobalRestriction(const std::string &assetName)
bool WriteVerifier(const std::string &assetName, const std::string &verifier)
bool ReadRestrictedAddress(const std::string &address, const std::string &assetName)