Skip to content

Commit

Permalink
Move jobqueue module to libxrpl
Browse files Browse the repository at this point in the history
  • Loading branch information
thejohnfreeman committed May 3, 2024
1 parent 39b5eb5 commit 28f0c10
Show file tree
Hide file tree
Showing 74 changed files with 1,177 additions and 1,075 deletions.
3 changes: 0 additions & 3 deletions Builds/levelization/results/loops.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ Loop: xrpld.app xrpld.shamap
Loop: xrpld.core xrpld.net
xrpld.net > xrpld.core

Loop: xrpld.core xrpld.perflog
xrpld.perflog ~= xrpld.core

Loop: xrpld.net xrpld.rpc
xrpld.rpc ~= xrpld.net

Expand Down
16 changes: 13 additions & 3 deletions Builds/levelization/results/ordering.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
libxrpl.basics > xrpl.basics
libxrpl.crypto > xrpl.basics
libxrpl.jobqueue > xrpl.basics
libxrpl.jobqueue > xrpl.jobqueue
libxrpl.json > xrpl.basics
libxrpl.json > xrpl.json
libxrpl.protocol > xrpl.basics
Expand All @@ -21,6 +23,7 @@ test.app > xrpld.core
test.app > xrpld.ledger
test.app > xrpld.overlay
test.app > xrpld.rpc
test.app > xrpl.jobqueue
test.app > xrpl.json
test.app > xrpl.protocol
test.app > xrpl.resource
Expand All @@ -42,12 +45,9 @@ test.consensus > xrpld.app
test.consensus > xrpld.consensus
test.consensus > xrpld.ledger
test.core > test.jtx
test.core > test.toplevel
test.core > test.unit_test
test.core > xrpl.basics
test.core > xrpld.core
test.core > xrpld.perflog
test.core > xrpl.json
test.core > xrpl.server
test.csf > xrpl.basics
test.csf > xrpld.consensus
Expand Down Expand Up @@ -113,6 +113,7 @@ test.rpc > xrpld.core
test.rpc > xrpld.net
test.rpc > xrpld.overlay
test.rpc > xrpld.rpc
test.rpc > xrpl.jobqueue
test.rpc > xrpl.json
test.rpc > xrpl.protocol
test.rpc > xrpl.resource
Expand All @@ -133,6 +134,8 @@ test.shamap > xrpl.protocol
test.toplevel > test.csf
test.toplevel > xrpl.json
test.unit_test > xrpl.basics
xrpl.jobqueue > xrpl.basics
xrpl.jobqueue > xrpl.json
xrpl.json > xrpl.basics
xrpl.protocol > xrpl.basics
xrpl.protocol > xrpl.json
Expand All @@ -148,6 +151,7 @@ xrpld.app > xrpld.conditions
xrpld.app > xrpld.consensus
xrpld.app > xrpld.nodestore
xrpld.app > xrpld.perflog
xrpld.app > xrpl.jobqueue
xrpld.app > xrpl.json
xrpld.app > xrpl.protocol
xrpld.app > xrpl.resource
Expand All @@ -157,13 +161,15 @@ xrpld.consensus > xrpl.basics
xrpld.consensus > xrpl.json
xrpld.consensus > xrpl.protocol
xrpld.core > xrpl.basics
xrpld.core > xrpl.jobqueue
xrpld.core > xrpl.json
xrpld.core > xrpl.protocol
xrpld.ledger > xrpl.basics
xrpld.ledger > xrpld.core
xrpld.ledger > xrpl.json
xrpld.ledger > xrpl.protocol
xrpld.net > xrpl.basics
xrpld.net > xrpl.jobqueue
xrpld.net > xrpl.json
xrpld.net > xrpl.protocol
xrpld.net > xrpl.resource
Expand All @@ -175,6 +181,7 @@ xrpld.nodestore > xrpl.protocol
xrpld.overlay > xrpl.basics
xrpld.overlay > xrpld.core
xrpld.overlay > xrpld.peerfinder
xrpld.overlay > xrpl.jobqueue
xrpld.overlay > xrpl.json
xrpld.overlay > xrpl.protocol
xrpld.overlay > xrpl.resource
Expand All @@ -183,12 +190,15 @@ xrpld.peerfinder > xrpl.basics
xrpld.peerfinder > xrpld.core
xrpld.peerfinder > xrpl.protocol
xrpld.perflog > xrpl.basics
xrpld.perflog > xrpld.core
xrpld.perflog > xrpl.jobqueue
xrpld.perflog > xrpl.json
xrpld.perflog > xrpl.protocol
xrpld.rpc > xrpl.basics
xrpld.rpc > xrpld.core
xrpld.rpc > xrpld.ledger
xrpld.rpc > xrpld.nodestore
xrpld.rpc > xrpl.jobqueue
xrpld.rpc > xrpl.json
xrpld.rpc > xrpl.protocol
xrpld.rpc > xrpl.resource
Expand Down
7 changes: 7 additions & 0 deletions cmake/RippledCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ target_link_libraries(xrpl.libxrpl.protocol PUBLIC
xrpl.libxrpl.json
)

add_module(xrpl jobqueue)
target_link_libraries(xrpl.libxrpl.jobqueue PUBLIC
xrpl.libxrpl.beast
xrpl.libxrpl.basics
xrpl.libxrpl.json
)

# Level 05
add_module(xrpl resource)
target_link_libraries(xrpl.libxrpl.resource PUBLIC xrpl.libxrpl.protocol)
Expand Down
1 change: 1 addition & 0 deletions cmake/RippledInstall.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ install (
xrpl.libxrpl.basics
xrpl.libxrpl.beast
xrpl.libxrpl.crypto
xrpl.libxrpl.jobqueue
xrpl.libxrpl.json
xrpl.libxrpl.protocol
xrpl.libxrpl.resource
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion include/xrpl/basics/IOUAmount.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#ifndef RIPPLE_BASICS_IOUAMOUNT_H_INCLUDED
#define RIPPLE_BASICS_IOUAMOUNT_H_INCLUDED

#include <xrpl/basics/LocalValue.h>
#include <xrpl/basics/Number.h>
#include <xrpl/beast/utility/Zero.h>
#include <boost/operators.hpp>
Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions include/xrpl/beast/utility/Journal.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ class Journal
//--------------------------------------------------------------------------

/** Journal has no default constructor. */
Journal() = delete;
Journal() : Journal(getNullSink())
{
}

/** Create a journal that writes to the specified sink. */
explicit Journal(Sink& sink) : m_sink(&sink)
Expand Down Expand Up @@ -343,7 +345,6 @@ class Journal
};

#ifndef __INTELLISENSE__
static_assert(std::is_default_constructible<Journal>::value == false, "");
static_assert(std::is_copy_constructible<Journal>::value == true, "");
static_assert(std::is_move_constructible<Journal>::value == true, "");
static_assert(std::is_copy_assignable<Journal>::value == true, "");
Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions src/xrpld/core/Job.h → include/xrpl/jobqueue/Job.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
#ifndef RIPPLE_CORE_JOB_H_INCLUDED
#define RIPPLE_CORE_JOB_H_INCLUDED

#include <xrpld/core/ClosureCounter.h>
#include <xrpld/core/LoadMonitor.h>
#include <xrpl/basics/ClosureCounter.h>
#include <xrpl/basics/CountedObject.h>
#include <functional>
#include <xrpl/jobqueue/LoadMonitor.h>

#include <functional>

Expand Down
10 changes: 5 additions & 5 deletions src/xrpld/core/JobQueue.h → include/xrpl/jobqueue/JobQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
#ifndef RIPPLE_CORE_JOBQUEUE_H_INCLUDED
#define RIPPLE_CORE_JOBQUEUE_H_INCLUDED

#include <xrpld/core/ClosureCounter.h>
#include <xrpld/core/JobTypeData.h>
#include <xrpld/core/JobTypes.h>
#include <xrpld/core/Workers.h>
#include <xrpl/basics/ClosureCounter.h>
#include <xrpl/basics/LocalValue.h>
#include <xrpl/jobqueue/JobTypeData.h>
#include <xrpl/jobqueue/JobTypes.h>
#include <xrpl/jobqueue/Workers.h>
#include <xrpl/json/json_value.h>
#include <boost/coroutine/all.hpp>
#include <boost/range/begin.hpp> // workaround for boost 1.72 bug
Expand Down Expand Up @@ -402,7 +402,7 @@ class JobQueue : private Workers::Callback

} // namespace ripple

#include <xrpld/core/Coro.ipp>
#include <xrpl/jobqueue/Coro.ipp>

namespace ripple {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
#ifndef RIPPLE_CORE_JOBTYPEDATA_H_INCLUDED
#define RIPPLE_CORE_JOBTYPEDATA_H_INCLUDED

#include <xrpld/core/JobTypeInfo.h>
#include <xrpl/basics/Log.h>
#include <xrpl/beast/insight/Collector.h>
#include <xrpl/jobqueue/JobTypeInfo.h>

namespace ripple {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#ifndef RIPPLE_CORE_JOBTYPEINFO_H_INCLUDED
#define RIPPLE_CORE_JOBTYPEINFO_H_INCLUDED

#include <xrpld/core/Job.h>
#include <xrpl/jobqueue/Job.h>

namespace ripple {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#ifndef RIPPLE_CORE_JOBTYPES_H_INCLUDED
#define RIPPLE_CORE_JOBTYPES_H_INCLUDED

#include <xrpld/core/Job.h>
#include <xrpld/core/JobTypeInfo.h>
#include <xrpl/jobqueue/Job.h>
#include <xrpl/jobqueue/JobTypeInfo.h>
#include <map>
#include <string>
#include <type_traits>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
#ifndef RIPPLE_CORE_LOADMONITOR_H_INCLUDED
#define RIPPLE_CORE_LOADMONITOR_H_INCLUDED

#include <xrpld/core/LoadEvent.h>
#include <xrpl/basics/UptimeClock.h>
#include <xrpl/beast/utility/Journal.h>
#include <xrpl/jobqueue/LoadEvent.h>
#include <chrono>
#include <mutex>

Expand Down
86 changes: 86 additions & 0 deletions include/xrpl/jobqueue/NullPerfLog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2017 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 TESTS_JOBQUEUE_NULLPERFLOG_H
#define TESTS_JOBQUEUE_NULLPERFLOG_H

#include <xrpl/jobqueue/Job.h> // JobType
#include <xrpl/jobqueue/PerfLog.h>
#include <xrpl/json/json_value.h>

#include <cstdint>
#include <string>

namespace ripple {
namespace perf {

struct NullPerfLog : public perf::PerfLog
{
void
rpcStart(std::string const& method, std::uint64_t requestId) override
{
}
void
rpcFinish(std::string const& method, std::uint64_t requestId) override
{
}
void
rpcError(std::string const& method, std::uint64_t requestId) override
{
}
void
jobQueue(JobType const type) override
{
}
void
jobStart(
JobType const type,
microseconds dur,
steady_time_point startTime,
int instance) override
{
}
void
jobFinish(JobType const type, microseconds dur, int instance) override
{
}
Json::Value
countersJson() const override
{
return {};
}
Json::Value
currentJson() const override
{
return {};
}
void
resizeJobs(int const resize) override
{
}
void
rotate() override
{
}
};

} // namespace perf
} // namespace ripple

#endif
Loading

0 comments on commit 28f0c10

Please sign in to comment.