Skip to content

Commit

Permalink
Merge pull request #414 from evoskuil/master
Browse files Browse the repository at this point in the history
Add race_all and move all racers into /races.
  • Loading branch information
evoskuil authored Jun 6, 2024
2 parents 02381ca + 985f824 commit 1917776
Show file tree
Hide file tree
Showing 24 changed files with 275 additions and 86 deletions.
34 changes: 22 additions & 12 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,15 @@ test_libbitcoin_network_test_SOURCES = \
test/test.hpp \
test/async/desubscriber.cpp \
test/async/enable_shared_from_base.cpp \
test/async/race_quality.cpp \
test/async/race_speed.cpp \
test/async/race_unity.cpp \
test/async/race_volume.cpp \
test/async/subscriber.cpp \
test/async/thread.cpp \
test/async/threadpool.cpp \
test/async/unsubscriber.cpp \
test/async/races/race_all.cpp \
test/async/races/race_quality.cpp \
test/async/races/race_speed.cpp \
test/async/races/race_unity.cpp \
test/async/races/race_volume.cpp \
test/config/address.cpp \
test/config/authority.cpp \
test/config/endpoint.cpp \
Expand Down Expand Up @@ -234,16 +235,21 @@ include_bitcoin_network_async_HEADERS = \
include/bitcoin/network/async/desubscriber.hpp \
include/bitcoin/network/async/enable_shared_from_base.hpp \
include/bitcoin/network/async/handlers.hpp \
include/bitcoin/network/async/race_quality.hpp \
include/bitcoin/network/async/race_speed.hpp \
include/bitcoin/network/async/race_unity.hpp \
include/bitcoin/network/async/race_volume.hpp \
include/bitcoin/network/async/subscriber.hpp \
include/bitcoin/network/async/thread.hpp \
include/bitcoin/network/async/threadpool.hpp \
include/bitcoin/network/async/time.hpp \
include/bitcoin/network/async/unsubscriber.hpp

include_bitcoin_network_async_racesdir = ${includedir}/bitcoin/network/async/races
include_bitcoin_network_async_races_HEADERS = \
include/bitcoin/network/async/races/race_all.hpp \
include/bitcoin/network/async/races/race_quality.hpp \
include/bitcoin/network/async/races/race_speed.hpp \
include/bitcoin/network/async/races/race_unity.hpp \
include/bitcoin/network/async/races/race_volume.hpp \
include/bitcoin/network/async/races/races.hpp

include_bitcoin_network_configdir = ${includedir}/bitcoin/network/config
include_bitcoin_network_config_HEADERS = \
include/bitcoin/network/config/address.hpp \
Expand All @@ -256,13 +262,17 @@ include_bitcoin_network_impl_asyncdir = ${includedir}/bitcoin/network/impl/async
include_bitcoin_network_impl_async_HEADERS = \
include/bitcoin/network/impl/async/desubscriber.ipp \
include/bitcoin/network/impl/async/enable_shared_from_base.ipp \
include/bitcoin/network/impl/async/race_quality.ipp \
include/bitcoin/network/impl/async/race_speed.ipp \
include/bitcoin/network/impl/async/race_unity.ipp \
include/bitcoin/network/impl/async/race_volume.ipp \
include/bitcoin/network/impl/async/subscriber.ipp \
include/bitcoin/network/impl/async/unsubscriber.ipp

include_bitcoin_network_impl_async_racesdir = ${includedir}/bitcoin/network/impl/async/races
include_bitcoin_network_impl_async_races_HEADERS = \
include/bitcoin/network/impl/async/races/race_all.ipp \
include/bitcoin/network/impl/async/races/race_quality.ipp \
include/bitcoin/network/impl/async/races/race_speed.ipp \
include/bitcoin/network/impl/async/races/race_unity.ipp \
include/bitcoin/network/impl/async/races/race_volume.ipp

include_bitcoin_network_logdir = ${includedir}/bitcoin/network/log
include_bitcoin_network_log_HEADERS = \
include/bitcoin/network/log/capture.hpp \
Expand Down
9 changes: 5 additions & 4 deletions builds/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,15 @@ if (with-tests)
"../../test/test.hpp"
"../../test/async/desubscriber.cpp"
"../../test/async/enable_shared_from_base.cpp"
"../../test/async/race_quality.cpp"
"../../test/async/race_speed.cpp"
"../../test/async/race_unity.cpp"
"../../test/async/race_volume.cpp"
"../../test/async/subscriber.cpp"
"../../test/async/thread.cpp"
"../../test/async/threadpool.cpp"
"../../test/async/unsubscriber.cpp"
"../../test/async/races/race_all.cpp"
"../../test/async/races/race_quality.cpp"
"../../test/async/races/race_speed.cpp"
"../../test/async/races/race_unity.cpp"
"../../test/async/races/race_volume.cpp"
"../../test/config/address.cpp"
"../../test/config/authority.cpp"
"../../test/config/endpoint.cpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@
<ItemGroup>
<ClCompile Include="..\..\..\..\test\async\desubscriber.cpp" />
<ClCompile Include="..\..\..\..\test\async\enable_shared_from_base.cpp" />
<ClCompile Include="..\..\..\..\test\async\race_quality.cpp" />
<ClCompile Include="..\..\..\..\test\async\race_speed.cpp" />
<ClCompile Include="..\..\..\..\test\async\race_unity.cpp" />
<ClCompile Include="..\..\..\..\test\async\race_volume.cpp" />
<ClCompile Include="..\..\..\..\test\async\races\race_all.cpp" />
<ClCompile Include="..\..\..\..\test\async\races\race_quality.cpp" />
<ClCompile Include="..\..\..\..\test\async\races\race_speed.cpp" />
<ClCompile Include="..\..\..\..\test\async\races\race_unity.cpp" />
<ClCompile Include="..\..\..\..\test\async\races\race_volume.cpp" />
<ClCompile Include="..\..\..\..\test\async\subscriber.cpp" />
<ClCompile Include="..\..\..\..\test\async\thread.cpp" />
<ClCompile Include="..\..\..\..\test\async\threadpool.cpp" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<Filter Include="src\async">
<UniqueIdentifier>{D28FC18A-8B81-4247-0000-000000000001}</UniqueIdentifier>
</Filter>
<Filter Include="src\async\races">
<UniqueIdentifier>{D28FC18A-8B81-4247-0000-000000000008}</UniqueIdentifier>
</Filter>
<Filter Include="src\config">
<UniqueIdentifier>{D28FC18A-8B81-4247-0000-000000000002}</UniqueIdentifier>
</Filter>
Expand All @@ -39,17 +42,20 @@
<ClCompile Include="..\..\..\..\test\async\enable_shared_from_base.cpp">
<Filter>src\async</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\async\race_quality.cpp">
<Filter>src\async</Filter>
<ClCompile Include="..\..\..\..\test\async\races\race_all.cpp">
<Filter>src\async\races</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\async\race_speed.cpp">
<Filter>src\async</Filter>
<ClCompile Include="..\..\..\..\test\async\races\race_quality.cpp">
<Filter>src\async\races</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\async\race_unity.cpp">
<Filter>src\async</Filter>
<ClCompile Include="..\..\..\..\test\async\races\race_speed.cpp">
<Filter>src\async\races</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\async\race_volume.cpp">
<Filter>src\async</Filter>
<ClCompile Include="..\..\..\..\test\async\races\race_unity.cpp">
<Filter>src\async\races</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\async\races\race_volume.cpp">
<Filter>src\async\races</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\async\subscriber.cpp">
<Filter>src\async</Filter>
Expand Down
19 changes: 11 additions & 8 deletions builds/msvc/vs2022/libbitcoin-network/libbitcoin-network.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,12 @@
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\desubscriber.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\enable_shared_from_base.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\handlers.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\race_quality.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\race_speed.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\race_unity.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\race_volume.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\races\race_all.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\races\race_quality.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\races\race_speed.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\races\race_unity.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\races\race_volume.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\races\races.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\subscriber.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\thread.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\threadpool.hpp" />
Expand Down Expand Up @@ -265,10 +267,11 @@
<ItemGroup>
<None Include="..\..\..\..\include\bitcoin\network\impl\async\desubscriber.ipp" />
<None Include="..\..\..\..\include\bitcoin\network\impl\async\enable_shared_from_base.ipp" />
<None Include="..\..\..\..\include\bitcoin\network\impl\async\race_quality.ipp" />
<None Include="..\..\..\..\include\bitcoin\network\impl\async\race_speed.ipp" />
<None Include="..\..\..\..\include\bitcoin\network\impl\async\race_unity.ipp" />
<None Include="..\..\..\..\include\bitcoin\network\impl\async\race_volume.ipp" />
<None Include="..\..\..\..\include\bitcoin\network\impl\async\races\race_all.ipp" />
<None Include="..\..\..\..\include\bitcoin\network\impl\async\races\race_quality.ipp" />
<None Include="..\..\..\..\include\bitcoin\network\impl\async\races\race_speed.ipp" />
<None Include="..\..\..\..\include\bitcoin\network\impl\async\races\race_unity.ipp" />
<None Include="..\..\..\..\include\bitcoin\network\impl\async\races\race_volume.ipp" />
<None Include="..\..\..\..\include\bitcoin\network\impl\async\subscriber.ipp" />
<None Include="..\..\..\..\include\bitcoin\network\impl\async\unsubscriber.ipp" />
<None Include="packages.config" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,20 @@
<Filter Include="include\bitcoin\network\async">
<UniqueIdentifier>{564EB540-D6B6-425C-0000-00000000000B}</UniqueIdentifier>
</Filter>
<Filter Include="include\bitcoin\network\async\races">
<UniqueIdentifier>{564EB540-D6B6-425C-0000-000000000004}</UniqueIdentifier>
</Filter>
<Filter Include="include\bitcoin\network\config">
<UniqueIdentifier>{564EB540-D6B6-425C-0000-00000000000C}</UniqueIdentifier>
</Filter>
<Filter Include="include\bitcoin\network\impl">
<UniqueIdentifier>{564EB540-D6B6-425C-0000-00000000000D}</UniqueIdentifier>
</Filter>
<Filter Include="include\bitcoin\network\impl\async">
<UniqueIdentifier>{564EB540-D6B6-425C-0000-000000000004}</UniqueIdentifier>
<UniqueIdentifier>{564EB540-D6B6-425C-0000-000000000005}</UniqueIdentifier>
</Filter>
<Filter Include="include\bitcoin\network\impl\async\races">
<UniqueIdentifier>{564EB540-D6B6-425C-0000-000000000006}</UniqueIdentifier>
</Filter>
<Filter Include="include\bitcoin\network\log">
<UniqueIdentifier>{564EB540-D6B6-425C-0000-00000000000E}</UniqueIdentifier>
Expand All @@ -35,7 +41,7 @@
<UniqueIdentifier>{564EB540-D6B6-425C-0000-00000000000F}</UniqueIdentifier>
</Filter>
<Filter Include="include\bitcoin\network\messages\enums">
<UniqueIdentifier>{564EB540-D6B6-425C-0000-000000000005}</UniqueIdentifier>
<UniqueIdentifier>{564EB540-D6B6-425C-0000-000000000007}</UniqueIdentifier>
</Filter>
<Filter Include="include\bitcoin\network\net">
<UniqueIdentifier>{564EB540-D6B6-425C-0000-000000000001}</UniqueIdentifier>
Expand All @@ -47,7 +53,7 @@
<UniqueIdentifier>{564EB540-D6B6-425C-0000-000000000003}</UniqueIdentifier>
</Filter>
<Filter Include="resource">
<UniqueIdentifier>{564EB540-D6B6-425C-0000-000000000006}</UniqueIdentifier>
<UniqueIdentifier>{564EB540-D6B6-425C-0000-000000000008}</UniqueIdentifier>
</Filter>
<Filter Include="src">
<UniqueIdentifier>{564EB540-D6B6-425C-0000-000000000000}</UniqueIdentifier>
Expand Down Expand Up @@ -326,17 +332,23 @@
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\handlers.hpp">
<Filter>include\bitcoin\network\async</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\race_quality.hpp">
<Filter>include\bitcoin\network\async</Filter>
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\races\race_all.hpp">
<Filter>include\bitcoin\network\async\races</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\race_speed.hpp">
<Filter>include\bitcoin\network\async</Filter>
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\races\race_quality.hpp">
<Filter>include\bitcoin\network\async\races</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\race_unity.hpp">
<Filter>include\bitcoin\network\async</Filter>
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\races\race_speed.hpp">
<Filter>include\bitcoin\network\async\races</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\race_volume.hpp">
<Filter>include\bitcoin\network\async</Filter>
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\races\race_unity.hpp">
<Filter>include\bitcoin\network\async\races</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\races\race_volume.hpp">
<Filter>include\bitcoin\network\async\races</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\races\races.hpp">
<Filter>include\bitcoin\network\async\races</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\network\async\subscriber.hpp">
<Filter>include\bitcoin\network\async</Filter>
Expand Down Expand Up @@ -631,17 +643,20 @@
<None Include="..\..\..\..\include\bitcoin\network\impl\async\enable_shared_from_base.ipp">
<Filter>include\bitcoin\network\impl\async</Filter>
</None>
<None Include="..\..\..\..\include\bitcoin\network\impl\async\race_quality.ipp">
<Filter>include\bitcoin\network\impl\async</Filter>
<None Include="..\..\..\..\include\bitcoin\network\impl\async\races\race_all.ipp">
<Filter>include\bitcoin\network\impl\async\races</Filter>
</None>
<None Include="..\..\..\..\include\bitcoin\network\impl\async\race_speed.ipp">
<Filter>include\bitcoin\network\impl\async</Filter>
<None Include="..\..\..\..\include\bitcoin\network\impl\async\races\race_quality.ipp">
<Filter>include\bitcoin\network\impl\async\races</Filter>
</None>
<None Include="..\..\..\..\include\bitcoin\network\impl\async\race_unity.ipp">
<Filter>include\bitcoin\network\impl\async</Filter>
<None Include="..\..\..\..\include\bitcoin\network\impl\async\races\race_speed.ipp">
<Filter>include\bitcoin\network\impl\async\races</Filter>
</None>
<None Include="..\..\..\..\include\bitcoin\network\impl\async\race_volume.ipp">
<Filter>include\bitcoin\network\impl\async</Filter>
<None Include="..\..\..\..\include\bitcoin\network\impl\async\races\race_unity.ipp">
<Filter>include\bitcoin\network\impl\async\races</Filter>
</None>
<None Include="..\..\..\..\include\bitcoin\network\impl\async\races\race_volume.ipp">
<Filter>include\bitcoin\network\impl\async\races</Filter>
</None>
<None Include="..\..\..\..\include\bitcoin\network\impl\async\subscriber.ipp">
<Filter>include\bitcoin\network\impl\async</Filter>
Expand Down
10 changes: 6 additions & 4 deletions include/bitcoin/network.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@
#include <bitcoin/network/async/desubscriber.hpp>
#include <bitcoin/network/async/enable_shared_from_base.hpp>
#include <bitcoin/network/async/handlers.hpp>
#include <bitcoin/network/async/race_quality.hpp>
#include <bitcoin/network/async/race_speed.hpp>
#include <bitcoin/network/async/race_unity.hpp>
#include <bitcoin/network/async/race_volume.hpp>
#include <bitcoin/network/async/subscriber.hpp>
#include <bitcoin/network/async/thread.hpp>
#include <bitcoin/network/async/threadpool.hpp>
#include <bitcoin/network/async/time.hpp>
#include <bitcoin/network/async/unsubscriber.hpp>
#include <bitcoin/network/async/races/race_all.hpp>
#include <bitcoin/network/async/races/race_quality.hpp>
#include <bitcoin/network/async/races/race_speed.hpp>
#include <bitcoin/network/async/races/race_unity.hpp>
#include <bitcoin/network/async/races/race_volume.hpp>
#include <bitcoin/network/async/races/races.hpp>
#include <bitcoin/network/config/address.hpp>
#include <bitcoin/network/config/authority.hpp>
#include <bitcoin/network/config/config.hpp>
Expand Down
4 changes: 1 addition & 3 deletions include/bitcoin/network/async/async.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
#include <bitcoin/network/async/desubscriber.hpp>
#include <bitcoin/network/async/enable_shared_from_base.hpp>
#include <bitcoin/network/async/handlers.hpp>
#include <bitcoin/network/async/race_quality.hpp>
#include <bitcoin/network/async/race_speed.hpp>
#include <bitcoin/network/async/race_volume.hpp>
#include <bitcoin/network/async/races/races.hpp>
#include <bitcoin/network/async/subscriber.hpp>
#include <bitcoin/network/async/thread.hpp>
#include <bitcoin/network/async/threadpool.hpp>
Expand Down
51 changes: 51 additions & 0 deletions include/bitcoin/network/async/races/race_all.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* Copyright (c) 2011-2024 libbitcoin developers (see AUTHORS)
*
* This file is part of libbitcoin.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBBITCOIN_NETWORK_ASYNC_RACES_RACE_ALL_HPP
#define LIBBITCOIN_NETWORK_ASYNC_RACES_RACE_ALL_HPP

#include <functional>
#include <memory>
#include <bitcoin/network/define.hpp>
#include <bitcoin/network/async/handlers.hpp>

namespace libbitcoin {
namespace network {

template <typename... Args>
class race_all final
{
public:
typedef std::shared_ptr<race_all> ptr;
typedef std::function<void(Args...)> handler;

DEFAULT_COPY_MOVE(race_all);

race_all(handler&& complete) NOEXCEPT;
~race_all() NOEXCEPT;

private:
handler complete_;
};

} // namespace network
} // namespace libbitcoin

#include <bitcoin/network/impl/async/races/race_all.ipp>

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBBITCOIN_NETWORK_ASYNC_RACE_QUALITY_HPP
#define LIBBITCOIN_NETWORK_ASYNC_RACE_QUALITY_HPP
#ifndef LIBBITCOIN_NETWORK_ASYNC_RACES_RACE_QUALITY_HPP
#define LIBBITCOIN_NETWORK_ASYNC_RACES_RACE_QUALITY_HPP

#include <memory>
#include <tuple>
Expand Down Expand Up @@ -82,6 +82,6 @@ class race_quality final
} // namespace network
} // namespace libbitcoin

#include <bitcoin/network/impl/async/race_quality.ipp>
#include <bitcoin/network/impl/async/races/race_quality.ipp>

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBBITCOIN_NETWORK_ASYNC_RACE_SPEED_HPP
#define LIBBITCOIN_NETWORK_ASYNC_RACE_SPEED_HPP
#ifndef LIBBITCOIN_NETWORK_ASYNC_RACES_RACE_SPEED_HPP
#define LIBBITCOIN_NETWORK_ASYNC_RACES_RACE_SPEED_HPP

#include <memory>
#include <tuple>
Expand Down Expand Up @@ -79,6 +79,6 @@ class race_speed final
} // namespace network
} // namespace libbitcoin

#include <bitcoin/network/impl/async/race_speed.ipp>
#include <bitcoin/network/impl/async/races/race_speed.ipp>

#endif
Loading

0 comments on commit 1917776

Please sign in to comment.