mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-25 05:25:55 +00:00
Move streaming Json objects to ripple/json.
This commit is contained in:
@@ -2267,10 +2267,19 @@
|
|||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\ripple\json\impl\Object.cpp">
|
||||||
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\ripple\json\impl\Output.cpp">
|
||||||
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\ripple\json\impl\to_string.cpp">
|
<ClCompile Include="..\..\src\ripple\json\impl\to_string.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\ripple\json\impl\Writer.cpp">
|
||||||
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\json\JsonPropertyStream.h">
|
<ClInclude Include="..\..\src\ripple\json\JsonPropertyStream.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\json\json_forwards.h">
|
<ClInclude Include="..\..\src\ripple\json\json_forwards.h">
|
||||||
@@ -2281,12 +2290,27 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\json\json_writer.h">
|
<ClInclude Include="..\..\src\ripple\json\json_writer.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\ripple\json\Object.h">
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\ripple\json\Output.h">
|
||||||
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\json\tests\JsonCpp.test.cpp">
|
<ClCompile Include="..\..\src\ripple\json\tests\JsonCpp.test.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\ripple\json\tests\Object.test.cpp">
|
||||||
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\ripple\json\tests\Output.test.cpp">
|
||||||
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\ripple\json\tests\Writer.test.cpp">
|
||||||
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\json\to_string.h">
|
<ClInclude Include="..\..\src\ripple\json\to_string.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\ripple\json\Writer.h">
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\net\HTTPClient.h">
|
<ClInclude Include="..\..\src\ripple\net\HTTPClient.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\net\HTTPRequest.h">
|
<ClInclude Include="..\..\src\ripple\net\HTTPRequest.h">
|
||||||
@@ -3116,16 +3140,6 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\impl\Handler.h">
|
<ClInclude Include="..\..\src\ripple\rpc\impl\Handler.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\impl\JsonObject.cpp">
|
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\impl\JsonObject.h">
|
|
||||||
</ClInclude>
|
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\impl\JsonWriter.cpp">
|
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\impl\JsonWriter.h">
|
|
||||||
</ClInclude>
|
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\impl\KeypairForSignature.cpp">
|
<ClCompile Include="..\..\src\ripple\rpc\impl\KeypairForSignature.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -3168,11 +3182,6 @@
|
|||||||
<ClCompile Include="..\..\src\ripple\rpc\impl\Utilities.cpp">
|
<ClCompile Include="..\..\src\ripple\rpc\impl\Utilities.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\impl\WriteJson.cpp">
|
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\impl\WriteJson.h">
|
|
||||||
</ClInclude>
|
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\impl\Yield.cpp">
|
<ClCompile Include="..\..\src\ripple\rpc\impl\Yield.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -3180,8 +3189,6 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\Manager.h">
|
<ClInclude Include="..\..\src\ripple\rpc\Manager.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\Output.h">
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\Request.h">
|
<ClInclude Include="..\..\src\ripple\rpc\Request.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\RPCHandler.h">
|
<ClInclude Include="..\..\src\ripple\rpc\RPCHandler.h">
|
||||||
@@ -3193,15 +3200,9 @@
|
|||||||
<ClCompile Include="..\..\src\ripple\rpc\tests\Coroutine.test.cpp">
|
<ClCompile Include="..\..\src\ripple\rpc\tests\Coroutine.test.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\tests\JsonObject.test.cpp">
|
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\tests\JSONRPC.test.cpp">
|
<ClCompile Include="..\..\src\ripple\rpc\tests\JSONRPC.test.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\tests\JsonWriter.test.cpp">
|
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\tests\KeyGeneration.test.cpp">
|
<ClCompile Include="..\..\src\ripple\rpc\tests\KeyGeneration.test.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -3210,9 +3211,6 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\tests\TestOutputSuite.test.h">
|
<ClInclude Include="..\..\src\ripple\rpc\tests\TestOutputSuite.test.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\tests\WriteJson.test.cpp">
|
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\tests\Yield.test.cpp">
|
<ClCompile Include="..\..\src\ripple\rpc\tests\Yield.test.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|||||||
@@ -3024,9 +3024,18 @@
|
|||||||
<ClCompile Include="..\..\src\ripple\json\impl\json_writer.cpp">
|
<ClCompile Include="..\..\src\ripple\json\impl\json_writer.cpp">
|
||||||
<Filter>ripple\json\impl</Filter>
|
<Filter>ripple\json\impl</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\ripple\json\impl\Object.cpp">
|
||||||
|
<Filter>ripple\json\impl</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\ripple\json\impl\Output.cpp">
|
||||||
|
<Filter>ripple\json\impl</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\ripple\json\impl\to_string.cpp">
|
<ClCompile Include="..\..\src\ripple\json\impl\to_string.cpp">
|
||||||
<Filter>ripple\json\impl</Filter>
|
<Filter>ripple\json\impl</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\ripple\json\impl\Writer.cpp">
|
||||||
|
<Filter>ripple\json\impl</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\json\JsonPropertyStream.h">
|
<ClInclude Include="..\..\src\ripple\json\JsonPropertyStream.h">
|
||||||
<Filter>ripple\json</Filter>
|
<Filter>ripple\json</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -3042,12 +3051,30 @@
|
|||||||
<ClInclude Include="..\..\src\ripple\json\json_writer.h">
|
<ClInclude Include="..\..\src\ripple\json\json_writer.h">
|
||||||
<Filter>ripple\json</Filter>
|
<Filter>ripple\json</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\ripple\json\Object.h">
|
||||||
|
<Filter>ripple\json</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\ripple\json\Output.h">
|
||||||
|
<Filter>ripple\json</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\json\tests\JsonCpp.test.cpp">
|
<ClCompile Include="..\..\src\ripple\json\tests\JsonCpp.test.cpp">
|
||||||
<Filter>ripple\json\tests</Filter>
|
<Filter>ripple\json\tests</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\ripple\json\tests\Object.test.cpp">
|
||||||
|
<Filter>ripple\json\tests</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\ripple\json\tests\Output.test.cpp">
|
||||||
|
<Filter>ripple\json\tests</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\ripple\json\tests\Writer.test.cpp">
|
||||||
|
<Filter>ripple\json\tests</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\json\to_string.h">
|
<ClInclude Include="..\..\src\ripple\json\to_string.h">
|
||||||
<Filter>ripple\json</Filter>
|
<Filter>ripple\json</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\ripple\json\Writer.h">
|
||||||
|
<Filter>ripple\json</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\net\HTTPClient.h">
|
<ClInclude Include="..\..\src\ripple\net\HTTPClient.h">
|
||||||
<Filter>ripple\net</Filter>
|
<Filter>ripple\net</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -3876,18 +3903,6 @@
|
|||||||
<ClInclude Include="..\..\src\ripple\rpc\impl\Handler.h">
|
<ClInclude Include="..\..\src\ripple\rpc\impl\Handler.h">
|
||||||
<Filter>ripple\rpc\impl</Filter>
|
<Filter>ripple\rpc\impl</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\impl\JsonObject.cpp">
|
|
||||||
<Filter>ripple\rpc\impl</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\impl\JsonObject.h">
|
|
||||||
<Filter>ripple\rpc\impl</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\impl\JsonWriter.cpp">
|
|
||||||
<Filter>ripple\rpc\impl</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\impl\JsonWriter.h">
|
|
||||||
<Filter>ripple\rpc\impl</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\impl\KeypairForSignature.cpp">
|
<ClCompile Include="..\..\src\ripple\rpc\impl\KeypairForSignature.cpp">
|
||||||
<Filter>ripple\rpc\impl</Filter>
|
<Filter>ripple\rpc\impl</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -3936,12 +3951,6 @@
|
|||||||
<ClCompile Include="..\..\src\ripple\rpc\impl\Utilities.cpp">
|
<ClCompile Include="..\..\src\ripple\rpc\impl\Utilities.cpp">
|
||||||
<Filter>ripple\rpc\impl</Filter>
|
<Filter>ripple\rpc\impl</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\impl\WriteJson.cpp">
|
|
||||||
<Filter>ripple\rpc\impl</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\impl\WriteJson.h">
|
|
||||||
<Filter>ripple\rpc\impl</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\impl\Yield.cpp">
|
<ClCompile Include="..\..\src\ripple\rpc\impl\Yield.cpp">
|
||||||
<Filter>ripple\rpc\impl</Filter>
|
<Filter>ripple\rpc\impl</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -3951,9 +3960,6 @@
|
|||||||
<ClInclude Include="..\..\src\ripple\rpc\Manager.h">
|
<ClInclude Include="..\..\src\ripple\rpc\Manager.h">
|
||||||
<Filter>ripple\rpc</Filter>
|
<Filter>ripple\rpc</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\Output.h">
|
|
||||||
<Filter>ripple\rpc</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\Request.h">
|
<ClInclude Include="..\..\src\ripple\rpc\Request.h">
|
||||||
<Filter>ripple\rpc</Filter>
|
<Filter>ripple\rpc</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -3969,15 +3975,9 @@
|
|||||||
<ClCompile Include="..\..\src\ripple\rpc\tests\Coroutine.test.cpp">
|
<ClCompile Include="..\..\src\ripple\rpc\tests\Coroutine.test.cpp">
|
||||||
<Filter>ripple\rpc\tests</Filter>
|
<Filter>ripple\rpc\tests</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\tests\JsonObject.test.cpp">
|
|
||||||
<Filter>ripple\rpc\tests</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\tests\JSONRPC.test.cpp">
|
<ClCompile Include="..\..\src\ripple\rpc\tests\JSONRPC.test.cpp">
|
||||||
<Filter>ripple\rpc\tests</Filter>
|
<Filter>ripple\rpc\tests</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\tests\JsonWriter.test.cpp">
|
|
||||||
<Filter>ripple\rpc\tests</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\tests\KeyGeneration.test.cpp">
|
<ClCompile Include="..\..\src\ripple\rpc\tests\KeyGeneration.test.cpp">
|
||||||
<Filter>ripple\rpc\tests</Filter>
|
<Filter>ripple\rpc\tests</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -3987,9 +3987,6 @@
|
|||||||
<ClInclude Include="..\..\src\ripple\rpc\tests\TestOutputSuite.test.h">
|
<ClInclude Include="..\..\src\ripple\rpc\tests\TestOutputSuite.test.h">
|
||||||
<Filter>ripple\rpc\tests</Filter>
|
<Filter>ripple\rpc\tests</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\tests\WriteJson.test.cpp">
|
|
||||||
<Filter>ripple\rpc\tests</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\tests\Yield.test.cpp">
|
<ClCompile Include="..\..\src\ripple\rpc\tests\Yield.test.cpp">
|
||||||
<Filter>ripple\rpc\tests</Filter>
|
<Filter>ripple\rpc\tests</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include <ripple/protocol/JsonFields.h>
|
#include <ripple/protocol/JsonFields.h>
|
||||||
#include <ripple/protocol/STTx.h>
|
#include <ripple/protocol/STTx.h>
|
||||||
#include <ripple/rpc/Yield.h>
|
#include <ripple/rpc/Yield.h>
|
||||||
#include <ripple/rpc/impl/JsonObject.h>
|
#include <ripple/json/Object.h>
|
||||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
@@ -118,7 +118,7 @@ void fillJson (Object& json, LedgerFill const& fill)
|
|||||||
auto &transactionMap = ledger.peekTransactionMap();
|
auto &transactionMap = ledger.peekTransactionMap();
|
||||||
if (transactionMap && (bFull || fill.options & LedgerFill::dumpTxrp))
|
if (transactionMap && (bFull || fill.options & LedgerFill::dumpTxrp))
|
||||||
{
|
{
|
||||||
auto&& txns = RPC::setArray (json, jss::transactions);
|
auto&& txns = Json::setArray (json, jss::transactions);
|
||||||
SHAMapTreeNode::TNType type;
|
SHAMapTreeNode::TNType type;
|
||||||
|
|
||||||
RPC::CountedYield count (
|
RPC::CountedYield count (
|
||||||
@@ -163,7 +163,7 @@ void fillJson (Object& json, LedgerFill const& fill)
|
|||||||
auto& accountStateMap = ledger.peekAccountStateMap();
|
auto& accountStateMap = ledger.peekAccountStateMap();
|
||||||
if (accountStateMap && (bFull || fill.options & LedgerFill::dumpState))
|
if (accountStateMap && (bFull || fill.options & LedgerFill::dumpState))
|
||||||
{
|
{
|
||||||
auto&& array = RPC::setArray (json, jss::accountState);
|
auto&& array = Json::setArray (json, jss::accountState);
|
||||||
RPC::CountedYield count (
|
RPC::CountedYield count (
|
||||||
fill.yieldStrategy.accountYieldCount, fill.yield);
|
fill.yieldStrategy.accountYieldCount, fill.yield);
|
||||||
if (bFull || bExpand)
|
if (bFull || bExpand)
|
||||||
@@ -191,7 +191,7 @@ void fillJson (Object& json, LedgerFill const& fill)
|
|||||||
template <class Object>
|
template <class Object>
|
||||||
void addJson (Object& json, LedgerFill const& fill)
|
void addJson (Object& json, LedgerFill const& fill)
|
||||||
{
|
{
|
||||||
auto&& object = RPC::addObject (json, jss::ledger);
|
auto&& object = Json::addObject (json, jss::ledger);
|
||||||
fillJson (object, fill);
|
fillJson (object, fill);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,10 @@
|
|||||||
#ifndef RIPPLE_RPC_JSONOBJECT_H_INCLUDED
|
#ifndef RIPPLE_RPC_JSONOBJECT_H_INCLUDED
|
||||||
#define RIPPLE_RPC_JSONOBJECT_H_INCLUDED
|
#define RIPPLE_RPC_JSONOBJECT_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/rpc/impl/JsonWriter.h>
|
#include <ripple/json/Writer.h>
|
||||||
|
#include <beast/cxx14/memory.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace Json {
|
||||||
namespace RPC {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Collection is a base class for Array and Object, classes which provide the
|
Collection is a base class for Array and Object, classes which provide the
|
||||||
@@ -489,7 +489,6 @@ Object appendObject (Array& json)
|
|||||||
return json.appendObject ();
|
return json.appendObject ();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // RPC
|
} // Json
|
||||||
} // ripple
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -17,27 +17,35 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#ifndef RIPPLE_RPC_WRITEJSON_H_INCLUDED
|
#ifndef RIPPLE_JSON_OUTPUT_H_INCLUDED
|
||||||
#define RIPPLE_RPC_WRITEJSON_H_INCLUDED
|
#define RIPPLE_JSON_OUTPUT_H_INCLUDED
|
||||||
|
|
||||||
namespace ripple {
|
#include <boost/utility/string_ref.hpp>
|
||||||
namespace RPC {
|
|
||||||
|
namespace Json {
|
||||||
|
|
||||||
|
using Output = std::function <void (boost::string_ref const&)>;
|
||||||
|
|
||||||
|
inline
|
||||||
|
Output stringOutput (std::string& s)
|
||||||
|
{
|
||||||
|
return [&](boost::string_ref const& b) { s.append (b.data(), b.size()); };
|
||||||
|
}
|
||||||
|
|
||||||
/** Writes a minimal representation of a Json value to an Output in O(n) time.
|
/** Writes a minimal representation of a Json value to an Output in O(n) time.
|
||||||
|
|
||||||
Data is streamed right to the output, so only a marginal amount of memory is
|
Data is streamed right to the output, so only a marginal amount of memory is
|
||||||
used. This can be very important for a very large Json::Value.
|
used. This can be very important for a very large Json::Value.
|
||||||
*/
|
*/
|
||||||
void writeJson (Json::Value const&, Output const&);
|
void outputJson (Json::Value const&, Output const&);
|
||||||
|
|
||||||
/** Return the minimal string representation of a Json::Value in O(n) time.
|
/** Return the minimal string representation of a Json::Value in O(n) time.
|
||||||
|
|
||||||
This requires a memory allocation for the full size of the output.
|
This requires a memory allocation for the full size of the output.
|
||||||
If possible, use write().
|
If possible, use outputJson().
|
||||||
*/
|
*/
|
||||||
std::string jsonAsString (Json::Value const&);
|
std::string jsonAsString (Json::Value const&);
|
||||||
|
|
||||||
} // RPC
|
} // Json
|
||||||
} // ripple
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -21,12 +21,12 @@
|
|||||||
#define RIPPLE_RPC_JSONWRITER_H_INCLUDED
|
#define RIPPLE_RPC_JSONWRITER_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/basics/ToString.h>
|
#include <ripple/basics/ToString.h>
|
||||||
|
#include <ripple/json/Output.h>
|
||||||
#include <ripple/protocol/ErrorCodes.h>
|
#include <ripple/protocol/ErrorCodes.h>
|
||||||
#include <ripple/rpc/Output.h>
|
|
||||||
#include <ripple/protocol/ErrorCodes.h>
|
#include <ripple/protocol/ErrorCodes.h>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace ripple {
|
namespace Json {
|
||||||
namespace RPC {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writer implements an O(1)-space, O(1)-granular output JSON writer.
|
* Writer implements an O(1)-space, O(1)-granular output JSON writer.
|
||||||
@@ -204,11 +204,11 @@ public:
|
|||||||
template <typename Type>
|
template <typename Type>
|
||||||
void output (Type t)
|
void output (Type t)
|
||||||
{
|
{
|
||||||
implOutput (to_string (t));
|
implOutput (ripple::to_string (t));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Output an error code. */
|
/** Output an error code. */
|
||||||
void output (error_code_i t)
|
void output (ripple::error_code_i t)
|
||||||
{
|
{
|
||||||
output (int(t));
|
output (int(t));
|
||||||
}
|
}
|
||||||
@@ -244,7 +244,6 @@ inline void check (bool condition, std::string const& message)
|
|||||||
throw JsonException (message);
|
throw JsonException (message);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // RPC
|
} // Json
|
||||||
} // ripple
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -18,10 +18,9 @@
|
|||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <BeastConfig.h>
|
#include <BeastConfig.h>
|
||||||
#include <ripple/rpc/impl/JsonObject.h>
|
#include <ripple/json/Object.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace Json {
|
||||||
namespace RPC {
|
|
||||||
|
|
||||||
Collection::Collection (Collection* parent, Writer* writer)
|
Collection::Collection (Collection* parent, Writer* writer)
|
||||||
: parent_ (parent), writer_ (writer), enabled_ (true)
|
: parent_ (parent), writer_ (writer), enabled_ (true)
|
||||||
@@ -157,5 +156,4 @@ WriterObject stringWriterObject (std::string& s)
|
|||||||
return WriterObject (stringOutput (s));
|
return WriterObject (stringOutput (s));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // RPC
|
} // Json
|
||||||
} // ripple
|
|
||||||
@@ -18,15 +18,14 @@
|
|||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <BeastConfig.h>
|
#include <BeastConfig.h>
|
||||||
#include <ripple/rpc/impl/WriteJson.h>
|
#include <ripple/json/Output.h>
|
||||||
#include <ripple/rpc/impl/JsonWriter.h>
|
#include <ripple/json/Writer.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace Json {
|
||||||
namespace RPC {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void writeJson (Json::Value const& value, Writer& writer)
|
void outputJson (Json::Value const& value, Writer& writer)
|
||||||
{
|
{
|
||||||
switch (value.type())
|
switch (value.type())
|
||||||
{
|
{
|
||||||
@@ -72,7 +71,7 @@ void writeJson (Json::Value const& value, Writer& writer)
|
|||||||
for (auto const& i: value)
|
for (auto const& i: value)
|
||||||
{
|
{
|
||||||
writer.rawAppend();
|
writer.rawAppend();
|
||||||
writeJson (i, writer);
|
outputJson (i, writer);
|
||||||
}
|
}
|
||||||
writer.finish();
|
writer.finish();
|
||||||
break;
|
break;
|
||||||
@@ -85,7 +84,7 @@ void writeJson (Json::Value const& value, Writer& writer)
|
|||||||
for (auto const& tag: members)
|
for (auto const& tag: members)
|
||||||
{
|
{
|
||||||
writer.rawSet (tag);
|
writer.rawSet (tag);
|
||||||
writeJson (value[tag], writer);
|
outputJson (value[tag], writer);
|
||||||
}
|
}
|
||||||
writer.finish();
|
writer.finish();
|
||||||
break;
|
break;
|
||||||
@@ -95,19 +94,18 @@ void writeJson (Json::Value const& value, Writer& writer)
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void writeJson (Json::Value const& value, Output const& out)
|
void outputJson (Json::Value const& value, Output const& out)
|
||||||
{
|
{
|
||||||
Writer writer (out);
|
Writer writer (out);
|
||||||
writeJson (value, writer);
|
outputJson (value, writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string jsonAsString (Json::Value const& value)
|
std::string jsonAsString (Json::Value const& value)
|
||||||
{
|
{
|
||||||
std::string s;
|
std::string s;
|
||||||
Writer writer (stringOutput (s));
|
Writer writer (stringOutput (s));
|
||||||
writeJson (value, writer);
|
outputJson (value, writer);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // RPC
|
} // Json
|
||||||
} // ripple
|
|
||||||
@@ -18,12 +18,11 @@
|
|||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <BeastConfig.h>
|
#include <BeastConfig.h>
|
||||||
#include <ripple/rpc/impl/JsonWriter.h>
|
#include <ripple/json/Output.h>
|
||||||
#include <ripple/rpc/impl/WriteJson.h>
|
#include <ripple/json/Writer.h>
|
||||||
#include <beast/unit_test/suite.h>
|
#include <beast/unit_test/suite.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace Json {
|
||||||
namespace RPC {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -244,20 +243,20 @@ void Writer::output (std::string const& s)
|
|||||||
void Writer::output (Json::Value const& value)
|
void Writer::output (Json::Value const& value)
|
||||||
{
|
{
|
||||||
impl_->markStarted();
|
impl_->markStarted();
|
||||||
writeJson (value, impl_->getOutput());
|
outputJson (value, impl_->getOutput());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void Writer::output (float f)
|
void Writer::output (float f)
|
||||||
{
|
{
|
||||||
auto s = to_string (f);
|
auto s = ripple::to_string (f);
|
||||||
impl_->output ({s.data (), lengthWithoutTrailingZeros (s)});
|
impl_->output ({s.data (), lengthWithoutTrailingZeros (s)});
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void Writer::output (double f)
|
void Writer::output (double f)
|
||||||
{
|
{
|
||||||
auto s = to_string (f);
|
auto s = ripple::to_string (f);
|
||||||
impl_->output ({s.data (), lengthWithoutTrailingZeros (s)});
|
impl_->output ({s.data (), lengthWithoutTrailingZeros (s)});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,5 +314,4 @@ void Writer::finish ()
|
|||||||
impl_->finish ();
|
impl_->finish ();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // RPC
|
} // Json
|
||||||
} // ripple
|
|
||||||
@@ -178,13 +178,6 @@ std::string valueToQuotedString ( const char* value )
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Class Writer
|
|
||||||
// //////////////////////////////////////////////////////////////////
|
|
||||||
Writer::~Writer ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Class FastWriter
|
// Class FastWriter
|
||||||
// //////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|||||||
@@ -31,11 +31,10 @@ class Value;
|
|||||||
|
|
||||||
/** \brief Abstract class for writers.
|
/** \brief Abstract class for writers.
|
||||||
*/
|
*/
|
||||||
class Writer
|
class WriterBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~Writer ();
|
virtual ~WriterBase () {}
|
||||||
|
|
||||||
virtual std::string write ( const Value& root ) = 0;
|
virtual std::string write ( const Value& root ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -45,7 +44,8 @@ public:
|
|||||||
* but may be usefull to support feature such as RPC where bandwith is limited.
|
* but may be usefull to support feature such as RPC where bandwith is limited.
|
||||||
* \sa Reader, Value
|
* \sa Reader, Value
|
||||||
*/
|
*/
|
||||||
class FastWriter : public Writer
|
|
||||||
|
class FastWriter : public WriterBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FastWriter ();
|
FastWriter ();
|
||||||
@@ -78,7 +78,7 @@ private:
|
|||||||
*
|
*
|
||||||
* \sa Reader, Value, Value::setComment()
|
* \sa Reader, Value, Value::setComment()
|
||||||
*/
|
*/
|
||||||
class StyledWriter: public Writer
|
class StyledWriter: public WriterBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StyledWriter ();
|
StyledWriter ();
|
||||||
|
|||||||
@@ -18,14 +18,13 @@
|
|||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <BeastConfig.h>
|
#include <BeastConfig.h>
|
||||||
#include <ripple/rpc/impl/JsonObject.h>
|
#include <ripple/json/Object.h>
|
||||||
#include <ripple/rpc/tests/TestOutputSuite.test.h>
|
#include <ripple/rpc/tests/TestOutputSuite.test.h>
|
||||||
#include <beast/unit_test/suite.h>
|
#include <beast/unit_test/suite.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace Json {
|
||||||
namespace RPC {
|
|
||||||
|
|
||||||
class JsonObject_test : public TestOutputSuite
|
class JsonObject_test : public ripple::RPC::TestOutputSuite
|
||||||
{
|
{
|
||||||
void setup (std::string const& testName)
|
void setup (std::string const& testName)
|
||||||
{
|
{
|
||||||
@@ -240,5 +239,4 @@ public:
|
|||||||
|
|
||||||
BEAST_DEFINE_TESTSUITE(JsonObject, ripple_basics, ripple);
|
BEAST_DEFINE_TESTSUITE(JsonObject, ripple_basics, ripple);
|
||||||
|
|
||||||
} // RPC
|
} // Json
|
||||||
} // ripple
|
|
||||||
@@ -18,13 +18,12 @@
|
|||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <BeastConfig.h>
|
#include <BeastConfig.h>
|
||||||
#include <ripple/rpc/impl/WriteJson.h>
|
#include <ripple/json/Output.h>
|
||||||
#include <ripple/rpc/tests/TestOutputSuite.test.h>
|
#include <ripple/rpc/tests/TestOutputSuite.test.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace Json {
|
||||||
namespace RPC {
|
|
||||||
|
|
||||||
struct WriteJson_test : TestOutputSuite
|
struct Output_test : ripple::RPC::TestOutputSuite
|
||||||
{
|
{
|
||||||
void runTest (std::string const& name, std::string const& valueDesc)
|
void runTest (std::string const& name, std::string const& valueDesc)
|
||||||
{
|
{
|
||||||
@@ -32,7 +31,7 @@ struct WriteJson_test : TestOutputSuite
|
|||||||
Json::Value value;
|
Json::Value value;
|
||||||
expect (Json::Reader().parse (valueDesc, value));
|
expect (Json::Reader().parse (valueDesc, value));
|
||||||
auto out = stringOutput (output_);
|
auto out = stringOutput (output_);
|
||||||
writeJson (value, out);
|
outputJson (value, out);
|
||||||
|
|
||||||
// Compare with the original version.
|
// Compare with the original version.
|
||||||
auto expected = Json::FastWriter().write (value);
|
auto expected = Json::FastWriter().write (value);
|
||||||
@@ -63,7 +62,6 @@ struct WriteJson_test : TestOutputSuite
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
BEAST_DEFINE_TESTSUITE(WriteJson, ripple_basics, ripple);
|
BEAST_DEFINE_TESTSUITE(Output, ripple_basics, ripple);
|
||||||
|
|
||||||
} // RPC
|
} // Json
|
||||||
} // ripple
|
|
||||||
@@ -19,14 +19,13 @@
|
|||||||
|
|
||||||
#include <BeastConfig.h>
|
#include <BeastConfig.h>
|
||||||
#include <ripple/json/json_writer.h>
|
#include <ripple/json/json_writer.h>
|
||||||
#include <ripple/rpc/impl/JsonWriter.h>
|
#include <ripple/json/Writer.h>
|
||||||
#include <ripple/rpc/tests/TestOutputSuite.test.h>
|
#include <ripple/rpc/tests/TestOutputSuite.test.h>
|
||||||
#include <beast/unit_test/suite.h>
|
#include <beast/unit_test/suite.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace Json {
|
||||||
namespace RPC {
|
|
||||||
|
|
||||||
class JsonWriter_test : public TestOutputSuite
|
class JsonWriter_test : public ripple::RPC::TestOutputSuite
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void testTrivial ()
|
void testTrivial ()
|
||||||
@@ -203,5 +202,4 @@ public:
|
|||||||
|
|
||||||
BEAST_DEFINE_TESTSUITE(JsonWriter, ripple_basics, ripple);
|
BEAST_DEFINE_TESTSUITE(JsonWriter, ripple_basics, ripple);
|
||||||
|
|
||||||
} // RPC
|
} // Json
|
||||||
} // ripple
|
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include <beast/module/core/diagnostic/SemanticVersion.h>
|
#include <beast/module/core/diagnostic/SemanticVersion.h>
|
||||||
#include <ripple/protocol/JsonFields.h>
|
#include <ripple/protocol/JsonFields.h>
|
||||||
#include <ripple/rpc/impl/JsonObject.h>
|
#include <ripple/json/Object.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
namespace RPC {
|
namespace RPC {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#ifndef RIPPLE_RPC_YIELD_H_INCLUDED
|
#ifndef RIPPLE_RPC_YIELD_H_INCLUDED
|
||||||
#define RIPPLE_RPC_YIELD_H_INCLUDED
|
#define RIPPLE_RPC_YIELD_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/rpc/Output.h>
|
#include <ripple/json/Output.h>
|
||||||
#include <boost/coroutine/all.hpp>
|
#include <boost/coroutine/all.hpp>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@@ -49,8 +49,8 @@ using Yield = std::function <void ()>;
|
|||||||
data. This is to avoid the case where you yield after outputting data, but
|
data. This is to avoid the case where you yield after outputting data, but
|
||||||
then never send more data.
|
then never send more data.
|
||||||
*/
|
*/
|
||||||
Output chunkedYieldingOutput (
|
Json::Output chunkedYieldingOutput (
|
||||||
Output const&, Yield const&, std::size_t chunkSize);
|
Json::Output const&, Yield const&, std::size_t chunkSize);
|
||||||
|
|
||||||
/** Yield every yieldCount calls. If yieldCount is 0, never yield. */
|
/** Yield every yieldCount calls. If yieldCount is 0, never yield. */
|
||||||
class CountedYield
|
class CountedYield
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
#include <BeastConfig.h>
|
#include <BeastConfig.h>
|
||||||
#include <ripple/app/ledger/LedgerToJson.h>
|
#include <ripple/app/ledger/LedgerToJson.h>
|
||||||
#include <ripple/core/LoadFeeTrack.h>
|
#include <ripple/core/LoadFeeTrack.h>
|
||||||
|
#include <ripple/json/Object.h>
|
||||||
#include <ripple/protocol/ErrorCodes.h>
|
#include <ripple/protocol/ErrorCodes.h>
|
||||||
#include <ripple/rpc/handlers/Ledger.h>
|
#include <ripple/rpc/handlers/Ledger.h>
|
||||||
#include <ripple/rpc/impl/JsonObject.h>
|
|
||||||
#include <ripple/server/Role.h>
|
#include <ripple/server/Role.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -22,14 +22,16 @@
|
|||||||
|
|
||||||
#include <ripple/app/ledger/LedgerToJson.h>
|
#include <ripple/app/ledger/LedgerToJson.h>
|
||||||
#include <ripple/core/LoadFeeTrack.h>
|
#include <ripple/core/LoadFeeTrack.h>
|
||||||
#include <ripple/rpc/impl/JsonObject.h>
|
#include <ripple/json/Object.h>
|
||||||
#include <ripple/server/Role.h>
|
#include <ripple/server/Role.h>
|
||||||
|
|
||||||
|
namespace Json {
|
||||||
|
class Object;
|
||||||
|
}
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
namespace RPC {
|
namespace RPC {
|
||||||
|
|
||||||
class Object;
|
|
||||||
|
|
||||||
// ledger [id|index|current|closed] [full]
|
// ledger [id|index|current|closed] [full]
|
||||||
// {
|
// {
|
||||||
// ledger: 'current' | 'closed' | <uint256> | <number>, // optional
|
// ledger: 'current' | 'closed' | <uint256> | <number>, // optional
|
||||||
@@ -77,7 +79,7 @@ void LedgerHandler::writeResult (Object& value)
|
|||||||
{
|
{
|
||||||
if (ledger_)
|
if (ledger_)
|
||||||
{
|
{
|
||||||
RPC::copyFrom (value, result_);
|
Json::copyFrom (value, result_);
|
||||||
addJson (value, {*ledger_, options_, context_.yield});
|
addJson (value, {*ledger_, options_, context_.yield});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -85,11 +87,11 @@ void LedgerHandler::writeResult (Object& value)
|
|||||||
auto& master = getApp().getLedgerMaster ();
|
auto& master = getApp().getLedgerMaster ();
|
||||||
auto& yield = context_.yield;
|
auto& yield = context_.yield;
|
||||||
{
|
{
|
||||||
auto&& closed = RPC::addObject (value, jss::closed);
|
auto&& closed = Json::addObject (value, jss::closed);
|
||||||
addJson (closed, {*master.getClosedLedger(), 0, yield});
|
addJson (closed, {*master.getClosedLedger(), 0, yield});
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto&& open = RPC::addObject (value, jss::open);
|
auto&& open = Json::addObject (value, jss::open);
|
||||||
addJson (open, {*master.getCurrentLedger(), 0, yield});
|
addJson (open, {*master.getCurrentLedger(), 0, yield});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#ifndef RIPPLED_RIPPLE_RPC_HANDLERS_WALLETPROPOSE_H
|
#ifndef RIPPLED_RIPPLE_RPC_HANDLERS_WALLETPROPOSE_H
|
||||||
#define RIPPLED_RIPPLE_RPC_HANDLERS_WALLETPROPOSE_H
|
#define RIPPLED_RIPPLE_RPC_HANDLERS_WALLETPROPOSE_H
|
||||||
|
|
||||||
#include <ripple/rpc/impl/JsonObject.h>
|
#include <ripple/json/json_value.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
|||||||
@@ -85,11 +85,11 @@ class HandlerTable {
|
|||||||
assert (table_.find(HandlerImpl::name()) == table_.end());
|
assert (table_.find(HandlerImpl::name()) == table_.end());
|
||||||
|
|
||||||
Handler h;
|
Handler h;
|
||||||
h.name_ = HandlerImpl::name(),
|
h.name_ = HandlerImpl::name();
|
||||||
h.valueMethod_ = &handle<Json::Value, HandlerImpl>,
|
h.valueMethod_ = &handle<Json::Value, HandlerImpl>;
|
||||||
h.role_ = HandlerImpl::role(),
|
h.role_ = HandlerImpl::role();
|
||||||
h.condition_ = HandlerImpl::condition(),
|
h.condition_ = HandlerImpl::condition();
|
||||||
h.objectMethod_ = &handle<Object, HandlerImpl>;
|
h.objectMethod_ = &handle<Json::Object, HandlerImpl>;
|
||||||
|
|
||||||
table_[HandlerImpl::name()] = h;
|
table_[HandlerImpl::name()] = h;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -24,11 +24,13 @@
|
|||||||
#include <ripple/rpc/RPCHandler.h>
|
#include <ripple/rpc/RPCHandler.h>
|
||||||
#include <ripple/rpc/Status.h>
|
#include <ripple/rpc/Status.h>
|
||||||
|
|
||||||
|
namespace Json {
|
||||||
|
class Object;
|
||||||
|
}
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
namespace RPC {
|
namespace RPC {
|
||||||
|
|
||||||
class Object;
|
|
||||||
|
|
||||||
// Under what condition can we call this RPC?
|
// Under what condition can we call this RPC?
|
||||||
enum Condition {
|
enum Condition {
|
||||||
NO_CONDITION = 0,
|
NO_CONDITION = 0,
|
||||||
@@ -46,7 +48,7 @@ struct Handler
|
|||||||
Method<Json::Value> valueMethod_;
|
Method<Json::Value> valueMethod_;
|
||||||
Role role_;
|
Role role_;
|
||||||
RPC::Condition condition_;
|
RPC::Condition condition_;
|
||||||
Method<Object> objectMethod_;
|
Method<Json::Object> objectMethod_;
|
||||||
};
|
};
|
||||||
|
|
||||||
const Handler* getHandler (std::string const&);
|
const Handler* getHandler (std::string const&);
|
||||||
|
|||||||
@@ -22,12 +22,12 @@
|
|||||||
#include <ripple/rpc/Yield.h>
|
#include <ripple/rpc/Yield.h>
|
||||||
#include <ripple/rpc/impl/Tuning.h>
|
#include <ripple/rpc/impl/Tuning.h>
|
||||||
#include <ripple/rpc/impl/Handler.h>
|
#include <ripple/rpc/impl/Handler.h>
|
||||||
#include <ripple/rpc/impl/WriteJson.h>
|
|
||||||
#include <ripple/app/ledger/LedgerMaster.h>
|
#include <ripple/app/ledger/LedgerMaster.h>
|
||||||
#include <ripple/app/misc/NetworkOPs.h>
|
#include <ripple/app/misc/NetworkOPs.h>
|
||||||
#include <ripple/basics/Log.h>
|
#include <ripple/basics/Log.h>
|
||||||
#include <ripple/core/Config.h>
|
#include <ripple/core/Config.h>
|
||||||
#include <ripple/core/JobQueue.h>
|
#include <ripple/core/JobQueue.h>
|
||||||
|
#include <ripple/json/Object.h>
|
||||||
#include <ripple/json/to_string.h>
|
#include <ripple/json/to_string.h>
|
||||||
#include <ripple/net/InfoSub.h>
|
#include <ripple/net/InfoSub.h>
|
||||||
#include <ripple/net/RPCErr.h>
|
#include <ripple/net/RPCErr.h>
|
||||||
@@ -190,7 +190,7 @@ template <class Method, class Object>
|
|||||||
void getResult (
|
void getResult (
|
||||||
Context& context, Method method, Object& object, std::string const& name)
|
Context& context, Method method, Object& object, std::string const& name)
|
||||||
{
|
{
|
||||||
auto&& result = addObject (object, jss::result);
|
auto&& result = Json::addObject (object, jss::result);
|
||||||
if (auto status = callMethod (context, method, name, result))
|
if (auto status = callMethod (context, method, name, result))
|
||||||
{
|
{
|
||||||
WriteLog (lsDEBUG, RPCErr) << "rpcError: " << status.toString();
|
WriteLog (lsDEBUG, RPCErr) << "rpcError: " << status.toString();
|
||||||
@@ -228,13 +228,13 @@ void executeRPC (
|
|||||||
boost::optional <Handler const&> handler;
|
boost::optional <Handler const&> handler;
|
||||||
if (auto error = fillHandler (context, handler))
|
if (auto error = fillHandler (context, handler))
|
||||||
{
|
{
|
||||||
auto wo = stringWriterObject (output);
|
auto wo = Json::stringWriterObject (output);
|
||||||
auto&& sub = addObject (*wo, jss::result);
|
auto&& sub = Json::addObject (*wo, jss::result);
|
||||||
inject_error (error, sub);
|
inject_error (error, sub);
|
||||||
}
|
}
|
||||||
else if (auto method = handler->objectMethod_)
|
else if (auto method = handler->objectMethod_)
|
||||||
{
|
{
|
||||||
auto wo = stringWriterObject (output);
|
auto wo = Json::stringWriterObject (output);
|
||||||
getResult (context, method, *wo, handler->name_);
|
getResult (context, method, *wo, handler->name_);
|
||||||
}
|
}
|
||||||
else if (auto method = handler->valueMethod_)
|
else if (auto method = handler->valueMethod_)
|
||||||
@@ -250,7 +250,7 @@ void executeRPC (
|
|||||||
{
|
{
|
||||||
// Can't ever get here.
|
// Can't ever get here.
|
||||||
assert (false);
|
assert (false);
|
||||||
throw RPC::JsonException ("RPC handler with no method");
|
throw Json::JsonException ("RPC handler with no method");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,8 @@
|
|||||||
namespace ripple {
|
namespace ripple {
|
||||||
namespace RPC {
|
namespace RPC {
|
||||||
|
|
||||||
Output chunkedYieldingOutput (
|
Json::Output chunkedYieldingOutput (
|
||||||
Output const& output, Yield const& yield, std::size_t chunkSize)
|
Json::Output const& output, Yield const& yield, std::size_t chunkSize)
|
||||||
{
|
{
|
||||||
auto count = std::make_shared <std::size_t> (0);
|
auto count = std::make_shared <std::size_t> (0);
|
||||||
return [chunkSize, count, output, yield] (boost::string_ref const& bytes)
|
return [chunkSize, count, output, yield] (boost::string_ref const& bytes)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public:
|
|||||||
setup (name);
|
setup (name);
|
||||||
|
|
||||||
std::string buffer;
|
std::string buffer;
|
||||||
Output output = stringOutput (buffer);
|
Json::Output output = Json::stringOutput (buffer);
|
||||||
|
|
||||||
auto coroutine = Coroutine ([=] (Yield yield)
|
auto coroutine = Coroutine ([=] (Yield yield)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
#ifndef RIPPLE_RPC_TESTOUTPUTSUITE_H_INCLUDED
|
#ifndef RIPPLE_RPC_TESTOUTPUTSUITE_H_INCLUDED
|
||||||
#define RIPPLE_RPC_TESTOUTPUTSUITE_H_INCLUDED
|
#define RIPPLE_RPC_TESTOUTPUTSUITE_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/rpc/Output.h>
|
#include <ripple/json/Output.h>
|
||||||
#include <ripple/rpc/impl/JsonWriter.h>
|
#include <ripple/json/Writer.h>
|
||||||
#include <ripple/basics/TestSuite.h>
|
#include <ripple/basics/TestSuite.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
@@ -31,13 +31,14 @@ class TestOutputSuite : public TestSuite
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
std::string output_;
|
std::string output_;
|
||||||
std::unique_ptr <Writer> writer_;
|
std::unique_ptr <Json::Writer> writer_;
|
||||||
|
|
||||||
void setup (std::string const& testName)
|
void setup (std::string const& testName)
|
||||||
{
|
{
|
||||||
testcase (testName);
|
testcase (testName);
|
||||||
output_.clear ();
|
output_.clear ();
|
||||||
writer_ = std::make_unique <Writer> (stringOutput (output_));
|
writer_ = std::make_unique <Json::Writer> (
|
||||||
|
Json::stringOutput (output_));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test the result and report values.
|
// Test the result and report values.
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ struct Yield_test : TestOutputSuite
|
|||||||
std::string lastYield;
|
std::string lastYield;
|
||||||
|
|
||||||
auto yield = [&]() { lastYield = output_; };
|
auto yield = [&]() { lastYield = output_; };
|
||||||
auto output = chunkedYieldingOutput (stringOutput (output_), yield, 5);
|
auto output = chunkedYieldingOutput (
|
||||||
|
Json::stringOutput (output_), yield, 5);
|
||||||
output ("hello");
|
output ("hello");
|
||||||
expectResult ("hello");
|
expectResult ("hello");
|
||||||
expectEquals (lastYield, "");
|
expectEquals (lastYield, "");
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ std::string getHTTPHeaderTimestamp ()
|
|||||||
return std::string (buffer);
|
return std::string (buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTTPReply (int nStatus, std::string const& content, RPC::Output output)
|
void HTTPReply (int nStatus, std::string const& content, Json::Output output)
|
||||||
{
|
{
|
||||||
if (ShouldLog (lsTRACE, RPC))
|
if (ShouldLog (lsTRACE, RPC))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,11 +21,11 @@
|
|||||||
#define RIPPLE_SERVER_JSONRPCUTIL_H_INCLUDED
|
#define RIPPLE_SERVER_JSONRPCUTIL_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/json/json_value.h>
|
#include <ripple/json/json_value.h>
|
||||||
#include <ripple/rpc/Output.h>
|
#include <ripple/json/Output.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
void HTTPReply (int nStatus, std::string const& strMsg, RPC::Output);
|
void HTTPReply (int nStatus, std::string const& strMsg, Json::Output);
|
||||||
|
|
||||||
} // ripple
|
} // ripple
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ ServerHandlerImp::onHandoff (HTTP::Session& session,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
RPC::Output makeOutput (HTTP::Session& session)
|
Json::Output makeOutput (HTTP::Session& session)
|
||||||
{
|
{
|
||||||
return [&](boost::string_ref const& b)
|
return [&](boost::string_ref const& b)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
#define RIPPLE_SERVER_SERVERHANDLERIMP_H_INCLUDED
|
#define RIPPLE_SERVER_SERVERHANDLERIMP_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/core/Job.h>
|
#include <ripple/core/Job.h>
|
||||||
|
#include <ripple/json/Output.h>
|
||||||
#include <ripple/server/ServerHandler.h>
|
#include <ripple/server/ServerHandler.h>
|
||||||
#include <ripple/server/Session.h>
|
#include <ripple/server/Session.h>
|
||||||
#include <ripple/rpc/Output.h>
|
|
||||||
#include <ripple/rpc/RPCHandler.h>
|
#include <ripple/rpc/RPCHandler.h>
|
||||||
#include <ripple/app/main/CollectorManager.h>
|
#include <ripple/app/main/CollectorManager.h>
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
~ServerHandlerImp();
|
~ServerHandlerImp();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using Output = RPC::Output;
|
using Output = Json::Output;
|
||||||
using Yield = RPC::Yield;
|
using Yield = RPC::Yield;
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -36,6 +36,13 @@
|
|||||||
#include <ripple/json/impl/json_value.cpp>
|
#include <ripple/json/impl/json_value.cpp>
|
||||||
#include <ripple/json/impl/json_writer.cpp>
|
#include <ripple/json/impl/json_writer.cpp>
|
||||||
#include <ripple/json/impl/to_string.cpp>
|
#include <ripple/json/impl/to_string.cpp>
|
||||||
|
|
||||||
#include <ripple/json/impl/JsonPropertyStream.cpp>
|
#include <ripple/json/impl/JsonPropertyStream.cpp>
|
||||||
|
#include <ripple/json/impl/Writer.cpp>
|
||||||
|
#include <ripple/json/impl/Object.cpp>
|
||||||
|
#include <ripple/json/impl/Output.cpp>
|
||||||
|
|
||||||
#include <ripple/json/tests/JsonCpp.test.cpp>
|
#include <ripple/json/tests/JsonCpp.test.cpp>
|
||||||
|
#include <ripple/json/tests/Object.test.cpp>
|
||||||
|
#include <ripple/json/tests/Output.test.cpp>
|
||||||
|
#include <ripple/json/tests/Writer.test.cpp>
|
||||||
|
|||||||
@@ -27,9 +27,6 @@
|
|||||||
#include <ripple/rpc/RPCHandler.h>
|
#include <ripple/rpc/RPCHandler.h>
|
||||||
|
|
||||||
#include <ripple/rpc/impl/Coroutine.cpp>
|
#include <ripple/rpc/impl/Coroutine.cpp>
|
||||||
#include <ripple/rpc/impl/JsonObject.cpp>
|
|
||||||
#include <ripple/rpc/impl/JsonWriter.cpp>
|
|
||||||
#include <ripple/rpc/impl/WriteJson.cpp>
|
|
||||||
#include <ripple/rpc/impl/Manager.cpp>
|
#include <ripple/rpc/impl/Manager.cpp>
|
||||||
#include <ripple/rpc/impl/RPCHandler.cpp>
|
#include <ripple/rpc/impl/RPCHandler.cpp>
|
||||||
#include <ripple/rpc/impl/Status.cpp>
|
#include <ripple/rpc/impl/Status.cpp>
|
||||||
@@ -107,10 +104,7 @@
|
|||||||
#include <ripple/rpc/impl/RPCVersion.cpp>
|
#include <ripple/rpc/impl/RPCVersion.cpp>
|
||||||
|
|
||||||
#include <ripple/rpc/tests/Coroutine.test.cpp>
|
#include <ripple/rpc/tests/Coroutine.test.cpp>
|
||||||
#include <ripple/rpc/tests/JsonObject.test.cpp>
|
|
||||||
#include <ripple/rpc/tests/JSONRPC.test.cpp>
|
#include <ripple/rpc/tests/JSONRPC.test.cpp>
|
||||||
#include <ripple/rpc/tests/JsonWriter.test.cpp>
|
|
||||||
#include <ripple/rpc/tests/KeyGeneration.test.cpp>
|
#include <ripple/rpc/tests/KeyGeneration.test.cpp>
|
||||||
#include <ripple/rpc/tests/Status.test.cpp>
|
#include <ripple/rpc/tests/Status.test.cpp>
|
||||||
#include <ripple/rpc/tests/WriteJson.test.cpp>
|
|
||||||
#include <ripple/rpc/tests/Yield.test.cpp>
|
#include <ripple/rpc/tests/Yield.test.cpp>
|
||||||
|
|||||||
Reference in New Issue
Block a user