Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions examples/quick-start/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@ BasedOnStyle: "InheritParentConfig"

IncludeCategories:
# NOTE: A header is grouped by first matching regex
# Project headers
- Regex: "^\""
# Project library headers
- Regex: "^<spider"
Priority: 4
# Library headers. Update when adding new libraries.
# NOTE: clang-format retains leading white-space on a line in violation of the YAML spec.
# Ex:
# - Regex: "<(fmt|spdlog)"
# Priority: 3
- Regex: "^<(absl|boost|catch2|fmt|mariadb|msgpack|spdlog|spider)"
- Regex: "^<(absl|boost|catch2|fmt|mariadb|msgpack|spdlog|ystdlib)"
Priority: 3
# C system headers
- Regex: "^<.+\\.h>"
Priority: 1
# C++ standard libraries
- Regex: "^<.+>"
Priority: 2
# Project relative headers
- Regex: "^\".+\""
Priority: 5
5 changes: 4 additions & 1 deletion src/spider/.clang-format
Comment thread
davidlion marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ BasedOnStyle: "InheritParentConfig"

IncludeCategories:
# NOTE: A header is grouped by first matching regex
# Project headers
# Project library headers
- Regex: "^<spider"
Priority: 4
# Library headers. Update when adding new libraries.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I just realized all of the .clang-format files have a weird issue where the project library headers split up the comment. Unfortunately, I can't make the full suggestion.

It should be:

  # NOTE: A header is grouped by first matching regex library headers. Update when adding new
  # libraries.
  # NOTE: clang-format retains leading white-space on a line in violation of the YAML spec.
  # Project library headers
  - Regex: "^<spider"
    Priority: 4
  # External library headers
  - Regex: "^<(absl|boost|catch2|fmt|mariadb|msgpack|spdlog|ystdlib)"
    Priority: 3
  # C system headers

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the "Update when adding new libraries" is a comment for external library headers only. Thus I move it there.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Thanks!

Expand All @@ -18,3 +18,6 @@ IncludeCategories:
# C++ standard libraries
- Regex: "^<.+>"
Priority: 2
# Project relative headers
- Regex: "^\".+\""
Priority: 5
2 changes: 1 addition & 1 deletion src/spider/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ set(SPIDER_CORE_HEADERS

add_library(spider_core)
target_sources(spider_core PRIVATE ${SPIDER_CORE_SOURCES})
target_sources(spider_core PUBLIC ${SPIDER_CORE_HEADERS})
target_include_directories(spider_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..)
target_link_libraries(
spider_core
PUBLIC
Expand Down
14 changes: 7 additions & 7 deletions src/spider/client/Data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

#include <boost/uuid/uuid.hpp>

#include "../core/Error.hpp"
#include "../io/MsgPack.hpp" // IWYU pragma: keep
#include "../io/Serializer.hpp"
#include "../storage/DataStorage.hpp"
#include "../storage/StorageConnection.hpp"
#include "../storage/StorageFactory.hpp"
#include "Exception.hpp"
#include <spider/client/Exception.hpp>
#include <spider/core/Error.hpp>
#include <spider/io/MsgPack.hpp> // IWYU pragma: keep
#include <spider/io/Serializer.hpp>
#include <spider/storage/DataStorage.hpp>
#include <spider/storage/StorageConnection.hpp>
#include <spider/storage/StorageFactory.hpp>

namespace spider {
namespace core {
Expand Down
14 changes: 7 additions & 7 deletions src/spider/client/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
#include <boost/uuid/random_generator.hpp>
#include <boost/uuid/uuid.hpp>

#include "../core/Driver.hpp"
#include "../core/Error.hpp"
#include "../core/KeyValueData.hpp"
#include "../io/BoostAsio.hpp" // IWYU pragma: keep
#include "../storage/mysql/MySqlStorageFactory.hpp"
#include "../storage/StorageConnection.hpp"
#include "Exception.hpp"
#include <spider/client/Exception.hpp>
#include <spider/core/Driver.hpp>
#include <spider/core/Error.hpp>
#include <spider/core/KeyValueData.hpp>
#include <spider/io/BoostAsio.hpp> // IWYU pragma: keep
#include <spider/storage/mysql/MySqlStorageFactory.hpp>
#include <spider/storage/StorageConnection.hpp>

namespace spider {
Driver::Driver(std::string const& storage_url)
Expand Down
28 changes: 14 additions & 14 deletions src/spider/client/Driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@
#include <thread>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>

#include <boost/uuid/random_generator.hpp>
#include <boost/uuid/uuid.hpp>
#include <fmt/format.h>

#include "../core/Error.hpp"
#include "../core/TaskGraphImpl.hpp"
#include "../io/Serializer.hpp"
#include "../storage/JobSubmissionBatch.hpp"
#include "../storage/StorageConnection.hpp"
#include "../storage/StorageFactory.hpp"
#include "../worker/FunctionManager.hpp"
#include "../worker/FunctionNameManager.hpp"
#include "Data.hpp"
#include "Exception.hpp"
#include "Job.hpp"
#include "task.hpp"
#include "TaskGraph.hpp"
#include "utility"
#include <spider/client/Data.hpp>
#include <spider/client/Exception.hpp>
#include <spider/client/Job.hpp>
#include <spider/client/task.hpp>
#include <spider/client/TaskGraph.hpp>
#include <spider/core/Error.hpp>
#include <spider/core/TaskGraphImpl.hpp>
#include <spider/io/Serializer.hpp>
#include <spider/storage/JobSubmissionBatch.hpp>
#include <spider/storage/StorageConnection.hpp>
#include <spider/storage/StorageFactory.hpp>
#include <spider/worker/FunctionManager.hpp>
#include <spider/worker/FunctionNameManager.hpp>

/**
* Registers a Task function with Spider
Expand Down
22 changes: 11 additions & 11 deletions src/spider/client/Job.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
#include <boost/uuid/uuid.hpp>
#include <fmt/format.h>

#include "../core/DataImpl.hpp"
#include "../core/Error.hpp"
#include "../core/JobMetadata.hpp"
#include "../io/MsgPack.hpp" // IWYU pragma: keep
#include "../storage/MetadataStorage.hpp"
#include "../storage/StorageConnection.hpp"
#include "../storage/StorageFactory.hpp"
#include "Data.hpp"
#include "Exception.hpp"
#include "task.hpp"
#include "type_utils.hpp"
#include <spider/client/Data.hpp>
#include <spider/client/Exception.hpp>
#include <spider/client/task.hpp>
#include <spider/client/type_utils.hpp>
#include <spider/core/DataImpl.hpp>
#include <spider/core/Error.hpp>
#include <spider/core/JobMetadata.hpp>
#include <spider/io/MsgPack.hpp> // IWYU pragma: keep
#include <spider/storage/MetadataStorage.hpp>
#include <spider/storage/StorageConnection.hpp>
#include <spider/storage/StorageFactory.hpp>

namespace spider {
namespace core {
Expand Down
8 changes: 4 additions & 4 deletions src/spider/client/TaskContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

#include <boost/uuid/uuid.hpp>

#include "../core/Error.hpp"
#include "../core/KeyValueData.hpp"
#include "../storage/StorageConnection.hpp"
#include "Exception.hpp"
#include <spider/client/Exception.hpp>
#include <spider/core/Error.hpp>
#include <spider/core/KeyValueData.hpp>
#include <spider/storage/StorageConnection.hpp>

namespace spider {
auto TaskContext::get_id() const -> boost::uuids::uuid {
Expand Down
22 changes: 11 additions & 11 deletions src/spider/client/TaskContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
#include <boost/uuid/uuid.hpp>
#include <fmt/format.h>

#include "../core/Error.hpp"
#include "../core/TaskGraph.hpp"
#include "../core/TaskGraphImpl.hpp"
#include "../io/Serializer.hpp"
#include "../storage/StorageConnection.hpp"
#include "../storage/StorageFactory.hpp"
#include "Data.hpp"
#include "Exception.hpp"
#include "Job.hpp"
#include "task.hpp"
#include "TaskGraph.hpp"
#include <spider/client/Data.hpp>
#include <spider/client/Exception.hpp>
#include <spider/client/Job.hpp>
#include <spider/client/task.hpp>
#include <spider/client/TaskGraph.hpp>
#include <spider/core/Error.hpp>
#include <spider/core/TaskGraph.hpp>
#include <spider/core/TaskGraphImpl.hpp>
#include <spider/io/Serializer.hpp>
#include <spider/storage/StorageConnection.hpp>
#include <spider/storage/StorageFactory.hpp>

namespace spider {
namespace core {
Expand Down
2 changes: 1 addition & 1 deletion src/spider/client/TaskGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <memory>
#include <utility>

#include "task.hpp"
#include <spider/client/task.hpp>

namespace spider {
namespace core {
Expand Down
10 changes: 5 additions & 5 deletions src/spider/client/spider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#define SPIDER_CLIENT_SPIDER_HPP

// IWYU pragma: begin_exports
#include "Data.hpp"
#include "Driver.hpp"
#include "Job.hpp"
#include "TaskContext.hpp"
#include "TaskGraph.hpp"
#include <spider/client/Data.hpp>
#include <spider/client/Driver.hpp>
#include <spider/client/Job.hpp>
#include <spider/client/TaskContext.hpp>
#include <spider/client/TaskGraph.hpp>

// IWYU pragma: end_exports

Expand Down
6 changes: 3 additions & 3 deletions src/spider/client/task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

#include <type_traits>

#include "../io/Serializer.hpp"
#include "Data.hpp"
#include "type_utils.hpp"
#include <spider/client/Data.hpp>
#include <spider/client/type_utils.hpp>
#include <spider/io/Serializer.hpp>

namespace spider {
/**
Expand Down
6 changes: 3 additions & 3 deletions src/spider/core/DataImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include <memory>
#include <utility>

#include "../client/Data.hpp"
#include "../storage/StorageFactory.hpp"
#include "Data.hpp"
#include <spider/client/Data.hpp>
#include <spider/core/Data.hpp>
#include <spider/storage/StorageFactory.hpp>

namespace spider::core {
class DataImpl {
Expand Down
4 changes: 2 additions & 2 deletions src/spider/core/Task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include <boost/uuid/uuid_io.hpp>
#include <spdlog/spdlog.h>

#include "../io/MsgPack.hpp" // IWYU pragma: keep
#include "../io/Serializer.hpp" // IWYU pragma: keep
#include <spider/io/MsgPack.hpp> // IWYU pragma: keep
#include <spider/io/Serializer.hpp> // IWYU pragma: keep

namespace spider::core {
auto Task::get_arg_buffers() const -> std::optional<std::vector<msgpack::sbuffer>> {
Expand Down
4 changes: 2 additions & 2 deletions src/spider/core/Task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include <boost/uuid/random_generator.hpp>
#include <boost/uuid/uuid.hpp>

#include "../io/MsgPack.hpp"
#include "Data.hpp"
#include <spider/core/Data.hpp>
#include <spider/io/MsgPack.hpp>

namespace spider::core {
class TaskInput {
Expand Down
8 changes: 4 additions & 4 deletions src/spider/core/TaskContextImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

#include <boost/uuid/uuid.hpp>

#include "../client/TaskContext.hpp"
#include "../storage/DataStorage.hpp"
#include "../storage/MetadataStorage.hpp"
#include "../storage/StorageFactory.hpp"
#include <spider/client/TaskContext.hpp>
#include <spider/storage/DataStorage.hpp>
#include <spider/storage/MetadataStorage.hpp>
#include <spider/storage/StorageFactory.hpp>

namespace spider::core {
class TaskContextImpl {
Expand Down
2 changes: 1 addition & 1 deletion src/spider/core/TaskGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <boost/uuid/random_generator.hpp>
#include <boost/uuid/uuid.hpp>

#include "Task.hpp"
#include <spider/core/Task.hpp>

namespace spider::core {
class TaskGraph {
Expand Down
16 changes: 8 additions & 8 deletions src/spider/core/TaskGraphImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

#include <boost/uuid/uuid.hpp>

#include "../client/Data.hpp"
#include "../client/task.hpp"
#include "../client/type_utils.hpp"
#include "../core/Task.hpp"
#include "../core/TaskGraph.hpp"
#include "../io/MsgPack.hpp" // IWYU pragma: keep
#include "../io/Serializer.hpp" // IWYU pragma: keep
#include "../worker/FunctionNameManager.hpp"
#include <spider/client/Data.hpp>
#include <spider/client/task.hpp>
#include <spider/client/type_utils.hpp>
#include <spider/core/Task.hpp>
#include <spider/core/TaskGraph.hpp>
#include <spider/io/MsgPack.hpp> // IWYU pragma: keep
#include <spider/io/Serializer.hpp> // IWYU pragma: keep
#include <spider/worker/FunctionNameManager.hpp>

namespace spider::core {
class Data;
Expand Down
2 changes: 1 addition & 1 deletion src/spider/io/Serializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <boost/uuid/uuid.hpp>

#include "MsgPack.hpp" // IWYU pragma: keep
#include <spider/io/MsgPack.hpp> // IWYU pragma: keep

template <>
struct msgpack::adaptor::convert<boost::uuids::uuid> {
Expand Down
4 changes: 2 additions & 2 deletions src/spider/io/msgpack_message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

#include <spdlog/spdlog.h>

#include "BoostAsio.hpp" // IWYU pragma: keep
#include "MsgPack.hpp" // IWYU pragma: keep
#include <spider/io/BoostAsio.hpp> // IWYU pragma: keep
#include <spider/io/MsgPack.hpp> // IWYU pragma: keep

namespace {
/**
Expand Down
4 changes: 2 additions & 2 deletions src/spider/io/msgpack_message.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <functional>
#include <optional>

#include "BoostAsio.hpp" // IWYU pragma: keep
#include "MsgPack.hpp" // IWYU pragma :keep
#include <spider/io/BoostAsio.hpp> // IWYU pragma: keep
#include <spider/io/MsgPack.hpp> // IWYU pragma: keep

namespace spider::core {
auto send_message(boost::asio::ip::tcp::socket& socket, msgpack::sbuffer const& buffer) -> bool;
Expand Down
8 changes: 4 additions & 4 deletions src/spider/scheduler/FifoPolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

#include <boost/uuid/uuid.hpp>

#include "../core/Task.hpp"
#include "../storage/DataStorage.hpp"
#include "../storage/MetadataStorage.hpp"
#include "../storage/StorageConnection.hpp"
#include <spider/core/Task.hpp>
#include <spider/storage/DataStorage.hpp>
#include <spider/storage/MetadataStorage.hpp>
#include <spider/storage/StorageConnection.hpp>

namespace spider::scheduler {
FifoPolicy::FifoPolicy(
Expand Down
10 changes: 5 additions & 5 deletions src/spider/scheduler/FifoPolicy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

#include <boost/uuid/uuid.hpp>

#include "../core/Task.hpp"
#include "../storage/DataStorage.hpp"
#include "../storage/MetadataStorage.hpp"
#include "../storage/StorageConnection.hpp"
#include "SchedulerPolicy.hpp"
#include <spider/core/Task.hpp>
#include <spider/scheduler/SchedulerPolicy.hpp>
#include <spider/storage/DataStorage.hpp>
#include <spider/storage/MetadataStorage.hpp>
#include <spider/storage/StorageConnection.hpp>

namespace spider::scheduler {
class FifoPolicy final : public SchedulerPolicy {
Expand Down
Loading