Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protobuf / clang-format fixes #39

Merged
merged 7 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
41 changes: 25 additions & 16 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,56 +1,65 @@
---
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AlwaysBreakTemplateDeclarations: true
AllowShortFunctionsOnASingleLine: None
AlwaysBreakTemplateDeclarations: Yes
AlwaysBreakBeforeMultilineStrings: false
BinPackParameters: true
BreakBeforeBinaryOperators: false
BreakBeforeBraces: Allman
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterExternBlock: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyNamespace: true
SplitEmptyRecord: true
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 100
ConstructorInitializerIndentWidth: 0
ConstructorInitializerAllOnOneLineOrOnePerLine: false
Cpp11BracedListStyle: false
DerivePointerBinding: false
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: false
IndentWidth: 4
IndentFunctionDeclarationAfterType: false
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner

PointerBindsToType: true

PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 60
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60

PointerAlignment: Left

SpaceBeforeAssignmentOperators: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1


Standard: Cpp11
Standard: Latest
TabWidth: 4
UseTab: Never

SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
...

11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@ include(cmake/DefaultBuildType.cmake)
include(cmake/GitSubmoduleUpdate.cmake)
git_submodule_update()

find_package(Protobuf 3.0 REQUIRED)
set(protobuf_MODULE_COMPATIBLE ON CACHE BOOL "")
find_package(Protobuf CONFIG)
if(NOT Protobuf_FOUND)
find_package(Protobuf REQUIRED)
message(STATUS "Using protobuf MODULE mode")
# TODO Abseil dependencies
else()
message(STATUS "Using protobuf CONFIG mode")
endif()

find_package(Git)

if(NOT METRICQ_POSITION_INDEPENDENT_CODE)
Expand Down
36 changes: 18 additions & 18 deletions include/metricq/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ class DataChunkIter
{
public:
DataChunkIter(
google::protobuf::RepeatedField<const google::protobuf::int64>::iterator iter_time,
google::protobuf::RepeatedField<const double>::iterator iter_value)
google::protobuf::RepeatedField<google::protobuf::int64>::const_iterator iter_time,
google::protobuf::RepeatedField<double>::const_iterator iter_value)
: iter_time(iter_time), iter_value(iter_value)
{
}
Expand All @@ -153,8 +153,8 @@ class DataChunkIter
}

private:
google::protobuf::RepeatedField<const google::protobuf::int64>::iterator iter_time;
google::protobuf::RepeatedField<const double>::iterator iter_value;
google::protobuf::RepeatedField<google::protobuf::int64>::const_iterator iter_time;
google::protobuf::RepeatedField<double>::const_iterator iter_value;
int64_t timestamp = 0;
};

Expand All @@ -180,10 +180,10 @@ class [[deprecated]] HistoryRepsonseIter
#pragma GCC diagnostic ignored "-Wdeprecated"
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
HistoryRepsonseIter(
google::protobuf::RepeatedField<const google::protobuf::int64>::iterator iter_time,
google::protobuf::RepeatedField<const double>::iterator iter_value_min,
google::protobuf::RepeatedField<const double>::iterator iter_value_max,
google::protobuf::RepeatedField<const double>::iterator iter_value_avg)
google::protobuf::RepeatedField<google::protobuf::int64>::const_iterator iter_time,
google::protobuf::RepeatedField<double>::const_iterator iter_value_min,
google::protobuf::RepeatedField<double>::const_iterator iter_value_max,
google::protobuf::RepeatedField<double>::const_iterator iter_value_avg)
: iter_time(iter_time), iter_value_min(iter_value_min), iter_value_max(iter_value_max),
iter_value_avg(iter_value_avg)
{
Expand Down Expand Up @@ -212,13 +212,13 @@ class [[deprecated]] HistoryRepsonseIter
}

private:
google::protobuf::RepeatedField<const google::protobuf::int64>::iterator iter_time;
google::protobuf::RepeatedField<google::protobuf::int64>::const_iterator iter_time;

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated"
google::protobuf::RepeatedField<const double>::iterator iter_value_min;
google::protobuf::RepeatedField<const double>::iterator iter_value_max;
google::protobuf::RepeatedField<const double>::iterator iter_value_avg;
google::protobuf::RepeatedField<double>::const_iterator iter_value_min;
google::protobuf::RepeatedField<double>::const_iterator iter_value_max;
google::protobuf::RepeatedField<double>::const_iterator iter_value_avg;
#pragma GCC diagnostic pop

int64_t timestamp = 0;
Expand All @@ -244,8 +244,8 @@ class HistoryResponseValueIterator
{
public:
HistoryResponseValueIterator(
google::protobuf::RepeatedField<const google::protobuf::int64>::iterator iter_time,
google::protobuf::RepeatedField<const double>::iterator iter_value)
google::protobuf::RepeatedField<google::protobuf::int64>::const_iterator iter_time,
google::protobuf::RepeatedField<double>::const_iterator iter_value)
: iter_time(iter_time), iter_value(iter_value)
{
}
Expand All @@ -272,8 +272,8 @@ class HistoryResponseValueIterator
}

private:
google::protobuf::RepeatedField<const google::protobuf::int64>::iterator iter_time;
google::protobuf::RepeatedField<const double>::iterator iter_value;
google::protobuf::RepeatedField<google::protobuf::int64>::const_iterator iter_time;
google::protobuf::RepeatedField<double>::const_iterator iter_value;

int64_t timestamp = 0;
};
Expand All @@ -282,7 +282,7 @@ class HistoryResponseAggregateIterator
{
public:
HistoryResponseAggregateIterator(
google::protobuf::RepeatedField<const google::protobuf::int64>::iterator iter_time,
google::protobuf::RepeatedField<google::protobuf::int64>::const_iterator iter_time,
google::protobuf::RepeatedPtrField<HistoryResponse::Aggregate>::const_iterator
iter_aggregate)
: iter_time(iter_time), iter_aggregate(iter_aggregate)
Expand Down Expand Up @@ -314,7 +314,7 @@ class HistoryResponseAggregateIterator
}

private:
google::protobuf::RepeatedField<const google::protobuf::int64>::iterator iter_time;
google::protobuf::RepeatedField<google::protobuf::int64>::const_iterator iter_time;
google::protobuf::RepeatedPtrField<HistoryResponse::Aggregate>::const_iterator iter_aggregate;

int64_t timestamp = 0;
Expand Down
2 changes: 1 addition & 1 deletion lib/asio
Submodule asio updated 1577 files
29 changes: 15 additions & 14 deletions src/connection_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,21 @@ void AsioConnectionHandler::connect(const AMQP::Address& address)

void AsioConnectionHandler::connect(asio::ip::tcp::resolver::iterator endpoint_iterator)
{
asio::async_connect(this->underlying_socket(), endpoint_iterator,
[this](const auto& error, auto successful_endpoint) {
if (error)
{
log::error("[{}] Failed to connect to: {}", name_, error.message());
this->onError("Connect failed");
return;
}
log::debug("[{}] Established connection to {} at {}", name_,
successful_endpoint->host_name(),
successful_endpoint->endpoint());

this->handshake(successful_endpoint->host_name());
});
asio::async_connect(
this->underlying_socket(), endpoint_iterator, asio::ip::tcp::resolver::iterator(),
[this](const std::error_code& error,
asio::ip::tcp::resolver::iterator successful_endpoint) {
if (error)
{
log::error("[{}] Failed to connect to: {}", name_, error.message());
this->onError("Connect failed");
return;
}
log::debug("[{}] Established connection to {} at {}", name_,
successful_endpoint->host_name(), successful_endpoint->endpoint());

this->handshake(successful_endpoint->host_name());
});
}

void PlainConnectionHandler::handshake(const std::string& hostname)
Expand Down
Loading