mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
refactor: Remove dead headers (#5081)
This commit is contained in:
@@ -26,7 +26,6 @@
|
||||
#include <xrpld/peerfinder/detail/Fixed.h>
|
||||
#include <xrpld/peerfinder/detail/Handouts.h>
|
||||
#include <xrpld/peerfinder/detail/Livecache.h>
|
||||
#include <xrpld/peerfinder/detail/Reporting.h>
|
||||
#include <xrpld/peerfinder/detail/SlotImp.h>
|
||||
#include <xrpld/peerfinder/detail/Source.h>
|
||||
#include <xrpld/peerfinder/detail/Store.h>
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
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_PEERFINDER_REPORTING_H_INCLUDED
|
||||
#define RIPPLE_PEERFINDER_REPORTING_H_INCLUDED
|
||||
|
||||
namespace ripple {
|
||||
namespace PeerFinder {
|
||||
|
||||
/** Severity levels for test reporting.
|
||||
This allows more fine grained control over reporting for diagnostics.
|
||||
*/
|
||||
struct Reporting
|
||||
{
|
||||
explicit Reporting() = default;
|
||||
|
||||
// Report simulation parameters
|
||||
static bool const params = true;
|
||||
|
||||
// Report simulation crawl time-evolution
|
||||
static bool const crawl = true;
|
||||
|
||||
// Report nodes aggregate statistics
|
||||
static bool const nodes = true;
|
||||
|
||||
// Report nodes detailed information
|
||||
static bool const dump_nodes = false;
|
||||
};
|
||||
|
||||
} // namespace PeerFinder
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
@@ -1,100 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
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_PEERFINDER_SIM_FUNCTIONQUEUE_H_INCLUDED
|
||||
#define RIPPLE_PEERFINDER_SIM_FUNCTIONQUEUE_H_INCLUDED
|
||||
|
||||
namespace ripple {
|
||||
namespace PeerFinder {
|
||||
namespace Sim {
|
||||
|
||||
/** Maintains a queue of functors that can be called later. */
|
||||
class FunctionQueue
|
||||
{
|
||||
public:
|
||||
explicit FunctionQueue() = default;
|
||||
|
||||
private:
|
||||
class BasicWork
|
||||
{
|
||||
public:
|
||||
virtual ~BasicWork()
|
||||
{
|
||||
}
|
||||
virtual void
|
||||
operator()() = 0;
|
||||
};
|
||||
|
||||
template <typename Function>
|
||||
class Work : public BasicWork
|
||||
{
|
||||
public:
|
||||
explicit Work(Function f) : m_f(f)
|
||||
{
|
||||
}
|
||||
void
|
||||
operator()()
|
||||
{
|
||||
(m_f)();
|
||||
}
|
||||
|
||||
private:
|
||||
Function m_f;
|
||||
};
|
||||
|
||||
std::list<std::unique_ptr<BasicWork>> m_work;
|
||||
|
||||
public:
|
||||
/** Returns `true` if there is no remaining work */
|
||||
bool
|
||||
empty()
|
||||
{
|
||||
return m_work.empty();
|
||||
}
|
||||
|
||||
/** Queue a function.
|
||||
Function must be callable with this signature:
|
||||
void (void)
|
||||
*/
|
||||
template <typename Function>
|
||||
void
|
||||
post(Function f)
|
||||
{
|
||||
m_work.emplace_back(std::make_unique<Work<Function>>(f));
|
||||
}
|
||||
|
||||
/** Run all pending functions.
|
||||
The functions will be invoked in the order they were queued.
|
||||
*/
|
||||
void
|
||||
run()
|
||||
{
|
||||
while (!m_work.empty())
|
||||
{
|
||||
(*m_work.front())();
|
||||
m_work.pop_front();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Sim
|
||||
} // namespace PeerFinder
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
@@ -1,76 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
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_PEERFINDER_SIM_GRAPHALGORITHMS_H_INCLUDED
|
||||
#define RIPPLE_PEERFINDER_SIM_GRAPHALGORITHMS_H_INCLUDED
|
||||
|
||||
namespace ripple {
|
||||
namespace PeerFinder {
|
||||
namespace Sim {
|
||||
|
||||
template <typename Vertex>
|
||||
struct VertexTraits;
|
||||
|
||||
/** Call a function for each vertex in a connected graph.
|
||||
Function will be called with this signature:
|
||||
void (Vertex&, std::size_t diameter);
|
||||
*/
|
||||
|
||||
template <typename Vertex, typename Function>
|
||||
void
|
||||
breadth_first_traverse(Vertex& start, Function f)
|
||||
{
|
||||
using Traits = VertexTraits<Vertex>;
|
||||
using Edges = typename Traits::Edges;
|
||||
using Edge = typename Traits::Edge;
|
||||
|
||||
using Probe = std::pair<Vertex*, int>;
|
||||
using Work = std::deque<Probe>;
|
||||
using Visited = std::set<Vertex*>;
|
||||
Work work;
|
||||
Visited visited;
|
||||
work.emplace_back(&start, 0);
|
||||
int diameter(0);
|
||||
while (!work.empty())
|
||||
{
|
||||
Probe const p(work.front());
|
||||
work.pop_front();
|
||||
if (visited.find(p.first) != visited.end())
|
||||
continue;
|
||||
diameter = std::max(p.second, diameter);
|
||||
visited.insert(p.first);
|
||||
for (typename Edges::iterator iter(Traits::edges(*p.first).begin());
|
||||
iter != Traits::edges(*p.first).end();
|
||||
++iter)
|
||||
{
|
||||
Vertex* v(Traits::vertex(*iter));
|
||||
if (visited.find(v) != visited.end())
|
||||
continue;
|
||||
if (!iter->closed())
|
||||
work.emplace_back(v, p.second + 1);
|
||||
}
|
||||
f(*p.first, diameter);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Sim
|
||||
} // namespace PeerFinder
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
@@ -1,47 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
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_PEERFINDER_SIM_MESSAGE_H_INCLUDED
|
||||
#define RIPPLE_PEERFINDER_SIM_MESSAGE_H_INCLUDED
|
||||
|
||||
namespace ripple {
|
||||
namespace PeerFinder {
|
||||
namespace Sim {
|
||||
|
||||
class Message
|
||||
{
|
||||
public:
|
||||
explicit Message(Endpoints const& endpoints) : m_payload(endpoints)
|
||||
{
|
||||
}
|
||||
Endpoints const&
|
||||
payload() const
|
||||
{
|
||||
return m_payload;
|
||||
}
|
||||
|
||||
private:
|
||||
Endpoints m_payload;
|
||||
};
|
||||
|
||||
} // namespace Sim
|
||||
} // namespace PeerFinder
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
@@ -1,37 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
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_PEERFINDER_SIM_NODESNAPSHOT_H_INCLUDED
|
||||
#define RIPPLE_PEERFINDER_SIM_NODESNAPSHOT_H_INCLUDED
|
||||
|
||||
namespace ripple {
|
||||
namespace PeerFinder {
|
||||
namespace Sim {
|
||||
|
||||
/** A snapshot of a Node in the network simulator. */
|
||||
struct NodeSnapshot
|
||||
{
|
||||
explicit NodeSnapshot() = default;
|
||||
};
|
||||
|
||||
} // namespace Sim
|
||||
} // namespace PeerFinder
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
@@ -1,45 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
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_PEERFINDER_SIM_PARAMS_H_INCLUDED
|
||||
#define RIPPLE_PEERFINDER_SIM_PARAMS_H_INCLUDED
|
||||
|
||||
namespace ripple {
|
||||
namespace PeerFinder {
|
||||
namespace Sim {
|
||||
|
||||
/** Defines the parameters for a network simulation. */
|
||||
struct Params
|
||||
{
|
||||
Params() : steps(50), nodes(10), maxPeers(20), outPeers(9.5), firewalled(0)
|
||||
{
|
||||
}
|
||||
|
||||
int steps;
|
||||
int nodes;
|
||||
int maxPeers;
|
||||
double outPeers;
|
||||
double firewalled; // [0, 1)
|
||||
};
|
||||
|
||||
} // namespace Sim
|
||||
} // namespace PeerFinder
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
@@ -1,87 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
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_PEERFINDER_SIM_PREDICATES_H_INCLUDED
|
||||
#define RIPPLE_PEERFINDER_SIM_PREDICATES_H_INCLUDED
|
||||
|
||||
namespace ripple {
|
||||
namespace PeerFinder {
|
||||
namespace Sim {
|
||||
|
||||
/** UnaryPredicate, returns `true` if the 'to' node on a Link matches. */
|
||||
/** @{ */
|
||||
template <typename Node>
|
||||
class is_remote_node_pred
|
||||
{
|
||||
public:
|
||||
is_remote_node_pred(Node const& n) : node(n)
|
||||
{
|
||||
}
|
||||
template <typename Link>
|
||||
bool
|
||||
operator()(Link const& l) const
|
||||
{
|
||||
return &node == &l.remote_node();
|
||||
}
|
||||
|
||||
private:
|
||||
Node const& node;
|
||||
};
|
||||
|
||||
template <typename Node>
|
||||
is_remote_node_pred<Node>
|
||||
is_remote_node(Node const& node)
|
||||
{
|
||||
return is_remote_node_pred<Node>(node);
|
||||
}
|
||||
|
||||
template <typename Node>
|
||||
is_remote_node_pred<Node>
|
||||
is_remote_node(Node const* node)
|
||||
{
|
||||
return is_remote_node_pred<Node>(*node);
|
||||
}
|
||||
/** @} */
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** UnaryPredicate, `true` if the remote address matches. */
|
||||
class is_remote_endpoint
|
||||
{
|
||||
public:
|
||||
explicit is_remote_endpoint(beast::IP::Endpoint const& address)
|
||||
: m_endpoint(address)
|
||||
{
|
||||
}
|
||||
template <typename Link>
|
||||
bool
|
||||
operator()(Link const& link) const
|
||||
{
|
||||
return link.remote_endpoint() == m_endpoint;
|
||||
}
|
||||
|
||||
private:
|
||||
beast::IP::Endpoint const m_endpoint;
|
||||
};
|
||||
|
||||
} // namespace Sim
|
||||
} // namespace PeerFinder
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user