mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Reformatting using AStyle
This commit is contained in:
@@ -10,20 +10,22 @@ class LedgerConsensus;
|
||||
class NetworkOPs
|
||||
{
|
||||
public:
|
||||
enum Fault
|
||||
{ // exceptions these functions can throw
|
||||
IO_ERROR = 1,
|
||||
NO_NETWORK = 2,
|
||||
};
|
||||
enum Fault
|
||||
{
|
||||
// exceptions these functions can throw
|
||||
IO_ERROR = 1,
|
||||
NO_NETWORK = 2,
|
||||
};
|
||||
|
||||
enum OperatingMode
|
||||
{ // how we process transactions or account balance requests
|
||||
omDISCONNECTED = 0, // not ready to process requests
|
||||
omCONNECTED = 1, // convinced we are talking to the network
|
||||
omSYNCING = 2, // fallen slightly behind
|
||||
omTRACKING = 3, // convinced we agree with the network
|
||||
omFULL = 4 // we have the ledger and can even validate
|
||||
};
|
||||
enum OperatingMode
|
||||
{
|
||||
// how we process transactions or account balance requests
|
||||
omDISCONNECTED = 0, // not ready to process requests
|
||||
omCONNECTED = 1, // convinced we are talking to the network
|
||||
omSYNCING = 2, // fallen slightly behind
|
||||
omTRACKING = 3, // convinced we agree with the network
|
||||
omFULL = 4 // we have the ledger and can even validate
|
||||
};
|
||||
|
||||
#if 0
|
||||
/** Subscription data interface.
|
||||
@@ -32,108 +34,149 @@ public:
|
||||
{
|
||||
public:
|
||||
typedef boost::weak_ptr <Subscriber> WeakPtr;
|
||||
|
||||
|
||||
/** Called every time new JSON data is available.
|
||||
*/
|
||||
virtual void onSubscriberReceiveJSON (Json::Value const& json) { }
|
||||
};
|
||||
typedef boost::unordered_map <uint64, Subscriber::WeakPtr> subMapType;
|
||||
#endif
|
||||
|
||||
typedef boost::unordered_map <uint64, InfoSub::wptr> subMapType;
|
||||
|
||||
typedef boost::unordered_map <uint64, InfoSub::wptr> subMapType;
|
||||
|
||||
public:
|
||||
NetworkOPs(boost::asio::io_service& io_service, LedgerMaster* pLedgerMaster);
|
||||
NetworkOPs (boost::asio::io_service& io_service, LedgerMaster* pLedgerMaster);
|
||||
|
||||
// network information
|
||||
uint32 getNetworkTimeNC(); // Our best estimate of wall time in seconds from 1/1/2000
|
||||
uint32 getCloseTimeNC(); // Our best estimate of current ledger close time
|
||||
uint32 getValidationTimeNC(); // Use *only* to timestamp our own validation
|
||||
void closeTimeOffset(int);
|
||||
boost::posix_time::ptime getNetworkTimePT();
|
||||
uint32 getLedgerID(uint256 const& hash);
|
||||
uint32 getCurrentLedgerID();
|
||||
OperatingMode getOperatingMode() { return mMode; }
|
||||
std::string strOperatingMode();
|
||||
// network information
|
||||
uint32 getNetworkTimeNC (); // Our best estimate of wall time in seconds from 1/1/2000
|
||||
uint32 getCloseTimeNC (); // Our best estimate of current ledger close time
|
||||
uint32 getValidationTimeNC (); // Use *only* to timestamp our own validation
|
||||
void closeTimeOffset (int);
|
||||
boost::posix_time::ptime getNetworkTimePT ();
|
||||
uint32 getLedgerID (uint256 const& hash);
|
||||
uint32 getCurrentLedgerID ();
|
||||
OperatingMode getOperatingMode ()
|
||||
{
|
||||
return mMode;
|
||||
}
|
||||
std::string strOperatingMode ();
|
||||
|
||||
Ledger::ref getClosedLedger() { return mLedgerMaster->getClosedLedger(); }
|
||||
Ledger::ref getValidatedLedger() { return mLedgerMaster->getValidatedLedger(); }
|
||||
Ledger::ref getCurrentLedger() { return mLedgerMaster->getCurrentLedger(); }
|
||||
Ledger::ref getCurrentSnapshot() { return mLedgerMaster->getCurrentSnapshot(); }
|
||||
Ledger::pointer getLedgerByHash(uint256 const& hash) { return mLedgerMaster->getLedgerByHash(hash); }
|
||||
Ledger::pointer getLedgerBySeq(const uint32 seq);
|
||||
void missingNodeInLedger(const uint32 seq);
|
||||
Ledger::ref getClosedLedger ()
|
||||
{
|
||||
return mLedgerMaster->getClosedLedger ();
|
||||
}
|
||||
Ledger::ref getValidatedLedger ()
|
||||
{
|
||||
return mLedgerMaster->getValidatedLedger ();
|
||||
}
|
||||
Ledger::ref getCurrentLedger ()
|
||||
{
|
||||
return mLedgerMaster->getCurrentLedger ();
|
||||
}
|
||||
Ledger::ref getCurrentSnapshot ()
|
||||
{
|
||||
return mLedgerMaster->getCurrentSnapshot ();
|
||||
}
|
||||
Ledger::pointer getLedgerByHash (uint256 const& hash)
|
||||
{
|
||||
return mLedgerMaster->getLedgerByHash (hash);
|
||||
}
|
||||
Ledger::pointer getLedgerBySeq (const uint32 seq);
|
||||
void missingNodeInLedger (const uint32 seq);
|
||||
|
||||
uint256 getClosedLedgerHash() { return mLedgerMaster->getClosedLedger()->getHash(); }
|
||||
uint256 getClosedLedgerHash ()
|
||||
{
|
||||
return mLedgerMaster->getClosedLedger ()->getHash ();
|
||||
}
|
||||
|
||||
// Do we have this inclusive range of ledgers in our database
|
||||
bool haveLedgerRange(uint32 from, uint32 to);
|
||||
bool haveLedger(uint32 seq);
|
||||
uint32 getValidatedSeq();
|
||||
bool isValidated(uint32 seq);
|
||||
bool isValidated(uint32 seq, uint256 const& hash);
|
||||
bool isValidated(Ledger::ref l) { return isValidated(l->getLedgerSeq(), l->getHash()); }
|
||||
bool getValidatedRange(uint32& minVal, uint32& maxVal) { return mLedgerMaster->getValidatedRange(minVal, maxVal); }
|
||||
// Do we have this inclusive range of ledgers in our database
|
||||
bool haveLedgerRange (uint32 from, uint32 to);
|
||||
bool haveLedger (uint32 seq);
|
||||
uint32 getValidatedSeq ();
|
||||
bool isValidated (uint32 seq);
|
||||
bool isValidated (uint32 seq, uint256 const& hash);
|
||||
bool isValidated (Ledger::ref l)
|
||||
{
|
||||
return isValidated (l->getLedgerSeq (), l->getHash ());
|
||||
}
|
||||
bool getValidatedRange (uint32& minVal, uint32& maxVal)
|
||||
{
|
||||
return mLedgerMaster->getValidatedRange (minVal, maxVal);
|
||||
}
|
||||
|
||||
SerializedValidation::ref getLastValidation() { return mLastValidation; }
|
||||
void setLastValidation(SerializedValidation::ref v) { mLastValidation = v; }
|
||||
SerializedValidation::ref getLastValidation ()
|
||||
{
|
||||
return mLastValidation;
|
||||
}
|
||||
void setLastValidation (SerializedValidation::ref v)
|
||||
{
|
||||
mLastValidation = v;
|
||||
}
|
||||
|
||||
SLE::pointer getSLE(Ledger::pointer lpLedger, uint256 const& uHash) { return lpLedger->getSLE(uHash); }
|
||||
SLE::pointer getSLEi(Ledger::pointer lpLedger, uint256 const& uHash) { return lpLedger->getSLEi(uHash); }
|
||||
SLE::pointer getSLE (Ledger::pointer lpLedger, uint256 const& uHash)
|
||||
{
|
||||
return lpLedger->getSLE (uHash);
|
||||
}
|
||||
SLE::pointer getSLEi (Ledger::pointer lpLedger, uint256 const& uHash)
|
||||
{
|
||||
return lpLedger->getSLEi (uHash);
|
||||
}
|
||||
|
||||
//
|
||||
// Transaction operations
|
||||
//
|
||||
typedef FUNCTION_TYPE<void (Transaction::pointer, TER)> stCallback; // must complete immediately
|
||||
void submitTransaction(Job&, SerializedTransaction::pointer, stCallback callback = stCallback());
|
||||
Transaction::pointer submitTransactionSync(Transaction::ref tpTrans, bool bAdmin, bool bSubmit);
|
||||
//
|
||||
// Transaction operations
|
||||
//
|
||||
typedef FUNCTION_TYPE<void (Transaction::pointer, TER)> stCallback; // must complete immediately
|
||||
void submitTransaction (Job&, SerializedTransaction::pointer, stCallback callback = stCallback ());
|
||||
Transaction::pointer submitTransactionSync (Transaction::ref tpTrans, bool bAdmin, bool bSubmit);
|
||||
|
||||
void runTransactionQueue();
|
||||
Transaction::pointer processTransaction(Transaction::pointer, bool bAdmin, stCallback);
|
||||
Transaction::pointer processTransaction(Transaction::pointer transaction, bool bAdmin)
|
||||
{ return processTransaction(transaction, bAdmin, stCallback()); }
|
||||
void runTransactionQueue ();
|
||||
Transaction::pointer processTransaction (Transaction::pointer, bool bAdmin, stCallback);
|
||||
Transaction::pointer processTransaction (Transaction::pointer transaction, bool bAdmin)
|
||||
{
|
||||
return processTransaction (transaction, bAdmin, stCallback ());
|
||||
}
|
||||
|
||||
Transaction::pointer findTransactionByID(uint256 const& transactionID);
|
||||
Transaction::pointer findTransactionByID (uint256 const& transactionID);
|
||||
#if 0
|
||||
int findTransactionsBySource(uint256 const& uLedger, std::list<Transaction::pointer>&, const RippleAddress& sourceAccount,
|
||||
uint32 minSeq, uint32 maxSeq);
|
||||
int findTransactionsBySource (uint256 const& uLedger, std::list<Transaction::pointer>&, const RippleAddress& sourceAccount,
|
||||
uint32 minSeq, uint32 maxSeq);
|
||||
#endif
|
||||
int findTransactionsByDestination(std::list<Transaction::pointer>&, const RippleAddress& destinationAccount,
|
||||
uint32 startLedgerSeq, uint32 endLedgerSeq, int maxTransactions);
|
||||
int findTransactionsByDestination (std::list<Transaction::pointer>&, const RippleAddress& destinationAccount,
|
||||
uint32 startLedgerSeq, uint32 endLedgerSeq, int maxTransactions);
|
||||
|
||||
//
|
||||
// Account functions
|
||||
//
|
||||
//
|
||||
// Account functions
|
||||
//
|
||||
|
||||
AccountState::pointer getAccountState(Ledger::ref lrLedger, const RippleAddress& accountID);
|
||||
SLE::pointer getGenerator(Ledger::ref lrLedger, const uint160& uGeneratorID);
|
||||
AccountState::pointer getAccountState (Ledger::ref lrLedger, const RippleAddress& accountID);
|
||||
SLE::pointer getGenerator (Ledger::ref lrLedger, const uint160& uGeneratorID);
|
||||
|
||||
//
|
||||
// Directory functions
|
||||
//
|
||||
//
|
||||
// Directory functions
|
||||
//
|
||||
|
||||
STVector256 getDirNodeInfo(Ledger::ref lrLedger, uint256 const& uRootIndex,
|
||||
uint64& uNodePrevious, uint64& uNodeNext);
|
||||
STVector256 getDirNodeInfo (Ledger::ref lrLedger, uint256 const& uRootIndex,
|
||||
uint64& uNodePrevious, uint64& uNodeNext);
|
||||
|
||||
#if 0
|
||||
//
|
||||
// Nickname functions
|
||||
//
|
||||
//
|
||||
// Nickname functions
|
||||
//
|
||||
|
||||
NicknameState::pointer getNicknameState(uint256 const& uLedger, const std::string& strNickname);
|
||||
NicknameState::pointer getNicknameState (uint256 const& uLedger, const std::string& strNickname);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Owner functions
|
||||
//
|
||||
//
|
||||
// Owner functions
|
||||
//
|
||||
|
||||
Json::Value getOwnerInfo(Ledger::pointer lpLedger, const RippleAddress& naAccount);
|
||||
Json::Value getOwnerInfo (Ledger::pointer lpLedger, const RippleAddress& naAccount);
|
||||
|
||||
//
|
||||
// Book functions
|
||||
//
|
||||
//
|
||||
// Book functions
|
||||
//
|
||||
|
||||
void getBookPage (Ledger::pointer lpLedger,
|
||||
void getBookPage (Ledger::pointer lpLedger,
|
||||
const uint160& uTakerPaysCurrencyID,
|
||||
const uint160& uTakerPaysIssuerID,
|
||||
const uint160& uTakerGetsCurrencyID,
|
||||
@@ -144,197 +187,250 @@ public:
|
||||
const Json::Value& jvMarker,
|
||||
Json::Value& jvResult);
|
||||
|
||||
// raw object operations
|
||||
bool findRawLedger(uint256 const& ledgerHash, Blob& rawLedger);
|
||||
bool findRawTransaction(uint256 const& transactionHash, Blob& rawTransaction);
|
||||
bool findAccountNode(uint256 const& nodeHash, Blob& rawAccountNode);
|
||||
bool findTransactionNode(uint256 const& nodeHash, Blob& rawTransactionNode);
|
||||
// raw object operations
|
||||
bool findRawLedger (uint256 const& ledgerHash, Blob& rawLedger);
|
||||
bool findRawTransaction (uint256 const& transactionHash, Blob& rawTransaction);
|
||||
bool findAccountNode (uint256 const& nodeHash, Blob& rawAccountNode);
|
||||
bool findTransactionNode (uint256 const& nodeHash, Blob& rawTransactionNode);
|
||||
|
||||
// tree synchronization operations
|
||||
bool getTransactionTreeNodes(uint32 ledgerSeq, uint256 const& myNodeID,
|
||||
Blob const& myNode, std::list< Blob >& newNodes);
|
||||
bool getAccountStateNodes(uint32 ledgerSeq, uint256 const& myNodeId,
|
||||
Blob const& myNode, std::list< Blob >& newNodes);
|
||||
// tree synchronization operations
|
||||
bool getTransactionTreeNodes (uint32 ledgerSeq, uint256 const& myNodeID,
|
||||
Blob const& myNode, std::list< Blob >& newNodes);
|
||||
bool getAccountStateNodes (uint32 ledgerSeq, uint256 const& myNodeId,
|
||||
Blob const& myNode, std::list< Blob >& newNodes);
|
||||
|
||||
// ledger proposal/close functions
|
||||
void processTrustedProposal(LedgerProposal::pointer proposal, boost::shared_ptr<ripple::TMProposeSet> set,
|
||||
RippleAddress nodePublic, uint256 checkLedger, bool sigGood);
|
||||
SHAMapAddNode gotTXData(const boost::shared_ptr<Peer>& peer, uint256 const& hash,
|
||||
const std::list<SHAMapNode>& nodeIDs, const std::list< Blob >& nodeData);
|
||||
bool recvValidation(SerializedValidation::ref val, const std::string& source);
|
||||
void takePosition(int seq, SHAMap::ref position);
|
||||
SHAMap::pointer getTXMap(uint256 const& hash);
|
||||
bool hasTXSet(const boost::shared_ptr<Peer>& peer, uint256 const& set, ripple::TxSetStatus status);
|
||||
void mapComplete(uint256 const& hash, SHAMap::ref map);
|
||||
bool stillNeedTXSet(uint256 const& hash);
|
||||
void makeFetchPack(Job&, boost::weak_ptr<Peer> peer, boost::shared_ptr<ripple::TMGetObjectByHash> request,
|
||||
Ledger::pointer wantLedger, Ledger::pointer haveLedger, uint32 uUptime);
|
||||
bool shouldFetchPack(uint32 seq);
|
||||
void gotFetchPack(bool progress, uint32 seq);
|
||||
void addFetchPack(uint256 const& hash, boost::shared_ptr< Blob >& data);
|
||||
bool getFetchPack(uint256 const& hash, Blob& data);
|
||||
int getFetchSize();
|
||||
void sweepFetchPack();
|
||||
// ledger proposal/close functions
|
||||
void processTrustedProposal (LedgerProposal::pointer proposal, boost::shared_ptr<ripple::TMProposeSet> set,
|
||||
RippleAddress nodePublic, uint256 checkLedger, bool sigGood);
|
||||
SHAMapAddNode gotTXData (const boost::shared_ptr<Peer>& peer, uint256 const& hash,
|
||||
const std::list<SHAMapNode>& nodeIDs, const std::list< Blob >& nodeData);
|
||||
bool recvValidation (SerializedValidation::ref val, const std::string& source);
|
||||
void takePosition (int seq, SHAMap::ref position);
|
||||
SHAMap::pointer getTXMap (uint256 const& hash);
|
||||
bool hasTXSet (const boost::shared_ptr<Peer>& peer, uint256 const& set, ripple::TxSetStatus status);
|
||||
void mapComplete (uint256 const& hash, SHAMap::ref map);
|
||||
bool stillNeedTXSet (uint256 const& hash);
|
||||
void makeFetchPack (Job&, boost::weak_ptr<Peer> peer, boost::shared_ptr<ripple::TMGetObjectByHash> request,
|
||||
Ledger::pointer wantLedger, Ledger::pointer haveLedger, uint32 uUptime);
|
||||
bool shouldFetchPack (uint32 seq);
|
||||
void gotFetchPack (bool progress, uint32 seq);
|
||||
void addFetchPack (uint256 const& hash, boost::shared_ptr< Blob >& data);
|
||||
bool getFetchPack (uint256 const& hash, Blob& data);
|
||||
int getFetchSize ();
|
||||
void sweepFetchPack ();
|
||||
|
||||
float getJSONHitRate() { return mJSONCache.getHitRate(); }
|
||||
float getJSONHitRate ()
|
||||
{
|
||||
return mJSONCache.getHitRate ();
|
||||
}
|
||||
|
||||
// VFALCO TODO Rename this to getNumberOfCachedJSONItems or something similar
|
||||
int getJSONEntries() { return mJSONCache.getNumberOfEntries(); }
|
||||
int getJSONEntries ()
|
||||
{
|
||||
return mJSONCache.getNumberOfEntries ();
|
||||
}
|
||||
|
||||
void storeJSONCache(JSONCache::Kind kind, const uint256& ledger, const uint160& object,
|
||||
const boost::shared_ptr <Json::Value>& data)
|
||||
{ mJSONCache.storeEntry(kind, ledger, object, data); }
|
||||
void storeJSONCache (JSONCache::Kind kind, const uint256& ledger, const uint160& object,
|
||||
const boost::shared_ptr <Json::Value>& data)
|
||||
{
|
||||
mJSONCache.storeEntry (kind, ledger, object, data);
|
||||
}
|
||||
|
||||
boost::shared_ptr<Json::Value> getJSONCache(JSONCache::Kind kind, const uint256& ledger, const uint160& object)
|
||||
{ return mJSONCache.getEntry(kind, ledger, object); }
|
||||
boost::shared_ptr<Json::Value> getJSONCache (JSONCache::Kind kind, const uint256& ledger, const uint160& object)
|
||||
{
|
||||
return mJSONCache.getEntry (kind, ledger, object);
|
||||
}
|
||||
|
||||
// network state machine
|
||||
void checkState(const boost::system::error_code& result);
|
||||
void switchLastClosedLedger(Ledger::pointer newLedger, bool duringConsensus); // Used for the "jump" case
|
||||
bool checkLastClosedLedger(const std::vector<Peer::pointer>&, uint256& networkClosed);
|
||||
int beginConsensus(uint256 const& networkClosed, Ledger::pointer closingLedger);
|
||||
void tryStartConsensus();
|
||||
void endConsensus(bool correctLCL);
|
||||
void setStandAlone() { setMode(omFULL); }
|
||||
void setStateTimer();
|
||||
void newLCL(int proposers, int convergeTime, uint256 const& ledgerHash);
|
||||
void needNetworkLedger() { mNeedNetworkLedger = true; }
|
||||
void clearNeedNetworkLedger() { mNeedNetworkLedger = false; }
|
||||
bool isNeedNetworkLedger() { return mNeedNetworkLedger; }
|
||||
bool isFull() { return !mNeedNetworkLedger && (mMode == omFULL); }
|
||||
void setProposing(bool p, bool v) { mProposing = p; mValidating = v; }
|
||||
bool isProposing() { return mProposing; }
|
||||
bool isValidating() { return mValidating; }
|
||||
bool isFeatureBlocked() { return mFeatureBlocked; }
|
||||
void setFeatureBlocked();
|
||||
void consensusViewChange();
|
||||
int getPreviousProposers() { return mLastCloseProposers; }
|
||||
int getPreviousConvergeTime() { return mLastCloseConvergeTime; }
|
||||
uint32 getLastCloseTime() { return mLastCloseTime; }
|
||||
void setLastCloseTime(uint32 t) { mLastCloseTime = t; }
|
||||
Json::Value getConsensusInfo();
|
||||
Json::Value getServerInfo(bool human, bool admin);
|
||||
uint32 acceptLedger();
|
||||
boost::unordered_map<uint160,
|
||||
std::list<LedgerProposal::pointer> >& peekStoredProposals() { return mStoredProposals; }
|
||||
void storeProposal(LedgerProposal::ref proposal, const RippleAddress& peerPublic);
|
||||
uint256 getConsensusLCL();
|
||||
void reportFeeChange();
|
||||
// network state machine
|
||||
void checkState (const boost::system::error_code& result);
|
||||
void switchLastClosedLedger (Ledger::pointer newLedger, bool duringConsensus); // Used for the "jump" case
|
||||
bool checkLastClosedLedger (const std::vector<Peer::pointer>&, uint256& networkClosed);
|
||||
int beginConsensus (uint256 const& networkClosed, Ledger::pointer closingLedger);
|
||||
void tryStartConsensus ();
|
||||
void endConsensus (bool correctLCL);
|
||||
void setStandAlone ()
|
||||
{
|
||||
setMode (omFULL);
|
||||
}
|
||||
void setStateTimer ();
|
||||
void newLCL (int proposers, int convergeTime, uint256 const& ledgerHash);
|
||||
void needNetworkLedger ()
|
||||
{
|
||||
mNeedNetworkLedger = true;
|
||||
}
|
||||
void clearNeedNetworkLedger ()
|
||||
{
|
||||
mNeedNetworkLedger = false;
|
||||
}
|
||||
bool isNeedNetworkLedger ()
|
||||
{
|
||||
return mNeedNetworkLedger;
|
||||
}
|
||||
bool isFull ()
|
||||
{
|
||||
return !mNeedNetworkLedger && (mMode == omFULL);
|
||||
}
|
||||
void setProposing (bool p, bool v)
|
||||
{
|
||||
mProposing = p;
|
||||
mValidating = v;
|
||||
}
|
||||
bool isProposing ()
|
||||
{
|
||||
return mProposing;
|
||||
}
|
||||
bool isValidating ()
|
||||
{
|
||||
return mValidating;
|
||||
}
|
||||
bool isFeatureBlocked ()
|
||||
{
|
||||
return mFeatureBlocked;
|
||||
}
|
||||
void setFeatureBlocked ();
|
||||
void consensusViewChange ();
|
||||
int getPreviousProposers ()
|
||||
{
|
||||
return mLastCloseProposers;
|
||||
}
|
||||
int getPreviousConvergeTime ()
|
||||
{
|
||||
return mLastCloseConvergeTime;
|
||||
}
|
||||
uint32 getLastCloseTime ()
|
||||
{
|
||||
return mLastCloseTime;
|
||||
}
|
||||
void setLastCloseTime (uint32 t)
|
||||
{
|
||||
mLastCloseTime = t;
|
||||
}
|
||||
Json::Value getConsensusInfo ();
|
||||
Json::Value getServerInfo (bool human, bool admin);
|
||||
uint32 acceptLedger ();
|
||||
boost::unordered_map < uint160,
|
||||
std::list<LedgerProposal::pointer> > & peekStoredProposals ()
|
||||
{
|
||||
return mStoredProposals;
|
||||
}
|
||||
void storeProposal (LedgerProposal::ref proposal, const RippleAddress& peerPublic);
|
||||
uint256 getConsensusLCL ();
|
||||
void reportFeeChange ();
|
||||
|
||||
//Helper function to generate SQL query to get transactions
|
||||
std::string transactionsSQL(std::string selection, const RippleAddress& account,
|
||||
int32 minLedger, int32 maxLedger, bool descending, uint32 offset, int limit,
|
||||
bool binary, bool count, bool bAdmin);
|
||||
//Helper function to generate SQL query to get transactions
|
||||
std::string transactionsSQL (std::string selection, const RippleAddress& account,
|
||||
int32 minLedger, int32 maxLedger, bool descending, uint32 offset, int limit,
|
||||
bool binary, bool count, bool bAdmin);
|
||||
|
||||
|
||||
// client information retrieval functions
|
||||
std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> >
|
||||
getAccountTxs(const RippleAddress& account, int32 minLedger, int32 maxLedger, bool descending, uint32 offset, int limit, bool bAdmin);
|
||||
// client information retrieval functions
|
||||
std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> >
|
||||
getAccountTxs (const RippleAddress& account, int32 minLedger, int32 maxLedger, bool descending, uint32 offset, int limit, bool bAdmin);
|
||||
|
||||
typedef boost::tuple<std::string, std::string, uint32> txnMetaLedgerType;
|
||||
std::vector<txnMetaLedgerType>
|
||||
getAccountTxsB(const RippleAddress& account, int32 minLedger, int32 maxLedger, bool descending, uint32 offset, int limit, bool bAdmin);
|
||||
typedef boost::tuple<std::string, std::string, uint32> txnMetaLedgerType;
|
||||
std::vector<txnMetaLedgerType>
|
||||
getAccountTxsB (const RippleAddress& account, int32 minLedger, int32 maxLedger, bool descending, uint32 offset, int limit, bool bAdmin);
|
||||
|
||||
std::vector<RippleAddress> getLedgerAffectedAccounts(uint32 ledgerSeq);
|
||||
std::vector<SerializedTransaction> getLedgerTransactions(uint32 ledgerSeq);
|
||||
uint32 countAccountTxs(const RippleAddress& account, int32 minLedger, int32 maxLedger);
|
||||
//
|
||||
// Monitoring: publisher side
|
||||
//
|
||||
void pubLedger(Ledger::ref lpAccepted);
|
||||
void pubProposedTransaction(Ledger::ref lpCurrent, SerializedTransaction::ref stTxn, TER terResult);
|
||||
std::vector<RippleAddress> getLedgerAffectedAccounts (uint32 ledgerSeq);
|
||||
std::vector<SerializedTransaction> getLedgerTransactions (uint32 ledgerSeq);
|
||||
uint32 countAccountTxs (const RippleAddress& account, int32 minLedger, int32 maxLedger);
|
||||
//
|
||||
// Monitoring: publisher side
|
||||
//
|
||||
void pubLedger (Ledger::ref lpAccepted);
|
||||
void pubProposedTransaction (Ledger::ref lpCurrent, SerializedTransaction::ref stTxn, TER terResult);
|
||||
|
||||
|
||||
//
|
||||
// Monitoring: subscriber side
|
||||
//
|
||||
void subAccount(InfoSub::ref ispListener, const boost::unordered_set<RippleAddress>& vnaAccountIDs, uint32 uLedgerIndex, bool rt);
|
||||
void unsubAccount(uint64 uListener, const boost::unordered_set<RippleAddress>& vnaAccountIDs, bool rt);
|
||||
//
|
||||
// Monitoring: subscriber side
|
||||
//
|
||||
void subAccount (InfoSub::ref ispListener, const boost::unordered_set<RippleAddress>& vnaAccountIDs, uint32 uLedgerIndex, bool rt);
|
||||
void unsubAccount (uint64 uListener, const boost::unordered_set<RippleAddress>& vnaAccountIDs, bool rt);
|
||||
|
||||
bool subLedger(InfoSub::ref ispListener, Json::Value& jvResult);
|
||||
bool unsubLedger(uint64 uListener);
|
||||
bool subLedger (InfoSub::ref ispListener, Json::Value& jvResult);
|
||||
bool unsubLedger (uint64 uListener);
|
||||
|
||||
bool subServer(InfoSub::ref ispListener, Json::Value& jvResult);
|
||||
bool unsubServer(uint64 uListener);
|
||||
bool subServer (InfoSub::ref ispListener, Json::Value& jvResult);
|
||||
bool unsubServer (uint64 uListener);
|
||||
|
||||
bool subBook(InfoSub::ref ispListener, const uint160& currencyPays, const uint160& currencyGets,
|
||||
const uint160& issuerPays, const uint160& issuerGets);
|
||||
bool unsubBook(uint64 uListener, const uint160& currencyPays, const uint160& currencyGets,
|
||||
const uint160& issuerPays, const uint160& issuerGets);
|
||||
bool subBook (InfoSub::ref ispListener, const uint160& currencyPays, const uint160& currencyGets,
|
||||
const uint160& issuerPays, const uint160& issuerGets);
|
||||
bool unsubBook (uint64 uListener, const uint160& currencyPays, const uint160& currencyGets,
|
||||
const uint160& issuerPays, const uint160& issuerGets);
|
||||
|
||||
bool subTransactions(InfoSub::ref ispListener);
|
||||
bool unsubTransactions(uint64 uListener);
|
||||
bool subTransactions (InfoSub::ref ispListener);
|
||||
bool unsubTransactions (uint64 uListener);
|
||||
|
||||
bool subRTTransactions(InfoSub::ref ispListener);
|
||||
bool unsubRTTransactions(uint64 uListener);
|
||||
bool subRTTransactions (InfoSub::ref ispListener);
|
||||
bool unsubRTTransactions (uint64 uListener);
|
||||
|
||||
InfoSub::pointer findRpcSub(const std::string& strUrl);
|
||||
InfoSub::pointer addRpcSub(const std::string& strUrl, InfoSub::ref rspEntry);
|
||||
InfoSub::pointer findRpcSub (const std::string& strUrl);
|
||||
InfoSub::pointer addRpcSub (const std::string& strUrl, InfoSub::ref rspEntry);
|
||||
|
||||
private:
|
||||
typedef boost::unordered_map<uint160, subMapType> subInfoMapType;
|
||||
typedef boost::unordered_map<uint160, subMapType>::value_type subInfoMapValue;
|
||||
typedef boost::unordered_map<uint160, subMapType>::iterator subInfoMapIterator;
|
||||
typedef boost::unordered_map<uint160, subMapType> subInfoMapType;
|
||||
typedef boost::unordered_map<uint160, subMapType>::value_type subInfoMapValue;
|
||||
typedef boost::unordered_map<uint160, subMapType>::iterator subInfoMapIterator;
|
||||
|
||||
typedef boost::unordered_map<std::string, InfoSub::pointer> subRpcMapType;
|
||||
typedef boost::unordered_map<std::string, InfoSub::pointer> subRpcMapType;
|
||||
|
||||
OperatingMode mMode;
|
||||
bool mNeedNetworkLedger;
|
||||
bool mProposing, mValidating;
|
||||
bool mFeatureBlocked;
|
||||
boost::posix_time::ptime mConnectTime;
|
||||
boost::asio::deadline_timer mNetTimer;
|
||||
boost::shared_ptr<LedgerConsensus> mConsensus;
|
||||
boost::unordered_map<uint160,
|
||||
std::list<LedgerProposal::pointer> > mStoredProposals;
|
||||
OperatingMode mMode;
|
||||
bool mNeedNetworkLedger;
|
||||
bool mProposing, mValidating;
|
||||
bool mFeatureBlocked;
|
||||
boost::posix_time::ptime mConnectTime;
|
||||
boost::asio::deadline_timer mNetTimer;
|
||||
boost::shared_ptr<LedgerConsensus> mConsensus;
|
||||
boost::unordered_map < uint160,
|
||||
std::list<LedgerProposal::pointer> > mStoredProposals;
|
||||
|
||||
LedgerMaster* mLedgerMaster;
|
||||
LedgerAcquire::pointer mAcquiringLedger;
|
||||
LedgerMaster* mLedgerMaster;
|
||||
LedgerAcquire::pointer mAcquiringLedger;
|
||||
|
||||
int mCloseTimeOffset;
|
||||
int mCloseTimeOffset;
|
||||
|
||||
// last ledger close
|
||||
int mLastCloseProposers, mLastCloseConvergeTime;
|
||||
uint256 mLastCloseHash;
|
||||
uint32 mLastCloseTime;
|
||||
uint32 mLastValidationTime;
|
||||
SerializedValidation::pointer mLastValidation;
|
||||
// last ledger close
|
||||
int mLastCloseProposers, mLastCloseConvergeTime;
|
||||
uint256 mLastCloseHash;
|
||||
uint32 mLastCloseTime;
|
||||
uint32 mLastValidationTime;
|
||||
SerializedValidation::pointer mLastValidation;
|
||||
|
||||
// Recent positions taken
|
||||
std::map<uint256, std::pair<int, SHAMap::pointer> > mRecentPositions;
|
||||
// Recent positions taken
|
||||
std::map<uint256, std::pair<int, SHAMap::pointer> > mRecentPositions;
|
||||
|
||||
// XXX Split into more locks.
|
||||
boost::recursive_mutex mMonitorLock;
|
||||
subInfoMapType mSubAccount;
|
||||
subInfoMapType mSubRTAccount;
|
||||
// XXX Split into more locks.
|
||||
boost::recursive_mutex mMonitorLock;
|
||||
subInfoMapType mSubAccount;
|
||||
subInfoMapType mSubRTAccount;
|
||||
|
||||
subRpcMapType mRpcSubMap;
|
||||
subRpcMapType mRpcSubMap;
|
||||
|
||||
subMapType mSubLedger; // accepted ledgers
|
||||
subMapType mSubServer; // when server changes connectivity state
|
||||
subMapType mSubTransactions; // all accepted transactions
|
||||
subMapType mSubRTTransactions; // all proposed and accepted transactions
|
||||
subMapType mSubLedger; // accepted ledgers
|
||||
subMapType mSubServer; // when server changes connectivity state
|
||||
subMapType mSubTransactions; // all accepted transactions
|
||||
subMapType mSubRTTransactions; // all proposed and accepted transactions
|
||||
|
||||
JSONCache mJSONCache;
|
||||
JSONCache mJSONCache;
|
||||
|
||||
TaggedCache< uint256, Blob , UptimeTimerAdapter > mFetchPack;
|
||||
uint32 mLastFetchPack;
|
||||
uint32 mFetchSeq;
|
||||
TaggedCache< uint256, Blob , UptimeTimerAdapter > mFetchPack;
|
||||
uint32 mLastFetchPack;
|
||||
uint32 mFetchSeq;
|
||||
|
||||
uint32 mLastLoadBase;
|
||||
uint32 mLastLoadFactor;
|
||||
uint32 mLastLoadBase;
|
||||
uint32 mLastLoadFactor;
|
||||
|
||||
void setMode(OperatingMode);
|
||||
void setMode (OperatingMode);
|
||||
|
||||
Json::Value transJson(const SerializedTransaction& stTxn, TER terResult, bool bValidated, Ledger::ref lpCurrent);
|
||||
bool haveConsensusObject();
|
||||
Json::Value transJson (const SerializedTransaction& stTxn, TER terResult, bool bValidated, Ledger::ref lpCurrent);
|
||||
bool haveConsensusObject ();
|
||||
|
||||
Json::Value pubBootstrapAccountInfo(Ledger::ref lpAccepted, const RippleAddress& naAccountID);
|
||||
Json::Value pubBootstrapAccountInfo (Ledger::ref lpAccepted, const RippleAddress& naAccountID);
|
||||
|
||||
void pubValidatedTransaction(Ledger::ref alAccepted, const AcceptedLedgerTx& alTransaction);
|
||||
void pubAccountTransaction(Ledger::ref lpCurrent, const AcceptedLedgerTx& alTransaction, bool isAccepted);
|
||||
void pubValidatedTransaction (Ledger::ref alAccepted, const AcceptedLedgerTx& alTransaction);
|
||||
void pubAccountTransaction (Ledger::ref lpCurrent, const AcceptedLedgerTx& alTransaction, bool isAccepted);
|
||||
|
||||
void pubServer();
|
||||
void pubServer ();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user