mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Add ReadView::sles
This commit is contained in:
@@ -2353,6 +2353,10 @@
|
|||||||
<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\ledger\impl\ReadView.cpp">
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\ripple\ledger\impl\TxMeta.cpp">
|
<ClCompile Include="..\..\src\ripple\ledger\impl\TxMeta.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>
|
||||||
|
|||||||
@@ -3078,6 +3078,9 @@
|
|||||||
<ClCompile Include="..\..\src\ripple\ledger\impl\RawStateTable.cpp">
|
<ClCompile Include="..\..\src\ripple\ledger\impl\RawStateTable.cpp">
|
||||||
<Filter>ripple\ledger\impl</Filter>
|
<Filter>ripple\ledger\impl</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\ripple\ledger\impl\ReadView.cpp">
|
||||||
|
<Filter>ripple\ledger\impl</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\ripple\ledger\impl\TxMeta.cpp">
|
<ClCompile Include="..\..\src\ripple\ledger\impl\TxMeta.cpp">
|
||||||
<Filter>ripple\ledger\impl</Filter>
|
<Filter>ripple\ledger\impl</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|||||||
@@ -61,6 +61,59 @@ create_genesis_t const create_genesis {};
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class Ledger::sles_iter_impl
|
||||||
|
: public sles_type::iter_base
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
ReadView const* view_;
|
||||||
|
SHAMap::const_iterator iter_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
sles_iter_impl() = delete;
|
||||||
|
sles_iter_impl& operator= (sles_iter_impl const&) = delete;
|
||||||
|
|
||||||
|
sles_iter_impl (sles_iter_impl const&) = default;
|
||||||
|
|
||||||
|
sles_iter_impl (SHAMap::const_iterator iter,
|
||||||
|
ReadView const& view)
|
||||||
|
: view_ (&view)
|
||||||
|
, iter_ (iter)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<base_type>
|
||||||
|
copy() const override
|
||||||
|
{
|
||||||
|
return std::make_unique<
|
||||||
|
sles_iter_impl>(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
equal (base_type const& impl) const override
|
||||||
|
{
|
||||||
|
auto const& other = dynamic_cast<
|
||||||
|
sles_iter_impl const&>(impl);
|
||||||
|
return iter_ == other.iter_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
increment() override
|
||||||
|
{
|
||||||
|
++iter_;
|
||||||
|
}
|
||||||
|
|
||||||
|
sles_type::value_type
|
||||||
|
dereference() const override
|
||||||
|
{
|
||||||
|
auto const item = *iter_;
|
||||||
|
SerialIter sit(item.slice());
|
||||||
|
return std::make_shared<SLE const>(
|
||||||
|
sit, item.key());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
class Ledger::txs_iter_impl
|
class Ledger::txs_iter_impl
|
||||||
: public txs_type::iter_base
|
: public txs_type::iter_base
|
||||||
{
|
{
|
||||||
@@ -870,6 +923,24 @@ Ledger::read (Keylet const& k) const
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
auto
|
||||||
|
Ledger::slesBegin() const ->
|
||||||
|
std::unique_ptr<sles_type::iter_base>
|
||||||
|
{
|
||||||
|
return std::make_unique<
|
||||||
|
sles_iter_impl>(
|
||||||
|
stateMap_->begin(), *this);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto
|
||||||
|
Ledger::slesEnd() const ->
|
||||||
|
std::unique_ptr<sles_type::iter_base>
|
||||||
|
{
|
||||||
|
return std::make_unique<
|
||||||
|
sles_iter_impl>(
|
||||||
|
stateMap_->end(), *this);
|
||||||
|
}
|
||||||
|
|
||||||
auto
|
auto
|
||||||
Ledger::txsBegin() const ->
|
Ledger::txsBegin() const ->
|
||||||
std::unique_ptr<txs_type::iter_base>
|
std::unique_ptr<txs_type::iter_base>
|
||||||
|
|||||||
@@ -152,6 +152,12 @@ public:
|
|||||||
std::shared_ptr<SLE const>
|
std::shared_ptr<SLE const>
|
||||||
read (Keylet const& k) const override;
|
read (Keylet const& k) const override;
|
||||||
|
|
||||||
|
std::unique_ptr<sles_type::iter_base>
|
||||||
|
slesBegin() const override;
|
||||||
|
|
||||||
|
std::unique_ptr<sles_type::iter_base>
|
||||||
|
slesEnd() const override;
|
||||||
|
|
||||||
std::unique_ptr<txs_type::iter_base>
|
std::unique_ptr<txs_type::iter_base>
|
||||||
txsBegin() const override;
|
txsBegin() const override;
|
||||||
|
|
||||||
@@ -363,6 +369,7 @@ public:
|
|||||||
getHashesByIndex (std::uint32_t minSeq, std::uint32_t maxSeq);
|
getHashesByIndex (std::uint32_t minSeq, std::uint32_t maxSeq);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
class sles_iter_impl;
|
||||||
class txs_iter_impl;
|
class txs_iter_impl;
|
||||||
|
|
||||||
void saveValidatedLedgerAsync(Job&, bool current)
|
void saveValidatedLedgerAsync(Job&, bool current)
|
||||||
|
|||||||
@@ -131,20 +131,20 @@ void fillJsonState(Object& json, LedgerFill const& fill)
|
|||||||
auto expanded = isExpanded(fill);
|
auto expanded = isExpanded(fill);
|
||||||
auto binary = isBinary(fill);
|
auto binary = isBinary(fill);
|
||||||
|
|
||||||
forEachSLE(ledger, [&] (SLE const& sle) {
|
for(auto const& sle : ledger.sles)
|
||||||
|
{
|
||||||
count.yield();
|
count.yield();
|
||||||
if (binary)
|
if (binary)
|
||||||
{
|
{
|
||||||
auto&& obj = appendObject(array);
|
auto&& obj = appendObject(array);
|
||||||
obj[jss::hash] = to_string(sle.key());
|
obj[jss::hash] = to_string(sle->key());
|
||||||
obj[jss::tx_blob] = serializeHex(sle);
|
obj[jss::tx_blob] = serializeHex(*sle);
|
||||||
}
|
}
|
||||||
else if (expanded)
|
else if (expanded)
|
||||||
array.append(sle.getJson(0));
|
array.append(sle->getJson(0));
|
||||||
else
|
else
|
||||||
array.append(to_string(sle.key()));
|
array.append(to_string(sle->key()));
|
||||||
return true;
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Object>
|
template <class Object>
|
||||||
|
|||||||
@@ -84,6 +84,18 @@ public:
|
|||||||
return base_.succ(key, last);
|
return base_.succ(key, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<sles_type::iter_base>
|
||||||
|
slesBegin() const override
|
||||||
|
{
|
||||||
|
return base_.slesBegin();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<sles_type::iter_base>
|
||||||
|
slesEnd() const override
|
||||||
|
{
|
||||||
|
return base_.slesEnd();
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<txs_type::iter_base>
|
std::unique_ptr<txs_type::iter_base>
|
||||||
txsBegin() const override
|
txsBegin() const override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -164,6 +164,12 @@ public:
|
|||||||
std::shared_ptr<SLE const>
|
std::shared_ptr<SLE const>
|
||||||
read (Keylet const& k) const override;
|
read (Keylet const& k) const override;
|
||||||
|
|
||||||
|
std::unique_ptr<sles_type::iter_base>
|
||||||
|
slesBegin() const override;
|
||||||
|
|
||||||
|
std::unique_ptr<sles_type::iter_base>
|
||||||
|
slesEnd() const override;
|
||||||
|
|
||||||
std::unique_ptr<txs_type::iter_base>
|
std::unique_ptr<txs_type::iter_base>
|
||||||
txsBegin() const override;
|
txsBegin() const override;
|
||||||
|
|
||||||
|
|||||||
@@ -136,11 +136,22 @@ public:
|
|||||||
using mapped_type =
|
using mapped_type =
|
||||||
std::shared_ptr<SLE const>;
|
std::shared_ptr<SLE const>;
|
||||||
|
|
||||||
using sles_type = detail::ReadViewFwdRange<
|
struct sles_type : detail::ReadViewFwdRange<
|
||||||
std::shared_ptr<SLE const>>;
|
std::shared_ptr<SLE const>>
|
||||||
|
{
|
||||||
|
explicit sles_type (ReadView const& view);
|
||||||
|
iterator begin() const;
|
||||||
|
iterator const& end() const;
|
||||||
|
};
|
||||||
|
|
||||||
using txs_type =
|
struct txs_type
|
||||||
detail::ReadViewFwdRange<tx_type>;
|
: detail::ReadViewFwdRange<tx_type>
|
||||||
|
{
|
||||||
|
explicit txs_type (ReadView const& view);
|
||||||
|
bool empty() const;
|
||||||
|
iterator begin() const;
|
||||||
|
iterator const& end() const;
|
||||||
|
};
|
||||||
|
|
||||||
virtual ~ReadView() = default;
|
virtual ~ReadView() = default;
|
||||||
|
|
||||||
@@ -148,17 +159,20 @@ public:
|
|||||||
ReadView& operator= (ReadView const& other) = delete;
|
ReadView& operator= (ReadView const& other) = delete;
|
||||||
|
|
||||||
ReadView()
|
ReadView()
|
||||||
: txs(*this)
|
: sles(*this)
|
||||||
|
, txs(*this)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ReadView (ReadView const&)
|
ReadView (ReadView const&)
|
||||||
: txs(*this)
|
: sles(*this)
|
||||||
|
, txs(*this)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ReadView (ReadView&& other)
|
ReadView (ReadView&& other)
|
||||||
: txs(*this)
|
: sles(*this)
|
||||||
|
, txs(*this)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,6 +268,16 @@ public:
|
|||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// used by the implementation
|
||||||
|
virtual
|
||||||
|
std::unique_ptr<sles_type::iter_base>
|
||||||
|
slesBegin() const = 0;
|
||||||
|
|
||||||
|
// used by the implementation
|
||||||
|
virtual
|
||||||
|
std::unique_ptr<sles_type::iter_base>
|
||||||
|
slesEnd() const = 0;
|
||||||
|
|
||||||
// used by the implementation
|
// used by the implementation
|
||||||
virtual
|
virtual
|
||||||
std::unique_ptr<txs_type::iter_base>
|
std::unique_ptr<txs_type::iter_base>
|
||||||
@@ -289,8 +313,14 @@ public:
|
|||||||
// Memberspaces
|
// Memberspaces
|
||||||
//
|
//
|
||||||
|
|
||||||
// The range of ledger entries
|
/** Iterable range of ledger state items.
|
||||||
//sles_type sles;
|
|
||||||
|
Visiting each state entry in the ledger can be
|
||||||
|
quite expensive. This will only visit entries in
|
||||||
|
the base ledger. Entries in open views, apply
|
||||||
|
views, or sandboxes will not be visited.
|
||||||
|
*/
|
||||||
|
sles_type sles;
|
||||||
|
|
||||||
// The range of transactions
|
// The range of transactions
|
||||||
txs_type txs;
|
txs_type txs;
|
||||||
|
|||||||
@@ -169,18 +169,6 @@ getCandidateLedger (LedgerIndex requested)
|
|||||||
return (requested + 255) & (~255);
|
return (requested + 255) & (~255);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Run a functor on each SLE in a ReadView starting from the key start,
|
|
||||||
as long as the functor returns true.
|
|
||||||
*/
|
|
||||||
template <class Functor>
|
|
||||||
void forEachSLE(ReadView const& view, Functor func, uint256 const& start = {})
|
|
||||||
{
|
|
||||||
for (auto k = view.succ(start); k; k = view.succ(*k))
|
|
||||||
if (auto sle = view.read(keylet::unchecked(*k)))
|
|
||||||
if (! func(*sle))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Modifiers
|
// Modifiers
|
||||||
|
|||||||
@@ -73,6 +73,12 @@ public:
|
|||||||
std::shared_ptr<SLE const>
|
std::shared_ptr<SLE const>
|
||||||
read (Keylet const& k) const override;
|
read (Keylet const& k) const override;
|
||||||
|
|
||||||
|
std::unique_ptr<sles_type::iter_base>
|
||||||
|
slesBegin() const override;
|
||||||
|
|
||||||
|
std::unique_ptr<sles_type::iter_base>
|
||||||
|
slesEnd() const override;
|
||||||
|
|
||||||
std::unique_ptr<txs_type::iter_base>
|
std::unique_ptr<txs_type::iter_base>
|
||||||
txsBegin() const override;
|
txsBegin() const override;
|
||||||
|
|
||||||
|
|||||||
@@ -139,18 +139,6 @@ public:
|
|||||||
ReadViewFwdRange (ReadViewFwdRange const&) = default;
|
ReadViewFwdRange (ReadViewFwdRange const&) = default;
|
||||||
ReadViewFwdRange& operator= (ReadViewFwdRange const&) = default;
|
ReadViewFwdRange& operator= (ReadViewFwdRange const&) = default;
|
||||||
|
|
||||||
/** Returns `true` if the range is empty. */
|
|
||||||
bool
|
|
||||||
empty() const;
|
|
||||||
|
|
||||||
/** Return iterator to the beginning of the range. */
|
|
||||||
iterator
|
|
||||||
begin() const;
|
|
||||||
|
|
||||||
/** Return iterator to one past the end of the range. */
|
|
||||||
iterator const&
|
|
||||||
end() const;
|
|
||||||
|
|
||||||
// VFALCO Otherwise causes errors on clang
|
// VFALCO Otherwise causes errors on clang
|
||||||
//private:
|
//private:
|
||||||
// friend class ReadView;
|
// friend class ReadView;
|
||||||
@@ -161,7 +149,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
ReadView const* view_;
|
ReadView const* view_;
|
||||||
boost::optional<iterator> mutable end_;
|
boost::optional<iterator> mutable end_;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ template<class ValueType>
|
|||||||
ReadViewFwdRange<ValueType>::iterator::iterator(
|
ReadViewFwdRange<ValueType>::iterator::iterator(
|
||||||
iterator const& other)
|
iterator const& other)
|
||||||
: view_ (other.view_)
|
: view_ (other.view_)
|
||||||
, impl_ (other.impl_->copy())
|
, impl_ (other.impl_ ?
|
||||||
|
other.impl_->copy() : nullptr)
|
||||||
, cache_ (other.cache_)
|
, cache_ (other.cache_)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -59,7 +60,8 @@ ReadViewFwdRange<ValueType>::iterator::operator=(
|
|||||||
if (this == &other)
|
if (this == &other)
|
||||||
return *this;
|
return *this;
|
||||||
view_ = other.view_;
|
view_ = other.view_;
|
||||||
impl_ = other.impl_->copy();
|
impl_ = other.impl_ ?
|
||||||
|
other.impl_->copy() : nullptr;
|
||||||
cache_ = other.cache_;
|
cache_ = other.cache_;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@@ -133,33 +135,6 @@ ReadViewFwdRange<ValueType>::iterator::operator++(int) ->
|
|||||||
return prev;
|
return prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
template<class ValueType>
|
|
||||||
bool
|
|
||||||
ReadViewFwdRange<ValueType>::empty() const
|
|
||||||
{
|
|
||||||
return begin() == end();
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class ValueType>
|
|
||||||
auto
|
|
||||||
ReadViewFwdRange<ValueType>::begin() const ->
|
|
||||||
iterator
|
|
||||||
{
|
|
||||||
return iterator(view_, view_->txsBegin());
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class ValueType>
|
|
||||||
auto
|
|
||||||
ReadViewFwdRange<ValueType>::end() const ->
|
|
||||||
iterator const&
|
|
||||||
{
|
|
||||||
if (! end_)
|
|
||||||
end_.emplace(view_, view_->txsEnd());
|
|
||||||
return *end_;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // detail
|
} // detail
|
||||||
} // ripple
|
} // ripple
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,20 @@ ApplyViewBase::read (Keylet const& k) const
|
|||||||
return items_.read(*base_, k);
|
return items_.read(*base_, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto
|
||||||
|
ApplyViewBase::slesBegin() const ->
|
||||||
|
std::unique_ptr<sles_type::iter_base>
|
||||||
|
{
|
||||||
|
return base_->slesBegin();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto
|
||||||
|
ApplyViewBase::slesEnd() const ->
|
||||||
|
std::unique_ptr<sles_type::iter_base>
|
||||||
|
{
|
||||||
|
return base_->slesEnd();
|
||||||
|
}
|
||||||
|
|
||||||
auto
|
auto
|
||||||
ApplyViewBase::txsBegin() const ->
|
ApplyViewBase::txsBegin() const ->
|
||||||
std::unique_ptr<txs_type::iter_base>
|
std::unique_ptr<txs_type::iter_base>
|
||||||
|
|||||||
@@ -158,6 +158,20 @@ OpenView::read (Keylet const& k) const
|
|||||||
return items_.read(*base_, k);
|
return items_.read(*base_, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto
|
||||||
|
OpenView::slesBegin() const ->
|
||||||
|
std::unique_ptr<sles_type::iter_base>
|
||||||
|
{
|
||||||
|
return base_->slesBegin();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto
|
||||||
|
OpenView::slesEnd() const ->
|
||||||
|
std::unique_ptr<sles_type::iter_base>
|
||||||
|
{
|
||||||
|
return base_->slesEnd();
|
||||||
|
}
|
||||||
|
|
||||||
auto
|
auto
|
||||||
OpenView::txsBegin() const ->
|
OpenView::txsBegin() const ->
|
||||||
std::unique_ptr<txs_type::iter_base>
|
std::unique_ptr<txs_type::iter_base>
|
||||||
|
|||||||
75
src/ripple/ledger/impl/ReadView.cpp
Normal file
75
src/ripple/ledger/impl/ReadView.cpp
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
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 <ripple/ledger/ReadView.h>
|
||||||
|
|
||||||
|
namespace ripple {
|
||||||
|
|
||||||
|
ReadView::sles_type::sles_type(
|
||||||
|
ReadView const& view)
|
||||||
|
: ReadViewFwdRange(view)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
auto
|
||||||
|
ReadView::sles_type::begin() const ->
|
||||||
|
iterator
|
||||||
|
{
|
||||||
|
return iterator(view_, view_->slesBegin());
|
||||||
|
}
|
||||||
|
|
||||||
|
auto
|
||||||
|
ReadView::sles_type::end() const ->
|
||||||
|
iterator const&
|
||||||
|
{
|
||||||
|
if (! end_)
|
||||||
|
end_ = iterator(view_, view_->slesEnd());
|
||||||
|
return *end_;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReadView::txs_type::txs_type(
|
||||||
|
ReadView const& view)
|
||||||
|
: ReadViewFwdRange(view)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
ReadView::txs_type::empty() const
|
||||||
|
{
|
||||||
|
return begin() == end();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto
|
||||||
|
ReadView::txs_type::begin() const ->
|
||||||
|
iterator
|
||||||
|
{
|
||||||
|
return iterator(view_, view_->txsBegin());
|
||||||
|
}
|
||||||
|
|
||||||
|
auto
|
||||||
|
ReadView::txs_type::end() const ->
|
||||||
|
iterator const&
|
||||||
|
{
|
||||||
|
if (! end_)
|
||||||
|
end_ = iterator(view_, view_->txsEnd());
|
||||||
|
return *end_;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // ripple
|
||||||
@@ -80,28 +80,27 @@ Json::Value doLedgerData (RPC::Context& context)
|
|||||||
|
|
||||||
Json::Value& nodes = (jvResult[jss::state] = Json::arrayValue);
|
Json::Value& nodes = (jvResult[jss::state] = Json::arrayValue);
|
||||||
|
|
||||||
forEachSLE(*lpLedger, [&] (SLE const& sle) {
|
for(auto const& sle : lpLedger->sles)
|
||||||
|
{
|
||||||
if (limit-- <= 0)
|
if (limit-- <= 0)
|
||||||
{
|
{
|
||||||
auto marker = sle.key();
|
auto marker = sle->key();
|
||||||
jvResult[jss::marker] = to_string (--marker);
|
jvResult[jss::marker] = to_string (--marker);
|
||||||
return false;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isBinary)
|
if (isBinary)
|
||||||
{
|
{
|
||||||
Json::Value& entry = nodes.append (Json::objectValue);
|
Json::Value& entry = nodes.append (Json::objectValue);
|
||||||
entry[jss::data] = serializeHex(sle);
|
entry[jss::data] = serializeHex(*sle);
|
||||||
entry[jss::index] = to_string (sle.key());
|
entry[jss::index] = to_string (sle->key());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Json::Value& entry = nodes.append (sle.getJson (0));
|
Json::Value& entry = nodes.append (sle->getJson (0));
|
||||||
entry[jss::index] = to_string (sle.key());
|
entry[jss::index] = to_string (sle->key());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
return jvResult;
|
return jvResult;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include <ripple/ledger/impl/OpenView.cpp>
|
#include <ripple/ledger/impl/OpenView.cpp>
|
||||||
#include <ripple/ledger/impl/PaymentSandbox.cpp>
|
#include <ripple/ledger/impl/PaymentSandbox.cpp>
|
||||||
#include <ripple/ledger/impl/RawStateTable.cpp>
|
#include <ripple/ledger/impl/RawStateTable.cpp>
|
||||||
|
#include <ripple/ledger/impl/ReadView.cpp>
|
||||||
#include <ripple/ledger/impl/TxMeta.cpp>
|
#include <ripple/ledger/impl/TxMeta.cpp>
|
||||||
#include <ripple/ledger/impl/View.cpp>
|
#include <ripple/ledger/impl/View.cpp>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user