mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Moved cpp code to src/cpp and js code to src/js.
This commit is contained in:
71
src/cpp/ripple/SHAMapSync.h
Normal file
71
src/cpp/ripple/SHAMapSync.h
Normal file
@@ -0,0 +1,71 @@
|
||||
#ifndef __SHAMAPYSNC__
|
||||
#define __SHAMAPSYNC__
|
||||
|
||||
#include "SHAMap.h"
|
||||
#include "Application.h"
|
||||
|
||||
// Sync filters allow low-level SHAMapSync code to interact correctly with
|
||||
// higher-level structures such as caches and transaction stores
|
||||
|
||||
class ConsensusTransSetSF : public SHAMapSyncFilter
|
||||
{ // sync filter for transaction sets during consensus building
|
||||
public:
|
||||
ConsensusTransSetSF() { ; }
|
||||
virtual void gotNode(const SHAMapNode& id, const uint256& nodeHash,
|
||||
const std::vector<unsigned char>& nodeData, SHAMapTreeNode::TNType)
|
||||
{
|
||||
// WRITEME: If 'isLeaf' is true, this is a transaction
|
||||
theApp->getTempNodeCache().store(nodeHash, nodeData);
|
||||
}
|
||||
virtual bool haveNode(const SHAMapNode& id, const uint256& nodeHash, std::vector<unsigned char>& nodeData)
|
||||
{
|
||||
// WRITEME: We could check our own map, we could check transaction tables
|
||||
return theApp->getTempNodeCache().retrieve(nodeHash, nodeData);
|
||||
}
|
||||
};
|
||||
|
||||
class AccountStateSF : public SHAMapSyncFilter
|
||||
{ // sync filter for account state nodes during ledger sync
|
||||
protected:
|
||||
uint256 mLedgerHash;
|
||||
uint32 mLedgerSeq;
|
||||
|
||||
public:
|
||||
AccountStateSF(const uint256& ledgerHash, uint32 ledgerSeq) : mLedgerHash(ledgerHash), mLedgerSeq(ledgerSeq)
|
||||
{ ; }
|
||||
|
||||
virtual void gotNode(const SHAMapNode& id, const uint256& nodeHash,
|
||||
const std::vector<unsigned char>& nodeData, SHAMapTreeNode::TNType)
|
||||
{
|
||||
theApp->getHashedObjectStore().store(hotACCOUNT_NODE, mLedgerSeq, nodeData, nodeHash);
|
||||
}
|
||||
virtual bool haveNode(const SHAMapNode& id, const uint256& nodeHash, std::vector<unsigned char>& nodeData)
|
||||
{ // fetchNodeExternal already tried
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
class TransactionStateSF : public SHAMapSyncFilter
|
||||
{ // sync filter for transactions tree during ledger sync
|
||||
protected:
|
||||
uint256 mLedgerHash;
|
||||
uint32 mLedgerSeq;
|
||||
|
||||
public:
|
||||
TransactionStateSF(const uint256& ledgerHash, uint32 ledgerSeq) : mLedgerHash(ledgerHash), mLedgerSeq(ledgerSeq)
|
||||
{ ; }
|
||||
|
||||
virtual void gotNode(const SHAMapNode& id, const uint256& nodeHash,
|
||||
const std::vector<unsigned char>& nodeData, SHAMapTreeNode::TNType type)
|
||||
{
|
||||
theApp->getHashedObjectStore().store(
|
||||
(type == SHAMapTreeNode::tnTRANSACTION_NM) ? hotTRANSACTION : hotTRANSACTION_NODE,
|
||||
mLedgerSeq, nodeData, nodeHash);
|
||||
}
|
||||
virtual bool haveNode(const SHAMapNode& id, const uint256& nodeHash, std::vector<unsigned char>& nodeData)
|
||||
{ // fetchNodeExternal already tried
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user