mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-30 18:40:28 +00:00
Add insight support to TaggedCache, KeyCache:
* Move TaggedCache, KeyCache to common * Add radmap module, FullBelowCache class * Add get_seconds_clock * Inject FullBelowCache in SHAMap
This commit is contained in:
@@ -69,6 +69,7 @@ SOURCES += \
|
||||
../../src/ripple/http/ripple_http.cpp \
|
||||
../../src/ripple/json/ripple_json.cpp \
|
||||
../../src/ripple/peerfinder/ripple_peerfinder.cpp \
|
||||
../../src/ripple/radmap/ripple_radmap.cpp \
|
||||
../../src/ripple/resource/ripple_resource.cpp \
|
||||
../../src/ripple/rpc/ripple_rpc.cpp \
|
||||
../../src/ripple/sitefiles/ripple_sitefiles.cpp \
|
||||
|
||||
@@ -22,7 +22,19 @@
|
||||
<ClCompile Include="..\..\build\proto\ripple.pb.cc" />
|
||||
<ClCompile Include="..\..\src\ripple\beast\ripple_beast.cpp" />
|
||||
<ClCompile Include="..\..\src\ripple\beast\ripple_beastc.c" />
|
||||
<ClCompile Include="..\..\src\ripple\common\functional\impl\counted_bind.cpp">
|
||||
<ClCompile Include="..\..\src\ripple\common\impl\counted_bind.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\common\impl\KeyCache.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\common\impl\TaggedCache.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
@@ -134,6 +146,13 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\peerfinder\ripple_peerfinder.cpp" />
|
||||
<ClCompile Include="..\..\src\ripple\radmap\impl\BasicFullBelowCache.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\radmap\ripple_radmap.cpp" />
|
||||
<ClCompile Include="..\..\src\ripple\resource\impl\Charge.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -1418,24 +1437,12 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\containers\KeyCache.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\containers\RangeSet.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\containers\TaggedCache.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\log\Log.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -2207,7 +2214,10 @@
|
||||
<ClInclude Include="..\..\src\ripple\algorithm\api\CycledSet.h" />
|
||||
<ClInclude Include="..\..\src\ripple\algorithm\api\DecayingSample.h" />
|
||||
<ClInclude Include="..\..\src\ripple\algorithm\api\DiscreteClock.h" />
|
||||
<ClInclude Include="..\..\src\ripple\common\functional\counted_bind.h" />
|
||||
<ClInclude Include="..\..\src\ripple\common\counted_bind.h" />
|
||||
<ClInclude Include="..\..\src\ripple\common\KeyCache.h" />
|
||||
<ClInclude Include="..\..\src\ripple\common\seconds_clock.h" />
|
||||
<ClInclude Include="..\..\src\ripple\common\TaggedCache.h" />
|
||||
<ClInclude Include="..\..\src\ripple\http\api\Handler.h" />
|
||||
<ClInclude Include="..\..\src\ripple\http\api\Server.h" />
|
||||
<ClInclude Include="..\..\src\ripple\http\api\Port.h" />
|
||||
@@ -2251,6 +2261,9 @@
|
||||
<ClInclude Include="..\..\src\ripple\peerfinder\impl\StoreSqdb.h" />
|
||||
<ClInclude Include="..\..\src\ripple\peerfinder\impl\Tuning.h" />
|
||||
<ClInclude Include="..\..\src\ripple\peerfinder\ripple_peerfinder.h" />
|
||||
<ClInclude Include="..\..\src\ripple\radmap\api\BasicFullBelowCache.h" />
|
||||
<ClInclude Include="..\..\src\ripple\radmap\api\Tuning.h" />
|
||||
<ClInclude Include="..\..\src\ripple\radmap\ripple_radmap.h" />
|
||||
<ClInclude Include="..\..\src\ripple\resource\api\Charge.h" />
|
||||
<ClInclude Include="..\..\src\ripple\resource\api\Consumer.h" />
|
||||
<ClInclude Include="..\..\src\ripple\resource\api\Disposition.h" />
|
||||
@@ -2455,6 +2468,7 @@
|
||||
<ClInclude Include="..\..\src\ripple_app\ledger\OrderBookIterator.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\ledger\SerializedValidation.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\main\CollectorManager.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\main\FullBelowCache.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\main\IoServicePool.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\main\NodeStoreScheduler.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\main\ParameterTable.h" />
|
||||
@@ -2464,6 +2478,7 @@
|
||||
<ClInclude Include="..\..\src\ripple_app\main\LocalCredentials.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\main\RippleMain.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\main\RPCHTTPServer.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\main\Tuning.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\misc\NetworkOPs.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\misc\PowResult.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\misc\AccountItem.h" />
|
||||
@@ -2528,9 +2543,7 @@
|
||||
<ClInclude Include="..\..\src\ripple_app\websocket\WSConnection.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\websocket\WSDoor.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\websocket\WSServerHandler.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\KeyCache.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\RangeSet.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\TaggedCache.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\log\Log.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\log\LogFile.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\log\LoggedTimings.h" />
|
||||
@@ -2730,6 +2743,8 @@
|
||||
<None Include="..\..\src\ripple\json\TODO.md" />
|
||||
<None Include="..\..\src\ripple\peerfinder\README.md" />
|
||||
<None Include="..\..\src\ripple\peerfinder\TODO.md" />
|
||||
<None Include="..\..\src\ripple\radmap\README.md" />
|
||||
<None Include="..\..\src\ripple\radmap\TODO.md" />
|
||||
<None Include="..\..\src\ripple\resource\README.md" />
|
||||
<None Include="..\..\src\ripple\resource\TODO.md" />
|
||||
<None Include="..\..\src\ripple\rpc\README.md" />
|
||||
|
||||
@@ -292,20 +292,23 @@
|
||||
<Filter Include="[1] Ripple\common">
|
||||
<UniqueIdentifier>{b99052d6-a903-4dfd-9c68-ff767a7d8f63}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\common\functional">
|
||||
<UniqueIdentifier>{70365f6a-d1e6-45f2-a064-0e842b0fdd78}</UniqueIdentifier>
|
||||
<Filter Include="[1] Ripple\common\impl">
|
||||
<UniqueIdentifier>{c9eed7bc-87ac-4a4f-ab79-91de2319d22a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\common\functional\impl">
|
||||
<UniqueIdentifier>{9b8137bd-737d-4825-98bf-897a0635293a}</UniqueIdentifier>
|
||||
<Filter Include="[1] Ripple\radmap">
|
||||
<UniqueIdentifier>{8840a3b4-75b5-4bc2-9992-a8c4990ed96e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\radmap\api">
|
||||
<UniqueIdentifier>{46aff75d-bfd1-47a4-b09f-e3efca4809e1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\radmap\impl">
|
||||
<UniqueIdentifier>{9adc00c7-d533-454e-b1ea-fd21ba41eb9a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\ripple_basics\containers\RangeSet.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_basics\containers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\containers\TaggedCache.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_basics\containers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\utility\CountedObject.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_basics\utility</Filter>
|
||||
</ClCompile>
|
||||
@@ -1407,15 +1410,9 @@
|
||||
<ClCompile Include="..\..\src\ripple\common\ripple_common.cpp">
|
||||
<Filter>[1] Ripple\common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\common\functional\impl\counted_bind.cpp">
|
||||
<Filter>[1] Ripple\common\functional\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_core\nodestore\backend\RocksDBFactory.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_core\nodestore\backend</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\containers\KeyCache.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_basics\containers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_core\nodestore\impl\Backend.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_core\nodestore\impl</Filter>
|
||||
</ClCompile>
|
||||
@@ -1452,17 +1449,26 @@
|
||||
<ClCompile Include="..\..\src\ripple_app\ledger\DirectoryEntryIterator.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_app\ledger</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\common\impl\counted_bind.cpp">
|
||||
<Filter>[1] Ripple\common\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\common\impl\KeyCache.cpp">
|
||||
<Filter>[1] Ripple\common\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\common\impl\TaggedCache.cpp">
|
||||
<Filter>[1] Ripple\common\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\radmap\ripple_radmap.cpp">
|
||||
<Filter>[1] Ripple\radmap</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\radmap\impl\BasicFullBelowCache.cpp">
|
||||
<Filter>[1] Ripple\radmap\impl</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\KeyCache.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\containers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\RangeSet.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\containers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\TaggedCache.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\containers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\system\BoostIncludes.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\system</Filter>
|
||||
</ClInclude>
|
||||
@@ -2913,9 +2919,6 @@
|
||||
<ClInclude Include="..\..\src\ripple\types\api\RippleAssets.h">
|
||||
<Filter>[1] Ripple\types\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\common\functional\counted_bind.h">
|
||||
<Filter>[1] Ripple\common\functional</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_core\nodestore\backend\RocksDBFactory.h">
|
||||
<Filter>[2] Old Ripple\ripple_core\nodestore\backend</Filter>
|
||||
</ClInclude>
|
||||
@@ -2952,6 +2955,33 @@
|
||||
<ClInclude Include="..\..\src\ripple_app\paths\PathRequests.h">
|
||||
<Filter>[2] Old Ripple\ripple_app\paths</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\common\counted_bind.h">
|
||||
<Filter>[1] Ripple\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\common\KeyCache.h">
|
||||
<Filter>[1] Ripple\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\common\TaggedCache.h">
|
||||
<Filter>[1] Ripple\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\radmap\api\Tuning.h">
|
||||
<Filter>[1] Ripple\radmap\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\radmap\ripple_radmap.h">
|
||||
<Filter>[1] Ripple\radmap</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\common\seconds_clock.h">
|
||||
<Filter>[1] Ripple\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\radmap\api\BasicFullBelowCache.h">
|
||||
<Filter>[1] Ripple\radmap\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_app\main\FullBelowCache.h">
|
||||
<Filter>[2] Old Ripple\ripple_app\main</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_app\main\Tuning.h">
|
||||
<Filter>[2] Old Ripple\ripple_app\main</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="..\..\src\ripple_data\protocol\ripple.proto">
|
||||
@@ -3067,6 +3097,12 @@
|
||||
<None Include="..\..\src\ripple_app\ledger\TODO.md">
|
||||
<Filter>[2] Old Ripple\ripple_app\ledger</Filter>
|
||||
</None>
|
||||
<None Include="..\..\src\ripple\radmap\README.md">
|
||||
<Filter>[1] Ripple\radmap</Filter>
|
||||
</None>
|
||||
<None Include="..\..\src\ripple\radmap\TODO.md">
|
||||
<Filter>[1] Ripple\radmap</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\..\doc\todo\NIKB_TODO.txt">
|
||||
|
||||
@@ -22,7 +22,19 @@
|
||||
<ClCompile Include="..\..\build\proto\ripple.pb.cc" />
|
||||
<ClCompile Include="..\..\src\ripple\beast\ripple_beast.cpp" />
|
||||
<ClCompile Include="..\..\src\ripple\beast\ripple_beastc.c" />
|
||||
<ClCompile Include="..\..\src\ripple\common\functional\impl\counted_bind.cpp">
|
||||
<ClCompile Include="..\..\src\ripple\common\impl\counted_bind.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\common\impl\KeyCache.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\common\impl\TaggedCache.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
@@ -134,6 +146,13 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\peerfinder\ripple_peerfinder.cpp" />
|
||||
<ClCompile Include="..\..\src\ripple\radmap\impl\BasicFullBelowCache.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\radmap\ripple_radmap.cpp" />
|
||||
<ClCompile Include="..\..\src\ripple\resource\impl\Charge.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -1418,24 +1437,12 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\containers\KeyCache.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\containers\RangeSet.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\containers\TaggedCache.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\log\Log.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -2207,7 +2214,10 @@
|
||||
<ClInclude Include="..\..\src\ripple\algorithm\api\CycledSet.h" />
|
||||
<ClInclude Include="..\..\src\ripple\algorithm\api\DecayingSample.h" />
|
||||
<ClInclude Include="..\..\src\ripple\algorithm\api\DiscreteClock.h" />
|
||||
<ClInclude Include="..\..\src\ripple\common\functional\counted_bind.h" />
|
||||
<ClInclude Include="..\..\src\ripple\common\counted_bind.h" />
|
||||
<ClInclude Include="..\..\src\ripple\common\KeyCache.h" />
|
||||
<ClInclude Include="..\..\src\ripple\common\seconds_clock.h" />
|
||||
<ClInclude Include="..\..\src\ripple\common\TaggedCache.h" />
|
||||
<ClInclude Include="..\..\src\ripple\http\api\Handler.h" />
|
||||
<ClInclude Include="..\..\src\ripple\http\api\Server.h" />
|
||||
<ClInclude Include="..\..\src\ripple\http\api\Port.h" />
|
||||
@@ -2251,6 +2261,9 @@
|
||||
<ClInclude Include="..\..\src\ripple\peerfinder\impl\StoreSqdb.h" />
|
||||
<ClInclude Include="..\..\src\ripple\peerfinder\impl\Tuning.h" />
|
||||
<ClInclude Include="..\..\src\ripple\peerfinder\ripple_peerfinder.h" />
|
||||
<ClInclude Include="..\..\src\ripple\radmap\api\BasicFullBelowCache.h" />
|
||||
<ClInclude Include="..\..\src\ripple\radmap\api\Tuning.h" />
|
||||
<ClInclude Include="..\..\src\ripple\radmap\ripple_radmap.h" />
|
||||
<ClInclude Include="..\..\src\ripple\resource\api\Charge.h" />
|
||||
<ClInclude Include="..\..\src\ripple\resource\api\Consumer.h" />
|
||||
<ClInclude Include="..\..\src\ripple\resource\api\Disposition.h" />
|
||||
@@ -2455,6 +2468,7 @@
|
||||
<ClInclude Include="..\..\src\ripple_app\ledger\OrderBookIterator.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\ledger\SerializedValidation.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\main\CollectorManager.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\main\FullBelowCache.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\main\IoServicePool.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\main\NodeStoreScheduler.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\main\ParameterTable.h" />
|
||||
@@ -2464,6 +2478,7 @@
|
||||
<ClInclude Include="..\..\src\ripple_app\main\LocalCredentials.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\main\RippleMain.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\main\RPCHTTPServer.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\main\Tuning.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\misc\NetworkOPs.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\misc\PowResult.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\misc\AccountItem.h" />
|
||||
@@ -2528,10 +2543,8 @@
|
||||
<ClInclude Include="..\..\src\ripple_app\websocket\WSConnection.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\websocket\WSDoor.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\websocket\WSServerHandler.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\KeyCache.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\RangeSet.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\SyncUnorderedMap.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\TaggedCache.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\log\Log.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\log\LogFile.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\log\LoggedTimings.h" />
|
||||
@@ -2731,6 +2744,8 @@
|
||||
<None Include="..\..\src\ripple\json\TODO.md" />
|
||||
<None Include="..\..\src\ripple\peerfinder\README.md" />
|
||||
<None Include="..\..\src\ripple\peerfinder\TODO.md" />
|
||||
<None Include="..\..\src\ripple\radmap\README.md" />
|
||||
<None Include="..\..\src\ripple\radmap\TODO.md" />
|
||||
<None Include="..\..\src\ripple\resource\README.md" />
|
||||
<None Include="..\..\src\ripple\resource\TODO.md" />
|
||||
<None Include="..\..\src\ripple\rpc\README.md" />
|
||||
|
||||
@@ -292,11 +292,17 @@
|
||||
<Filter Include="[1] Ripple\common">
|
||||
<UniqueIdentifier>{b99052d6-a903-4dfd-9c68-ff767a7d8f63}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\common\functional">
|
||||
<UniqueIdentifier>{e2a53cb6-0594-4646-a36f-68d598972da4}</UniqueIdentifier>
|
||||
<Filter Include="[1] Ripple\common\impl">
|
||||
<UniqueIdentifier>{6f3085f6-dbe3-4622-a680-682787d0708c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\common\functional\impl">
|
||||
<UniqueIdentifier>{24383350-1f23-42f8-8b58-399fee670b17}</UniqueIdentifier>
|
||||
<Filter Include="[1] Ripple\radmap">
|
||||
<UniqueIdentifier>{1b34e7e8-8260-488c-8d09-bdd3b474f9e3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\radmap\api">
|
||||
<UniqueIdentifier>{19de3695-4341-49db-9da2-b220bc9e0149}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\radmap\impl">
|
||||
<UniqueIdentifier>{67371f65-f9be-45b1-81e8-c83ef3336e5c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -1443,14 +1449,20 @@
|
||||
<ClCompile Include="..\..\src\ripple_app\ledger\DirectoryEntryIterator.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_app\ledger</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\common\functional\impl\counted_bind.cpp">
|
||||
<Filter>[1] Ripple\common\functional\impl</Filter>
|
||||
<ClCompile Include="..\..\src\ripple\radmap\ripple_radmap.cpp">
|
||||
<Filter>[1] Ripple\radmap</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\containers\KeyCache.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_basics\containers</Filter>
|
||||
<ClCompile Include="..\..\src\ripple\radmap\impl\BasicFullBelowCache.cpp">
|
||||
<Filter>[1] Ripple\radmap\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\containers\TaggedCache.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_basics\containers</Filter>
|
||||
<ClCompile Include="..\..\src\ripple\common\impl\counted_bind.cpp">
|
||||
<Filter>[1] Ripple\common\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\common\impl\KeyCache.cpp">
|
||||
<Filter>[1] Ripple\common\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\common\impl\TaggedCache.cpp">
|
||||
<Filter>[1] Ripple\common\impl</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -2946,14 +2958,32 @@
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\SyncUnorderedMap.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\containers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\common\functional\counted_bind.h">
|
||||
<Filter>[1] Ripple\common\functional</Filter>
|
||||
<ClInclude Include="..\..\src\ripple\radmap\ripple_radmap.h">
|
||||
<Filter>[1] Ripple\radmap</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\KeyCache.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\containers</Filter>
|
||||
<ClInclude Include="..\..\src\ripple\radmap\api\BasicFullBelowCache.h">
|
||||
<Filter>[1] Ripple\radmap\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\TaggedCache.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\containers</Filter>
|
||||
<ClInclude Include="..\..\src\ripple\radmap\api\Tuning.h">
|
||||
<Filter>[1] Ripple\radmap\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\common\counted_bind.h">
|
||||
<Filter>[1] Ripple\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\common\KeyCache.h">
|
||||
<Filter>[1] Ripple\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\common\seconds_clock.h">
|
||||
<Filter>[1] Ripple\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\common\TaggedCache.h">
|
||||
<Filter>[1] Ripple\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_app\main\FullBelowCache.h">
|
||||
<Filter>[2] Old Ripple\ripple_app\main</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_app\main\Tuning.h">
|
||||
<Filter>[2] Old Ripple\ripple_app\main</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -3070,6 +3100,12 @@
|
||||
<None Include="..\..\src\ripple_app\ledger\TODO.md">
|
||||
<Filter>[2] Old Ripple\ripple_app\ledger</Filter>
|
||||
</None>
|
||||
<None Include="..\..\src\ripple\radmap\README.md">
|
||||
<Filter>[1] Ripple\radmap</Filter>
|
||||
</None>
|
||||
<None Include="..\..\src\ripple\radmap\TODO.md">
|
||||
<Filter>[1] Ripple\radmap</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\..\doc\todo\NIKB_TODO.txt">
|
||||
|
||||
@@ -167,6 +167,7 @@ COMPILED_FILES.extend([
|
||||
'src/ripple/http/ripple_http.cpp',
|
||||
'src/ripple/json/ripple_json.cpp',
|
||||
'src/ripple/peerfinder/ripple_peerfinder.cpp',
|
||||
'src/ripple/radmap/ripple_radmap.cpp',
|
||||
'src/ripple/resource/ripple_resource.cpp',
|
||||
'src/ripple/rocksdb/ripple_rocksdb.cpp',
|
||||
'src/ripple/rpc/ripple_rpc.cpp',
|
||||
|
||||
@@ -20,11 +20,14 @@
|
||||
#ifndef RIPPLE_KEYCACHE_H_INCLUDED
|
||||
#define RIPPLE_KEYCACHE_H_INCLUDED
|
||||
|
||||
#include "beast/beast/chrono/abstract_clock.h"
|
||||
|
||||
#include <mutex>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <boost/smart_ptr.hpp>
|
||||
|
||||
#include "beast/beast/chrono/abstract_clock.h"
|
||||
#include "beast/beast/Insight.h"
|
||||
|
||||
namespace ripple {
|
||||
|
||||
/** Maintains a cache of keys with no associated data.
|
||||
@@ -48,6 +51,26 @@ public:
|
||||
typedef abstract_clock <std::chrono::seconds> clock_type;
|
||||
|
||||
private:
|
||||
struct Stats
|
||||
{
|
||||
template <class Handler>
|
||||
Stats (std::string const& prefix, Handler const& handler,
|
||||
insight::Collector::ptr const& collector)
|
||||
: hook (collector->make_hook (handler))
|
||||
, size (collector->make_gauge (prefix, "size"))
|
||||
, hit_rate (collector->make_gauge (prefix, "hit_rate"))
|
||||
, hits (0)
|
||||
, misses (0)
|
||||
{ }
|
||||
|
||||
insight::Hook hook;
|
||||
insight::Gauge size;
|
||||
insight::Gauge hit_rate;
|
||||
|
||||
std::size_t hits;
|
||||
std::size_t misses;
|
||||
};
|
||||
|
||||
struct Entry
|
||||
{
|
||||
explicit Entry (clock_type::time_point const& last_access_)
|
||||
@@ -61,9 +84,10 @@ private:
|
||||
typedef std::unordered_map <key_type, Entry, Hash, KeyEqual> map_type;
|
||||
typedef typename map_type::iterator iterator;
|
||||
typedef std::lock_guard <Mutex> lock_guard;
|
||||
|
||||
|
||||
Mutex mutable m_mutex;
|
||||
map_type m_map;
|
||||
Stats mutable m_stats;
|
||||
clock_type& m_clock;
|
||||
std::string const m_name;
|
||||
unsigned int m_target_size;
|
||||
@@ -77,10 +101,27 @@ public:
|
||||
@param size The initial target size.
|
||||
@param age The initial expiration time.
|
||||
*/
|
||||
KeyCache (std::string const& name,
|
||||
clock_type& clock, size_type target_size = 0,
|
||||
KeyCache (std::string const& name, clock_type& clock,
|
||||
insight::Collector::ptr const& collector, size_type target_size = 0,
|
||||
clock_type::rep expiration_seconds = 120)
|
||||
: m_clock (clock)
|
||||
: m_stats (name,
|
||||
std::bind (&KeyCache::collect_metrics, this),
|
||||
collector)
|
||||
, m_clock (clock)
|
||||
, m_name (name)
|
||||
, m_target_size (target_size)
|
||||
, m_target_age (std::chrono::seconds (expiration_seconds))
|
||||
{
|
||||
assert (m_target_size >= 0);
|
||||
}
|
||||
|
||||
// VFALCO TODO Use a forwarding constructor call here
|
||||
KeyCache (std::string const& name, clock_type& clock,
|
||||
size_type target_size = 0, clock_type::rep expiration_seconds = 120)
|
||||
: m_stats (name,
|
||||
std::bind (&KeyCache::collect_metrics, this),
|
||||
insight::NullCollector::New ())
|
||||
, m_clock (clock)
|
||||
, m_name (name)
|
||||
, m_target_size (target_size)
|
||||
, m_target_age (std::chrono::seconds (expiration_seconds))
|
||||
@@ -96,6 +137,12 @@ public:
|
||||
return m_name;
|
||||
}
|
||||
|
||||
/** Return the clock associated with the cache. */
|
||||
clock_type& clock ()
|
||||
{
|
||||
return m_clock;
|
||||
}
|
||||
|
||||
/** Returns the number of items in the container. */
|
||||
size_type size () const
|
||||
{
|
||||
@@ -118,7 +165,13 @@ public:
|
||||
{
|
||||
lock_guard lock (m_mutex);
|
||||
typename map_type::const_iterator const iter (m_map.find (key));
|
||||
return iter != m_map.end ();
|
||||
if (iter != m_map.end ())
|
||||
{
|
||||
++m_stats.hits;
|
||||
return true;
|
||||
}
|
||||
++m_stats.misses;
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Insert the specified key.
|
||||
@@ -149,8 +202,12 @@ public:
|
||||
lock_guard lock (m_mutex);
|
||||
iterator const iter (m_map.find (key));
|
||||
if (iter == m_map.end ())
|
||||
{
|
||||
++m_stats.misses;
|
||||
return false;
|
||||
}
|
||||
iter->second.last_access = m_clock.now ();
|
||||
++m_stats.hits;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -161,7 +218,13 @@ public:
|
||||
bool erase (key_type const& key)
|
||||
{
|
||||
lock_guard lock (m_mutex);
|
||||
return m_map.erase (key) > 0;
|
||||
if (m_map.erase (key) > 0)
|
||||
{
|
||||
++m_stats.hits;
|
||||
return true;
|
||||
}
|
||||
++m_stats.misses;
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Remove stale entries from the cache. */
|
||||
@@ -207,6 +270,23 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void collect_metrics ()
|
||||
{
|
||||
m_stats.size.set (size ());
|
||||
|
||||
{
|
||||
insight::Gauge::value_type hit_rate (0);
|
||||
{
|
||||
lock_guard lock (m_mutex);
|
||||
auto const total (m_stats.hits + m_stats.misses);
|
||||
if (total != 0)
|
||||
hit_rate = (m_stats.hits * 100) / total;
|
||||
}
|
||||
m_stats.hit_rate.set (hit_rate);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
@@ -23,6 +23,10 @@
|
||||
#include <mutex>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <boost/smart_ptr.hpp>
|
||||
|
||||
#include "beast/beast/Insight.h"
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// VFALCO NOTE Deprecated
|
||||
@@ -49,7 +53,7 @@ template <
|
||||
//class Allocator = std::allocator <std::pair <Key const, Entry>>,
|
||||
class Mutex = std::recursive_mutex
|
||||
>
|
||||
class TaggedCacheType
|
||||
class TaggedCache
|
||||
{
|
||||
public:
|
||||
typedef Mutex mutex_type;
|
||||
@@ -65,10 +69,14 @@ public:
|
||||
|
||||
public:
|
||||
// VFALCO TODO Change expiration_seconds to clock_type::duration
|
||||
TaggedCacheType (std::string const& name, int size,
|
||||
clock_type::rep expiration_seconds, clock_type& clock, Journal journal)
|
||||
TaggedCache (std::string const& name, int size,
|
||||
clock_type::rep expiration_seconds, clock_type& clock, Journal journal,
|
||||
insight::Collector::ptr const& collector = insight::NullCollector::New ())
|
||||
: m_journal (journal)
|
||||
, m_clock (clock)
|
||||
, m_stats (name,
|
||||
std::bind (&TaggedCache::collect_metrics, this),
|
||||
collector)
|
||||
, m_name (name)
|
||||
, m_target_size (size)
|
||||
, m_target_age (std::chrono::seconds (expiration_seconds))
|
||||
@@ -78,6 +86,13 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
/** Return the clock associated with the cache. */
|
||||
clock_type& clock ()
|
||||
{
|
||||
return m_clock;
|
||||
}
|
||||
|
||||
int getTargetSize () const
|
||||
{
|
||||
lock_guard lock (m_mutex);
|
||||
@@ -453,6 +468,38 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
void collect_metrics ()
|
||||
{
|
||||
m_stats.size.set (getCacheSize ());
|
||||
|
||||
{
|
||||
insight::Gauge::value_type hit_rate (0);
|
||||
{
|
||||
lock_guard lock (m_mutex);
|
||||
auto const total (m_hits + m_misses);
|
||||
if (total != 0)
|
||||
hit_rate = (m_hits * 100) / total;
|
||||
}
|
||||
m_stats.hit_rate.set (hit_rate);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
struct Stats
|
||||
{
|
||||
template <class Handler>
|
||||
Stats (std::string const& prefix, Handler const& handler,
|
||||
insight::Collector::ptr const& collector)
|
||||
: hook (collector->make_hook (handler))
|
||||
, size (collector->make_gauge (prefix, "size"))
|
||||
, hit_rate (collector->make_gauge (prefix, "hit_rate"))
|
||||
{ }
|
||||
|
||||
insight::Hook hook;
|
||||
insight::Gauge size;
|
||||
insight::Gauge hit_rate;
|
||||
};
|
||||
|
||||
class Entry
|
||||
{
|
||||
public:
|
||||
@@ -481,6 +528,7 @@ private:
|
||||
|
||||
Journal m_journal;
|
||||
clock_type& m_clock;
|
||||
Stats m_stats;
|
||||
|
||||
mutex_type mutable m_mutex;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include "KeyCache.h"
|
||||
#include "../KeyCache.h"
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include "../TaggedCache.h"
|
||||
|
||||
namespace ripple {
|
||||
|
||||
/*
|
||||
@@ -44,7 +46,7 @@ public:
|
||||
|
||||
typedef int Key;
|
||||
typedef std::string Value;
|
||||
typedef TaggedCacheType <Key, Value> Cache;
|
||||
typedef TaggedCache <Key, Value> Cache;
|
||||
|
||||
Cache c ("test", 1, 1, clock, j);
|
||||
|
||||
@@ -21,4 +21,6 @@
|
||||
|
||||
#include "../../beast/modules/beast_core/beast_core.h" // for UnitTest
|
||||
|
||||
#include "functional/impl/counted_bind.cpp"
|
||||
#include "impl/counted_bind.cpp"
|
||||
#include "impl/KeyCache.cpp"
|
||||
#include "impl/TaggedCache.cpp"
|
||||
|
||||
38
src/ripple/common/seconds_clock.h
Normal file
38
src/ripple/common/seconds_clock.h
Normal file
@@ -0,0 +1,38 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_SECONDS_CLOCK_H_INCLUDED
|
||||
#define RIPPLE_SECONDS_CLOCK_H_INCLUDED
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#include "beast/beast/chrono/basic_seconds_clock.h"
|
||||
|
||||
namespace ripple {
|
||||
|
||||
/** Returns an abstract_clock optimized for counting seconds. */
|
||||
inline beast::abstract_clock <std::chrono::seconds>& get_seconds_clock ()
|
||||
{
|
||||
typedef beast::basic_seconds_clock <std::chrono::steady_clock> clock_type;
|
||||
return beast::get_abstract_clock <clock_type, std::chrono::seconds> ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
5
src/ripple/radmap/README.md
Normal file
5
src/ripple/radmap/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# RadMap
|
||||
|
||||
A RadMap is a combination radix tree and hash map.
|
||||
|
||||
(Formerly known as SHAMap)
|
||||
1
src/ripple/radmap/TODO.md
Normal file
1
src/ripple/radmap/TODO.md
Normal file
@@ -0,0 +1 @@
|
||||
# RadMap TODO
|
||||
117
src/ripple/radmap/api/BasicFullBelowCache.h
Normal file
117
src/ripple/radmap/api/BasicFullBelowCache.h
Normal file
@@ -0,0 +1,117 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_RADMAP_BASICFULLBELOWCACHE_H_INCLUDED
|
||||
#define RIPPLE_RADMAP_BASICFULLBELOWCACHE_H_INCLUDED
|
||||
|
||||
#include "beast/beast/insight/Collector.h"
|
||||
|
||||
#include "../../common/KeyCache.h"
|
||||
|
||||
#include "Tuning.h"
|
||||
|
||||
namespace ripple {
|
||||
namespace RadMap {
|
||||
|
||||
/** Remembers which tree keys have all descendants resident.
|
||||
This optimizes the process of acquiring a complete tree.
|
||||
*/
|
||||
template <class Key>
|
||||
class BasicFullBelowCache
|
||||
{
|
||||
private:
|
||||
typedef KeyCache <Key> CacheType;
|
||||
|
||||
public:
|
||||
typedef Key key_type;
|
||||
typedef typename CacheType::size_type size_type;
|
||||
typedef typename CacheType::clock_type clock_type;
|
||||
|
||||
/** Construct the cache.
|
||||
|
||||
@param name A label for diagnostics and stats reporting.
|
||||
@param collector The collector to use for reporting stats.
|
||||
@param targetSize The cache target size.
|
||||
@param targetExpirationSeconds The expiration time for items.
|
||||
*/
|
||||
BasicFullBelowCache (std::string const& name, clock_type& clock,
|
||||
beast::insight::Collector::ptr const& collector =
|
||||
beast::insight::NullCollector::New (),
|
||||
std::size_t target_size = defaultCacheTargetSize,
|
||||
std::size_t expiration_seconds = defaultCacheExpirationSeconds)
|
||||
: m_cache (name, clock, collector, target_size,
|
||||
expiration_seconds)
|
||||
{
|
||||
}
|
||||
|
||||
/** Return the clock associated with the cache. */
|
||||
clock_type& clock()
|
||||
{
|
||||
return m_cache.clock ();
|
||||
}
|
||||
|
||||
/** Return the number of elements in the cache.
|
||||
Thread safety:
|
||||
Safe to call from any thread.
|
||||
*/
|
||||
size_type size () const
|
||||
{
|
||||
return m_cache.size ();
|
||||
}
|
||||
|
||||
/** Remove expired cache items.
|
||||
Thread safety:
|
||||
Safe to call from any thread.
|
||||
*/
|
||||
void sweep ()
|
||||
{
|
||||
m_cache.sweep ();
|
||||
}
|
||||
|
||||
/** Refresh the last access time of an item, if it exists.
|
||||
Thread safety:
|
||||
Safe to call from any thread.
|
||||
@param key The key to refresh.
|
||||
@return `true` If the key exists.
|
||||
*/
|
||||
bool touch_if_exists (key_type const& key)
|
||||
{
|
||||
return m_cache.touch_if_exists (key);
|
||||
}
|
||||
|
||||
/** Insert a key into the cache.
|
||||
If the key already exists, the last access time will still
|
||||
be refreshed.
|
||||
Thread safety:
|
||||
Safe to call from any thread.
|
||||
@param key The key to insert.
|
||||
*/
|
||||
void insert (key_type const& key)
|
||||
{
|
||||
m_cache.insert (key);
|
||||
}
|
||||
|
||||
private:
|
||||
KeyCache <Key> m_cache;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
36
src/ripple/radmap/api/Tuning.h
Normal file
36
src/ripple/radmap/api/Tuning.h
Normal file
@@ -0,0 +1,36 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_RADMAP_TUNING_H_INCLUDED
|
||||
#define RIPPLE_RADMAP_TUNING_H_INCLUDED
|
||||
|
||||
namespace ripple {
|
||||
namespace RadMap {
|
||||
|
||||
enum
|
||||
{
|
||||
defaultCacheTargetSize = 0
|
||||
|
||||
,defaultCacheExpirationSeconds = 120
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
28
src/ripple/radmap/impl/BasicFullBelowCache.cpp
Normal file
28
src/ripple/radmap/impl/BasicFullBelowCache.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
|
||||
namespace ripple {
|
||||
namespace RadMap {
|
||||
|
||||
// Unit test to go here if the class becomes
|
||||
// a non-trivial wrapper for KeyCache.
|
||||
|
||||
}
|
||||
}
|
||||
22
src/ripple/radmap/ripple_radmap.cpp
Normal file
22
src/ripple/radmap/ripple_radmap.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include "BeastConfig.h"
|
||||
|
||||
#include "impl/BasicFullBelowCache.cpp"
|
||||
26
src/ripple/radmap/ripple_radmap.h
Normal file
26
src/ripple/radmap/ripple_radmap.h
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_RADMAP_H_INCLUDED
|
||||
#define RIPPLE_RADMAP_H_INCLUDED
|
||||
|
||||
#include "api/BasicFullBelowCache.h"
|
||||
#include "api/Tuning.h"
|
||||
|
||||
#endif
|
||||
@@ -17,8 +17,6 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include "beast/beast/make_unique.h"
|
||||
|
||||
namespace ripple {
|
||||
namespace Resource {
|
||||
|
||||
@@ -34,9 +32,7 @@ public:
|
||||
Journal journal)
|
||||
: Thread ("Resource::Manager")
|
||||
, m_journal (journal)
|
||||
, m_logic (collector,
|
||||
get_abstract_clock <std::chrono::steady_clock, std::chrono::seconds> (),
|
||||
journal)
|
||||
, m_logic (collector, get_seconds_clock (), journal)
|
||||
{
|
||||
startThread ();
|
||||
}
|
||||
|
||||
@@ -22,12 +22,14 @@
|
||||
#include "ripple_resource.h"
|
||||
|
||||
#include "../algorithm/api/DecayingSample.h"
|
||||
#include "../common/seconds_clock.h"
|
||||
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h"
|
||||
#include <boost/utility/base_from_member.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
#include "beast/beast/Insight.h"
|
||||
#include "beast/beast/make_unique.h"
|
||||
|
||||
#include "impl/Fees.cpp"
|
||||
# include "impl/Kind.h"
|
||||
|
||||
@@ -275,8 +275,8 @@ public:
|
||||
{
|
||||
if (hash.isZero ())
|
||||
{
|
||||
SHAMap::pointer empty
|
||||
= boost::make_shared<SHAMap> (smtTRANSACTION);
|
||||
SHAMap::pointer empty = boost::make_shared<SHAMap> (
|
||||
smtTRANSACTION, std::ref (getApp().getFullBelowCache()));
|
||||
mapComplete (hash, empty, false);
|
||||
return empty;
|
||||
}
|
||||
|
||||
@@ -20,10 +20,9 @@
|
||||
// VFALCO TODO Remove this global and make it a member of the App
|
||||
// Use a dependency injection to give AcceptedLedger access.
|
||||
//
|
||||
TaggedCacheType <uint256, AcceptedLedger> AcceptedLedger::s_cache (
|
||||
"AcceptedLedger", 4, 60,
|
||||
get_abstract_clock <std::chrono::steady_clock, std::chrono::seconds> (),
|
||||
LogPartition::getJournal <TaggedCacheLog> ());
|
||||
TaggedCache <uint256, AcceptedLedger> AcceptedLedger::s_cache (
|
||||
"AcceptedLedger", 4, 60, get_seconds_clock (),
|
||||
LogPartition::getJournal <TaggedCacheLog> ());
|
||||
|
||||
AcceptedLedger::AcceptedLedger (Ledger::ref ledger) : mLedger (ledger)
|
||||
{
|
||||
|
||||
@@ -83,7 +83,7 @@ private:
|
||||
void insert (AcceptedLedgerTx::ref);
|
||||
|
||||
private:
|
||||
static TaggedCacheType <uint256, AcceptedLedger> s_cache;
|
||||
static TaggedCache <uint256, AcceptedLedger> s_cache;
|
||||
|
||||
Ledger::pointer mLedger;
|
||||
map_t mMap;
|
||||
|
||||
@@ -36,8 +36,10 @@ Ledger::Ledger (const RippleAddress& masterID, uint64 startAmount)
|
||||
, mValidHash (false)
|
||||
, mAccepted (false)
|
||||
, mImmutable (false)
|
||||
, mTransactionMap (boost::make_shared <SHAMap> (smtTRANSACTION))
|
||||
, mAccountStateMap (boost::make_shared <SHAMap> (smtSTATE))
|
||||
, mTransactionMap (boost::make_shared <SHAMap> (smtTRANSACTION,
|
||||
std::ref (getApp().getFullBelowCache())))
|
||||
, mAccountStateMap (boost::make_shared <SHAMap> (smtSTATE,
|
||||
std::ref (getApp().getFullBelowCache())))
|
||||
{
|
||||
// special case: put coins in root account
|
||||
AccountState::pointer startAccount = boost::make_shared<AccountState> (masterID);
|
||||
@@ -81,8 +83,10 @@ Ledger::Ledger (uint256 const& parentHash,
|
||||
, mValidHash (false)
|
||||
, mAccepted (false)
|
||||
, mImmutable (true)
|
||||
, mTransactionMap (boost::make_shared <SHAMap> (smtTRANSACTION, transHash))
|
||||
, mAccountStateMap (boost::make_shared <SHAMap> (smtSTATE, accountHash))
|
||||
, mTransactionMap (boost::make_shared <SHAMap> (
|
||||
smtTRANSACTION, transHash, std::ref (getApp().getFullBelowCache())))
|
||||
, mAccountStateMap (boost::make_shared <SHAMap> (smtSTATE, accountHash,
|
||||
std::ref (getApp().getFullBelowCache())))
|
||||
{
|
||||
updateHash ();
|
||||
loaded = true;
|
||||
@@ -140,7 +144,8 @@ Ledger::Ledger (bool /* dummy */,
|
||||
, mValidHash (false)
|
||||
, mAccepted (false)
|
||||
, mImmutable (false)
|
||||
, mTransactionMap (boost::make_shared <SHAMap> (smtTRANSACTION))
|
||||
, mTransactionMap (boost::make_shared <SHAMap> (smtTRANSACTION,
|
||||
std::ref (getApp().getFullBelowCache())))
|
||||
, mAccountStateMap (prevLedger.mAccountStateMap->snapShot (true))
|
||||
{
|
||||
prevLedger.updateHash ();
|
||||
@@ -181,8 +186,12 @@ Ledger::Ledger (Blob const& rawLedger,
|
||||
initializeFees ();
|
||||
}
|
||||
|
||||
Ledger::Ledger (const std::string& rawLedger, bool hasPrefix) :
|
||||
mClosed (false), mValidated(false), mValidHash (false), mAccepted (false), mImmutable (true)
|
||||
Ledger::Ledger (const std::string& rawLedger, bool hasPrefix)
|
||||
: mClosed (false)
|
||||
, mValidated (false)
|
||||
, mValidHash (false)
|
||||
, mAccepted (false)
|
||||
, mImmutable (true)
|
||||
{
|
||||
Serializer s (rawLedger);
|
||||
setRaw (s, hasPrefix);
|
||||
@@ -261,8 +270,10 @@ void Ledger::setRaw (Serializer& s, bool hasPrefix)
|
||||
|
||||
if (mValidHash)
|
||||
{
|
||||
mTransactionMap = boost::make_shared<SHAMap> (smtTRANSACTION, mTransHash);
|
||||
mAccountStateMap = boost::make_shared<SHAMap> (smtSTATE, mAccountHash);
|
||||
mTransactionMap = boost::make_shared<SHAMap> (smtTRANSACTION, mTransHash,
|
||||
std::ref (getApp().getFullBelowCache()));
|
||||
mAccountStateMap = boost::make_shared<SHAMap> (smtSTATE, mAccountHash,
|
||||
std::ref (getApp().getFullBelowCache()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,13 +31,10 @@
|
||||
|
||||
LedgerHistory::LedgerHistory ()
|
||||
: m_ledgers_by_hash ("LedgerCache", CACHED_LEDGER_NUM, CACHED_LEDGER_AGE,
|
||||
get_abstract_clock <std::chrono::steady_clock, std::chrono::seconds> (),
|
||||
LogPartition::getJournal <TaggedCacheLog> ())
|
||||
get_seconds_clock (), LogPartition::getJournal <TaggedCacheLog> ())
|
||||
, m_consensus_validated ("ConsensusValidated", 64, 300,
|
||||
get_abstract_clock <std::chrono::steady_clock, std::chrono::seconds> (),
|
||||
LogPartition::getJournal <TaggedCacheLog> ())
|
||||
get_seconds_clock (), LogPartition::getJournal <TaggedCacheLog> ())
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
void LedgerHistory::addLedger (Ledger::pointer ledger, bool validated)
|
||||
|
||||
@@ -53,12 +53,12 @@ public:
|
||||
bool fixIndex(LedgerIndex ledgerIndex, LedgerHash const& ledgerHash);
|
||||
|
||||
private:
|
||||
typedef TaggedCacheType <LedgerHash, Ledger> LedgersByHash;
|
||||
typedef TaggedCache <LedgerHash, Ledger> LedgersByHash;
|
||||
|
||||
LedgersByHash m_ledgers_by_hash;
|
||||
|
||||
//typedef std::pair <LedgerHash, LedgerHash>
|
||||
typedef TaggedCacheType <LedgerIndex,
|
||||
typedef TaggedCache <LedgerIndex,
|
||||
std::pair< LedgerHash, LedgerHash >> ConsensusValidated;
|
||||
ConsensusValidated m_consensus_validated;
|
||||
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include "../ripple/common/seconds_clock.h"
|
||||
#include "Tuning.h"
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// VFALCO TODO Clean this global up
|
||||
static bool volatile doShutdown = false;
|
||||
|
||||
@@ -107,6 +112,7 @@ public:
|
||||
std::unique_ptr <CollectorManager> m_collectorManager;
|
||||
std::unique_ptr <Resource::Manager> m_resourceManager;
|
||||
std::unique_ptr <RPC::Manager> m_rpcServiceManager;
|
||||
std::unique_ptr <FullBelowCache> m_fullBelowCache;
|
||||
|
||||
// These are Stoppable-related
|
||||
NodeStoreScheduler m_nodeStoreScheduler;
|
||||
@@ -203,13 +209,11 @@ public:
|
||||
, m_nodeStoreManager (NodeStore::make_Manager (
|
||||
std::move (make_Factories ())))
|
||||
|
||||
, m_tempNodeCache ("NodeCache", 16384, 90,
|
||||
get_abstract_clock <std::chrono::steady_clock, std::chrono::seconds> (),
|
||||
LogPartition::getJournal <TaggedCacheLog> ())
|
||||
, m_tempNodeCache ("NodeCache", 16384, 90, get_seconds_clock (),
|
||||
LogPartition::getJournal <TaggedCacheLog> ())
|
||||
|
||||
, m_sleCache ("LedgerEntryCache", 4096, 120,
|
||||
get_abstract_clock <std::chrono::steady_clock, std::chrono::seconds> (),
|
||||
LogPartition::getJournal <TaggedCacheLog> ())
|
||||
, m_sleCache ("LedgerEntryCache", 4096, 120, get_seconds_clock (),
|
||||
LogPartition::getJournal <TaggedCacheLog> ())
|
||||
|
||||
, m_collectorManager (CollectorManager::New (
|
||||
getConfig().insightSettings,
|
||||
@@ -222,6 +226,10 @@ public:
|
||||
, m_rpcServiceManager (RPC::Manager::New (
|
||||
LogPartition::getJournal <RPCServiceManagerLog> ()))
|
||||
|
||||
, m_fullBelowCache (std::make_unique <FullBelowCache> (
|
||||
"full_below", get_seconds_clock (), m_collectorManager->collector (),
|
||||
fullBelowTargetSize, fullBelowExpirationSeconds))
|
||||
|
||||
, m_nodeStoreScheduler (*this)
|
||||
|
||||
// The JobQueue has to come pretty early since
|
||||
@@ -252,9 +260,8 @@ public:
|
||||
*m_jobQueue, LogPartition::getJournal <LedgerMaster> ()))
|
||||
|
||||
// VFALCO NOTE Does NetworkOPs depend on LedgerMaster?
|
||||
, m_networkOPs (NetworkOPs::New (get_abstract_clock <
|
||||
std::chrono::steady_clock, std::chrono::seconds> (), *m_ledgerMaster,
|
||||
*m_jobQueue, LogPartition::getJournal <NetworkOPsLog> ()))
|
||||
, m_networkOPs (NetworkOPs::New (get_seconds_clock (), *m_ledgerMaster,
|
||||
*m_jobQueue, LogPartition::getJournal <NetworkOPsLog> ()))
|
||||
|
||||
// VFALCO NOTE LocalCredentials starts the deprecated UNL service
|
||||
, m_deprecatedUNL (UniqueNodeList::New (*m_jobQueue))
|
||||
@@ -271,8 +278,7 @@ public:
|
||||
|
||||
, m_sntpClient (SNTPClient::New (*this))
|
||||
|
||||
, m_inboundLedgers (InboundLedgers::New (get_abstract_clock <
|
||||
std::chrono::steady_clock, std::chrono::seconds> (), *m_jobQueue))
|
||||
, m_inboundLedgers (InboundLedgers::New (get_seconds_clock (), *m_jobQueue))
|
||||
|
||||
, m_txQueue (TxQueue::New ())
|
||||
|
||||
@@ -337,6 +343,11 @@ public:
|
||||
return *m_rpcServiceManager;
|
||||
}
|
||||
|
||||
FullBelowCache& getFullBelowCache ()
|
||||
{
|
||||
return *m_fullBelowCache;
|
||||
}
|
||||
|
||||
JobQueue& getJobQueue ()
|
||||
{
|
||||
return *m_jobQueue;
|
||||
@@ -1016,6 +1027,8 @@ public:
|
||||
// have listeners register for "onSweep ()" notification.
|
||||
//
|
||||
|
||||
m_fullBelowCache->sweep ();
|
||||
|
||||
logTimedCall (m_journal.warning, "TransactionMaster::sweep", __FILE__, __LINE__, boost::bind (
|
||||
&TransactionMaster::sweep, &m_txMaster));
|
||||
|
||||
@@ -1395,4 +1408,4 @@ Application& getApp ()
|
||||
return ApplicationImpBase::getInstance ();
|
||||
}
|
||||
|
||||
// class LoandObject (5removed, use git history to recover)
|
||||
}
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
#ifndef RIPPLE_APP_APPLICATION_H_INCLUDED
|
||||
#define RIPPLE_APP_APPLICATION_H_INCLUDED
|
||||
|
||||
#include "FullBelowCache.h"
|
||||
|
||||
namespace ripple {
|
||||
|
||||
namespace SiteFiles { class Manager; }
|
||||
namespace Validators { class Manager; }
|
||||
namespace Resource { class Manager; }
|
||||
@@ -49,8 +53,8 @@ class PathRequests;
|
||||
|
||||
class DatabaseCon;
|
||||
|
||||
typedef TaggedCacheType <uint256, Blob> NodeCache;
|
||||
typedef TaggedCacheType <uint256, SerializedLedgerEntry> SLECache;
|
||||
typedef TaggedCache <uint256, Blob> NodeCache;
|
||||
typedef TaggedCache <uint256, SerializedLedgerEntry> SLECache;
|
||||
|
||||
class Application : public PropertyStream::Source
|
||||
{
|
||||
@@ -79,6 +83,7 @@ public:
|
||||
virtual boost::asio::io_service& getIOService () = 0;
|
||||
virtual CollectorManager& getCollectorManager () = 0;
|
||||
virtual RPC::Manager& getRPCServiceManager() = 0;
|
||||
virtual FullBelowCache& getFullBelowCache () = 0;
|
||||
virtual JobQueue& getJobQueue () = 0;
|
||||
virtual SiteFiles::Manager& getSiteFiles () = 0;
|
||||
virtual NodeCache& getTempNodeCache () = 0;
|
||||
@@ -147,4 +152,6 @@ std::unique_ptr <Application> make_Application();
|
||||
//
|
||||
extern Application& getApp ();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
32
src/ripple_app/main/FullBelowCache.h
Normal file
32
src/ripple_app/main/FullBelowCache.h
Normal file
@@ -0,0 +1,32 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_FULLBELOWCACHE_H_INCLUDED
|
||||
#define RIPPLE_FULLBELOWCACHE_H_INCLUDED
|
||||
|
||||
#include "../ripple/types/api/UInt256.h"
|
||||
#include "../ripple/radmap/api/BasicFullBelowCache.h"
|
||||
|
||||
namespace ripple {
|
||||
|
||||
typedef RadMap::BasicFullBelowCache <uint256> FullBelowCache;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
34
src/ripple_app/main/Tuning.h
Normal file
34
src/ripple_app/main/Tuning.h
Normal file
@@ -0,0 +1,34 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_APPLICATION_TUNING_H_INCLUDED
|
||||
#define RIPPLE_APPLICATION_TUNING_H_INCLUDED
|
||||
|
||||
namespace ripple {
|
||||
|
||||
enum
|
||||
{
|
||||
fullBelowTargetSize = 524288
|
||||
|
||||
,fullBelowExpirationSeconds = 240
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -52,9 +52,8 @@ public:
|
||||
, mLastCloseConvergeTime (1000 * LEDGER_IDLE_INTERVAL)
|
||||
, mLastCloseTime (0)
|
||||
, mLastValidationTime (0)
|
||||
, mFetchPack ("FetchPack", 65536, 45,
|
||||
get_abstract_clock <std::chrono::steady_clock, std::chrono::seconds> (),
|
||||
LogPartition::getJournal <TaggedCacheLog> ())
|
||||
, mFetchPack ("FetchPack", 65536, 45, clock,
|
||||
LogPartition::getJournal <TaggedCacheLog> ())
|
||||
, mFetchSeq (0)
|
||||
, mLastLoadBase (256)
|
||||
, mLastLoadFactor (256)
|
||||
@@ -459,7 +458,7 @@ private:
|
||||
SubMapType mSubTransactions; // all accepted transactions
|
||||
SubMapType mSubRTTransactions; // all proposed and accepted transactions
|
||||
|
||||
TaggedCacheType< uint256, Blob> mFetchPack;
|
||||
TaggedCache< uint256, Blob> mFetchPack;
|
||||
uint32 mFetchSeq;
|
||||
|
||||
uint32 mLastLoadBase;
|
||||
|
||||
@@ -32,7 +32,7 @@ private:
|
||||
typedef LockType::ScopedUnlockType ScopedUnlockType;
|
||||
LockType mLock;
|
||||
|
||||
TaggedCacheType<uint256, ValidationSet> mValidations;
|
||||
TaggedCache<uint256, ValidationSet> mValidations;
|
||||
boost::unordered_map<uint160, SerializedValidation::pointer> mCurrentValidations;
|
||||
std::vector<SerializedValidation::pointer> mStaleValidations;
|
||||
|
||||
@@ -60,9 +60,8 @@ private:
|
||||
public:
|
||||
ValidationsImp ()
|
||||
: mLock (this, "Validations", __FILE__, __LINE__)
|
||||
, mValidations ("Validations", 128, 600,
|
||||
get_abstract_clock <std::chrono::steady_clock, std::chrono::seconds> (),
|
||||
LogPartition::getJournal <TaggedCacheLog> ())
|
||||
, mValidations ("Validations", 128, 600, get_seconds_clock (),
|
||||
LogPartition::getJournal <TaggedCacheLog> ())
|
||||
, mWriting (false)
|
||||
{
|
||||
mStaleValidations.reserve (512);
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
// This .cpp will end up including all of the public header
|
||||
// material in Ripple since it holds the Application object.
|
||||
|
||||
#include "../ripple/common/seconds_clock.h"
|
||||
#include "../ripple/http/ripple_http.h"
|
||||
#include "../ripple/resource/ripple_resource.h"
|
||||
#include "../ripple/rpc/ripple_rpc.h"
|
||||
@@ -47,12 +48,8 @@
|
||||
# include "main/CollectorManager.h"
|
||||
#include "main/CollectorManager.cpp"
|
||||
|
||||
|
||||
namespace ripple {
|
||||
|
||||
//
|
||||
// Application
|
||||
//
|
||||
|
||||
# include "main/NodeStoreScheduler.h"
|
||||
#include "main/NodeStoreScheduler.cpp"
|
||||
|
||||
@@ -90,15 +87,17 @@ namespace ripple {
|
||||
#include "websocket/WSConnection.cpp"
|
||||
# include "websocket/WSDoor.h"
|
||||
#include "websocket/WSDoor.cpp"
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "main/Application.cpp"
|
||||
|
||||
//
|
||||
// RippleMain
|
||||
//
|
||||
|
||||
|
||||
namespace ripple {
|
||||
# include "main/RippleMain.h"
|
||||
#include "main/RippleMain.cpp"
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -66,6 +66,9 @@
|
||||
// Order matters here. If you get compile errors,
|
||||
// reorder the include lines until the order is correct.
|
||||
|
||||
#include "../../ripple/common/KeyCache.h"
|
||||
#include "../../ripple/common/TaggedCache.h"
|
||||
|
||||
namespace ripple {
|
||||
#include "data/Database.h"
|
||||
#include "data/DatabaseCon.h"
|
||||
@@ -123,7 +126,9 @@ namespace ripple {
|
||||
#include "misc/NetworkOPs.h"
|
||||
#include "tx/TransactionMaster.h"
|
||||
#include "main/LocalCredentials.h"
|
||||
} // escape the namespace
|
||||
#include "main/Application.h"
|
||||
namespace ripple {
|
||||
#include "ledger/OrderBookDB.h"
|
||||
#include "tx/Transactor.h"
|
||||
#include "tx/ChangeTransactor.h"
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "ripple_app.h"
|
||||
|
||||
#include "../ripple/common/seconds_clock.h"
|
||||
|
||||
namespace ripple {
|
||||
|
||||
#include "shamap/SHAMap.cpp" // Uses theApp
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include "../ripple_net/ripple_net.h"
|
||||
|
||||
#include "../ripple/common/seconds_clock.h"
|
||||
|
||||
#include <fstream> // for UniqueNodeList.cpp
|
||||
|
||||
namespace ripple
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "ripple_app.h"
|
||||
#include "../ripple_net/ripple_net.h"
|
||||
|
||||
#include "../ripple/common/seconds_clock.h"
|
||||
#include "../ripple/peerfinder/ripple_peerfinder.h"
|
||||
#include "../ripple/resource/ripple_resource.h"
|
||||
#include "../ripple/validators/ripple_validators.h"
|
||||
|
||||
@@ -21,8 +21,9 @@
|
||||
|
||||
#include "ripple_app.h"
|
||||
|
||||
namespace ripple
|
||||
{
|
||||
#include "../ripple/common/seconds_clock.h"
|
||||
|
||||
namespace ripple {
|
||||
|
||||
#include "ledger/LedgerEntrySet.cpp"
|
||||
#include "ledger/AcceptedLedger.cpp"
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include "../ripple/resource/ripple_resource.h"
|
||||
|
||||
#include "../ripple/common/seconds_clock.h"
|
||||
|
||||
namespace ripple
|
||||
{
|
||||
|
||||
|
||||
@@ -2925,7 +2925,7 @@ Json::Value RPCHandler::doGetCounts (Json::Value params, Resource::Charge& loadT
|
||||
ret["ledger_hit_rate"] = getApp().getLedgerMaster ().getCacheHitRate ();
|
||||
ret["AL_hit_rate"] = AcceptedLedger::getCacheHitRate ();
|
||||
|
||||
ret["fullbelow_size"] = SHAMap::getFullBelowSize ();
|
||||
ret["fullbelow_size"] = int(getApp().getFullBelowCache().size());
|
||||
ret["treenode_size"] = SHAMap::getTreeNodeSize ();
|
||||
|
||||
std::string uptime;
|
||||
|
||||
@@ -73,7 +73,11 @@ public:
|
||||
|
||||
beginTestCase ("Build");
|
||||
|
||||
boost::shared_ptr <Table> t1 (boost::make_shared <Table> (smtFREE));
|
||||
FullBelowCache fullBelowCache ("test.full_below",
|
||||
get_seconds_clock ());
|
||||
boost::shared_ptr <Table> t1 (boost::make_shared <Table> (
|
||||
smtFREE, fullBelowCache));
|
||||
|
||||
add_random_items (tableItems, *t1, random());
|
||||
boost::shared_ptr <Table> t2 (t1->snapShot (true));
|
||||
|
||||
@@ -93,7 +97,8 @@ public:
|
||||
{
|
||||
TestFilter filter (map, journal ());
|
||||
|
||||
t3 = boost::make_shared <Table> (smtFREE, t2->getHash () );
|
||||
t3 = boost::make_shared <Table> (smtFREE, t2->getHash (),
|
||||
fullBelowCache);
|
||||
|
||||
expect (t3->fetchRoot (t2->getHash (), &filter), "unable to get root");
|
||||
|
||||
|
||||
@@ -26,9 +26,10 @@ void SHAMap::DefaultMissingNodeHandler::operator() (uint32 refNUm)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
SHAMap::SHAMap (SHAMapType t, uint32 seq,
|
||||
SHAMap::SHAMap (SHAMapType t, FullBelowCache& fullBelowCache, uint32 seq,
|
||||
MissingNodeHandler missing_node_handler)
|
||||
: mSeq (seq)
|
||||
: m_fullBelowCache (fullBelowCache)
|
||||
, mSeq (seq)
|
||||
, mLedgerSeq (0)
|
||||
, mState (smsModifying)
|
||||
, mType (t)
|
||||
@@ -43,9 +44,10 @@ SHAMap::SHAMap (SHAMapType t, uint32 seq,
|
||||
mTNByID.replace(*root, root);
|
||||
}
|
||||
|
||||
SHAMap::SHAMap (SHAMapType t, uint256 const& hash,
|
||||
SHAMap::SHAMap (SHAMapType t, uint256 const& hash, FullBelowCache& fullBelowCache,
|
||||
MissingNodeHandler missing_node_handler)
|
||||
: mSeq (1)
|
||||
: m_fullBelowCache (fullBelowCache)
|
||||
, mSeq (1)
|
||||
, mLedgerSeq (0)
|
||||
, mState (smsSynching)
|
||||
, mType (t)
|
||||
@@ -59,9 +61,9 @@ SHAMap::SHAMap (SHAMapType t, uint256 const& hash,
|
||||
mTNByID.replace(*root, root);
|
||||
}
|
||||
|
||||
TaggedCacheType< SHAMap::TNIndex, SHAMapTreeNode>
|
||||
TaggedCache< SHAMap::TNIndex, SHAMapTreeNode>
|
||||
SHAMap::treeNodeCache ("TreeNodeCache", 65536, 60,
|
||||
get_abstract_clock <std::chrono::steady_clock, std::chrono::seconds> (),
|
||||
get_seconds_clock (),
|
||||
LogPartition::getJournal <TaggedCacheLog> ());
|
||||
|
||||
SHAMap::~SHAMap ()
|
||||
@@ -108,7 +110,8 @@ std::size_t hash_value (const SHAMapNode& mn)
|
||||
|
||||
SHAMap::pointer SHAMap::snapShot (bool isMutable)
|
||||
{
|
||||
SHAMap::pointer ret = boost::make_shared<SHAMap> (mType);
|
||||
SHAMap::pointer ret = boost::make_shared<SHAMap> (mType,
|
||||
std::ref (m_fullBelowCache));
|
||||
SHAMap& newMap = *ret;
|
||||
|
||||
// Return a new SHAMap that is a snapshot of this one
|
||||
@@ -1220,6 +1223,9 @@ public:
|
||||
{
|
||||
beginTestCase ("add/traverse");
|
||||
|
||||
FullBelowCache fullBelowCache ("test.full_below",
|
||||
get_seconds_clock ());
|
||||
|
||||
// h3 and h4 differ only in the leaf, same terminal node (level 19)
|
||||
uint256 h1, h2, h3, h4, h5;
|
||||
h1.SetHex ("092891fe4ef6cee585fdc6fda0e09eb4d386363158ec3321b8123e5a772c6ca7");
|
||||
@@ -1228,7 +1234,7 @@ public:
|
||||
h4.SetHex ("b92891fe4ef6cee585fdc6fda2e09eb4d386363158ec3321b8123e5a772c6ca8");
|
||||
h5.SetHex ("a92891fe4ef6cee585fdc6fda0e09eb4d386363158ec3321b8123e5a772c6ca7");
|
||||
|
||||
SHAMap sMap (smtFREE);
|
||||
SHAMap sMap (smtFREE, fullBelowCache);
|
||||
SHAMapItem i1 (h1, IntToVUC (1)), i2 (h2, IntToVUC (2)), i3 (h3, IntToVUC (3)), i4 (h4, IntToVUC (4)), i5 (h5, IntToVUC (5));
|
||||
|
||||
unexpected (!sMap.addItem (i2, true, false), "no add");
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
#ifndef RIPPLE_SHAMAP_H
|
||||
#define RIPPLE_SHAMAP_H
|
||||
|
||||
#include "../ripple/radmap/ripple_radmap.h"
|
||||
#include "../main/FullBelowCache.h"
|
||||
|
||||
enum SHAMapState
|
||||
{
|
||||
smsModifying = 0, // Objects can be added and removed (like an open ledger)
|
||||
@@ -29,6 +32,8 @@ enum SHAMapState
|
||||
smsInvalid = 4, // Map is known not to be valid (usually synching a corrupt ledger)
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace std {
|
||||
|
||||
template <>
|
||||
@@ -42,6 +47,8 @@ struct hash <ripple::SHAMapNode>
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <>
|
||||
@@ -51,6 +58,8 @@ struct hash <ripple::SHAMapNode> : std::hash <ripple::SHAMapNode>
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class SHAMap
|
||||
@@ -88,10 +97,10 @@ public:
|
||||
|
||||
public:
|
||||
// build new map
|
||||
explicit SHAMap (SHAMapType t, uint32 seq = 1,
|
||||
MissingNodeHandler missing_node_handler = DefaultMissingNodeHandler());
|
||||
explicit SHAMap (SHAMapType t, FullBelowCache& fullBelowCache,
|
||||
uint32 seq = 1, MissingNodeHandler missing_node_handler = DefaultMissingNodeHandler());
|
||||
|
||||
SHAMap (SHAMapType t, uint256 const& hash,
|
||||
SHAMap (SHAMapType t, uint256 const& hash, FullBelowCache& fullBelowCache,
|
||||
MissingNodeHandler missing_node_handler = DefaultMissingNodeHandler());
|
||||
|
||||
~SHAMap ();
|
||||
@@ -245,19 +254,16 @@ public:
|
||||
static SHAMapTreeNode::pointer getCache (uint256 const& hash, SHAMapNode const& id);
|
||||
static void canonicalize (uint256 const& hash, SHAMapTreeNode::pointer&);
|
||||
|
||||
static int getFullBelowSize ()
|
||||
{
|
||||
return fullBelowCache.size ();
|
||||
}
|
||||
static int getTreeNodeSize ()
|
||||
{
|
||||
return treeNodeCache.getCacheSize ();
|
||||
}
|
||||
|
||||
static void sweep ()
|
||||
{
|
||||
fullBelowCache.sweep ();
|
||||
treeNodeCache.sweep ();
|
||||
}
|
||||
|
||||
static void setTreeCache (int size, int age)
|
||||
{
|
||||
treeNodeCache.setTargetSize (size);
|
||||
@@ -267,9 +273,7 @@ public:
|
||||
typedef std::pair<uint256, SHAMapNode> TNIndex;
|
||||
|
||||
private:
|
||||
static KeyCache <uint256> fullBelowCache;
|
||||
|
||||
static TaggedCacheType <TNIndex, SHAMapTreeNode> treeNodeCache;
|
||||
static TaggedCache <TNIndex, SHAMapTreeNode> treeNodeCache;
|
||||
|
||||
void dirtyUp (std::stack<SHAMapTreeNode::pointer>& stack, uint256 const & target, uint256 prevHash);
|
||||
std::stack<SHAMapTreeNode::pointer> getStack (uint256 const & id, bool include_nonmatching_leaf);
|
||||
@@ -307,6 +311,7 @@ private:
|
||||
// With a read lock, one may not invalidate pointers to existing members of mTNByID
|
||||
mutable LockType mLock;
|
||||
|
||||
FullBelowCache& m_fullBelowCache;
|
||||
uint32 mSeq;
|
||||
uint32 mLedgerSeq; // sequence number of ledger this is part of
|
||||
SyncUnorderedMapType< SHAMapNode, SHAMapTreeNode::pointer > mTNByID;
|
||||
|
||||
@@ -21,12 +21,6 @@
|
||||
|
||||
static const uint256 uZero;
|
||||
|
||||
// VFALCO TODO Put these globals into a singleton and make the clock a parameter
|
||||
KeyCache <uint256> SHAMap::fullBelowCache (
|
||||
"fullBelowCache",
|
||||
get_abstract_clock <std::chrono::steady_clock, std::chrono::seconds> (),
|
||||
524288, 240);
|
||||
|
||||
void SHAMap::visitLeaves (std::function<void (SHAMapItem::ref item)> function)
|
||||
{
|
||||
// Make a snapshot of this map so we don't need to hold
|
||||
@@ -153,7 +147,7 @@ void SHAMap::getMissingNodes (std::vector<SHAMapNode>& nodeIDs, std::vector<uint
|
||||
{
|
||||
uint256 const& childHash = node->getChildHash (branch);
|
||||
|
||||
if (! fullBelowCache.touch_if_exists (childHash))
|
||||
if (! m_fullBelowCache.touch_if_exists (childHash))
|
||||
{
|
||||
SHAMapNode childID = node->getChildNodeID (branch);
|
||||
SHAMapTreeNode* d = getNodePointerNT (childID, childHash, filter);
|
||||
@@ -188,7 +182,7 @@ void SHAMap::getMissingNodes (std::vector<SHAMapNode>& nodeIDs, std::vector<uint
|
||||
{ // No partial node encountered below this node
|
||||
node->setFullBelow ();
|
||||
if (mType == smtSTATE)
|
||||
fullBelowCache.insert (node->getNodeHash ());
|
||||
m_fullBelowCache.insert (node->getNodeHash ());
|
||||
}
|
||||
|
||||
if (stack.empty ())
|
||||
@@ -398,7 +392,7 @@ SHAMapAddNode SHAMap::addKnownNode (const SHAMapNode& node, Blob const& rawNode,
|
||||
return SHAMapAddNode::invalid ();
|
||||
}
|
||||
|
||||
if (fullBelowCache.touch_if_exists (iNode->getChildHash (branch)))
|
||||
if (m_fullBelowCache.touch_if_exists (iNode->getChildHash (branch)))
|
||||
return SHAMapAddNode::duplicate ();
|
||||
|
||||
SHAMapTreeNode *nextNode = getNodePointerNT (iNode->getChildNodeID (branch), iNode->getChildHash (branch), filter);
|
||||
@@ -752,14 +746,16 @@ public:
|
||||
RAND_pseudo_bytes (reinterpret_cast<unsigned char*> (&seed), sizeof (seed));
|
||||
srand (seed);
|
||||
|
||||
SHAMap source (smtFREE), destination (smtFREE);
|
||||
FullBelowCache fullBelowCache ("test.full_below",
|
||||
get_seconds_clock ());
|
||||
|
||||
SHAMap source (smtFREE, fullBelowCache);
|
||||
SHAMap destination (smtFREE, fullBelowCache);
|
||||
|
||||
int items = 10000;
|
||||
for (int i = 0; i < items; ++i)
|
||||
source.addItem (*makeRandomAS (), false, false);
|
||||
|
||||
|
||||
|
||||
beginTestCase ("add/remove");
|
||||
|
||||
unexpected (!confuseMap (source, 500), "ConfuseMap");
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
class ConsensusTransSetSF : public SHAMapSyncFilter
|
||||
{
|
||||
public:
|
||||
typedef TaggedCacheType <uint256, Blob> NodeCache;
|
||||
typedef TaggedCache <uint256, Blob> NodeCache;
|
||||
|
||||
// VFALCO TODO Use a dependency injection to get the temp node cache
|
||||
ConsensusTransSetSF (NodeCache& nodeCache);
|
||||
|
||||
@@ -35,7 +35,8 @@ TransactionAcquire::TransactionAcquire (uint256 const& hash, clock_type& clock)
|
||||
LogPartition::getJournal <TransactionAcquire> ())
|
||||
, mHaveRoot (false)
|
||||
{
|
||||
mMap = boost::make_shared<SHAMap> (smtTRANSACTION, hash);
|
||||
mMap = boost::make_shared<SHAMap> (smtTRANSACTION, hash,
|
||||
std::ref (getApp().getFullBelowCache ()));
|
||||
}
|
||||
|
||||
TransactionAcquire::~TransactionAcquire ()
|
||||
|
||||
@@ -18,11 +18,9 @@
|
||||
//==============================================================================
|
||||
|
||||
TransactionMaster::TransactionMaster ()
|
||||
: mCache ("TransactionCache", 65536, 1800,
|
||||
get_abstract_clock <std::chrono::steady_clock, std::chrono::seconds> (),
|
||||
LogPartition::getJournal <TaggedCacheLog> ())
|
||||
: mCache ("TransactionCache", 65536, 1800, get_seconds_clock (),
|
||||
LogPartition::getJournal <TaggedCacheLog> ())
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
bool TransactionMaster::inLedger (uint256 const& hash, uint32 ledger)
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
void sweep (void);
|
||||
|
||||
private:
|
||||
TaggedCacheType <uint256, Transaction> mCache;
|
||||
TaggedCache <uint256, Transaction> mCache;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -45,9 +45,7 @@
|
||||
|
||||
namespace ripple {
|
||||
|
||||
#include "containers/KeyCache.cpp"
|
||||
#include "containers/RangeSet.cpp"
|
||||
#include "containers/TaggedCache.cpp"
|
||||
|
||||
#include "log/Log.cpp"
|
||||
#include "log/LogFile.cpp"
|
||||
|
||||
@@ -85,7 +85,4 @@ using namespace beast;
|
||||
|
||||
}
|
||||
|
||||
#include "containers/KeyCache.h"
|
||||
#include "containers/TaggedCache.h"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -121,6 +121,8 @@ public:
|
||||
|
||||
~JobQueueImp ()
|
||||
{
|
||||
// Must unhook before destroying
|
||||
m_metrics.hook = insight::Hook ();
|
||||
}
|
||||
|
||||
void collect ()
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
|
||||
#include "beast/beast/make_unique.h"
|
||||
|
||||
#include "../../ripple/common/seconds_clock.h"
|
||||
#include "../../ripple/common/TaggedCache.h"
|
||||
|
||||
#include "impl/Tuning.h"
|
||||
# include "impl/DecodedBlob.h"
|
||||
# include "impl/EncodedBlob.h"
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
std::unique_ptr <Backend> m_backend;
|
||||
// Larger key/value storage, but not necessarily persistent.
|
||||
std::unique_ptr <Backend> m_fastBackend;
|
||||
TaggedCacheType <uint256, NodeObject> m_cache;
|
||||
TaggedCache <uint256, NodeObject> m_cache;
|
||||
|
||||
DatabaseImp (std::string const& name,
|
||||
Scheduler& scheduler,
|
||||
@@ -46,8 +46,7 @@ public:
|
||||
, m_backend (std::move (backend))
|
||||
, m_fastBackend (std::move (fastBackend))
|
||||
, m_cache ("NodeStore", cacheTargetSize, cacheTargetSeconds,
|
||||
get_abstract_clock <std::chrono::steady_clock, std::chrono::seconds> (),
|
||||
LogPartition::getJournal <TaggedCacheLog> ())
|
||||
get_seconds_clock (), LogPartition::getJournal <TaggedCacheLog> ())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user