mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Storage for objects retrieved by hash. Implement SQL set/get logic.
This commit is contained in:
41
HashedObject.h
Normal file
41
HashedObject.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef __HASHEDOBJECT__
|
||||
#define __HASHEDOBJECT__
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "types.h"
|
||||
#include "uint256.h"
|
||||
|
||||
enum HashedObjectType
|
||||
{
|
||||
UNKNOWN=0,
|
||||
LEDGER=1,
|
||||
TRANSACTION=2,
|
||||
ACCOUNT_NODE=3,
|
||||
TRANSACTION_NODE=4
|
||||
};
|
||||
|
||||
class HashedObject
|
||||
{
|
||||
public:
|
||||
typedef boost::shared_ptr<HashedObject> pointer;
|
||||
|
||||
HashedObjectType mType;
|
||||
uint256 mHash;
|
||||
uint32 mLedgerIndex;
|
||||
std::vector<unsigned char> mData;
|
||||
|
||||
HashedObject(HashedObjectType type, uint32 index, const std::vector<unsigned char>& data) :
|
||||
mType(type), mLedgerIndex(index), mData(data) { ; }
|
||||
|
||||
bool checkHash() const;
|
||||
bool checkFixHash();
|
||||
void setHash();
|
||||
|
||||
bool store() const;
|
||||
static HashedObject::pointer retrieve(const uint256& hash);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user