Files
rippled/NetworkOPs.h
JoelKatz 639ba9dfcb NetworkOPs layer
Begin coding the 'NetworkOPs' layer. This will provide most of the
functions 'client' code will want to call such as functions to lookup
transactions, check on their status, get balances, and so on. Much of the
RPC layer will be a thin wrapper over these functions.

The purpose of this layer is to permit the node to support these functions
regardless of its operating mode or available data, as long as it's
connected to the network. If synchronized and tracking the current ledger,
it can do most functions locally. If not, it can ask for help from other
nodes. If hopeless, it can return an error code.
2011-12-15 01:19:50 -08:00

50 lines
1.7 KiB
C++

#ifndef __NETWORK_OPS__
#define __NETWORK_OPS__
#include "Transaction.h"
#include "AccountState.h"
// Operations that clients may wish to perform against the network
class NetworkOPs
{
enum Fault
{
IO_ERROR=1,
NO_NETWORK=2,
};
public:
// network information
uint64 getNetworkTime();
uint32 getCurrentLedgerID();
// transaction operations
Transaction::pointer processTransaction(Transaction::pointer transaction);
Transaction::pointer findTransactionByID(const uint256& transactionID);
int findTransactionsBySource(std::list<Transaction::pointer>&, const uint160& sourceAccount,
uint32 minSeq, uint32 maxSeq);
int findTransactionsByDestination(std::list<Transaction::pointer>&, const uint160& destinationAccount,
uint32 startLedgerSeq, uint32 endLedgerSeq, int maxTransactions);
// account operations
AccountState::pointer getAccountState(const uint160& accountID);
// contact block operations
// raw object operations
bool findRawLedger(const uint256& ledgerHash, std::vector<unsigned char>& rawLedger);
bool findRawTransaction(const uint256& transactionHash, std::vector<unsigned char>& rawTransaction);
bool findAccountNode(const uint256& nodeHash, std::vector<unsigned char>& rawAccountNode);
bool findTransactionNode(const uint256& nodeHash, std::vector<unsigned char>& rawTransactionNode);
// tree synchronzation operations
bool getTransactionTreeNodes(uint32 ledgerSeq, const uint256& myNodeID,
const std::vector<unsigned char>& myNode, std::list<std::vector<unsigned char> >& newNodes);
bool getAccountStateNodes(uint32 ledgerSeq, const uint256& myNodeId,
const std::vector<unsigned char>& myNode, std::list<std::vector<unsigned char> >& newNodes);
};
#endif