Skip to content

Commit

Permalink
Review update
Browse files Browse the repository at this point in the history
  • Loading branch information
lordgamez committed Nov 22, 2024
1 parent ef95765 commit e99afe0
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 153 deletions.
2 changes: 1 addition & 1 deletion CONTROLLERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ In the list below, the names of required properties appear in bold. Any other pr

| Name | Default Value | Allowable Values | Description |
|-----------------------|---------------|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **Connection String** | | | The hostnames or ip addresses of the bootstraping nodes and optional parameters. Syntax) couchbase://node1,node2,nodeN?param1=value1&param2=value2&paramN=valueN |
| **Connection String** | | | The hostnames or ip addresses of the bootstraping nodes and optional parameters. Syntax: couchbase://node1,node2,nodeN?param1=value1&param2=value2&paramN=valueN |
| User Name | | | The user name to authenticate MiNiFi as a Couchbase client. |
| User Password | | | The user password to authenticate MiNiFi as a Couchbase client.<br/>**Sensitive Property: true** |

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ This product bundles 'Kubernetes Client Library for C' (kubernetes-client/c), wh
This project bundles a configuration file from 'Kubernetes Metrics Server' (kubernetes-sigs/metrics-server), which is available under an ALv2 license
This project bundles 'OpenSSL' which is available under an ALv2 license
This project bundles 'gRPC' which is available under an ALv2 license
This project bundles 'couchbase-cxx-clien' which is available under an ALv2 license
This project bundles 'couchbase-cxx-client' which is available under an ALv2 license

The Apache NiFi - MiNiFi C++ project contains subcomponents with separate copyright
notices and license terms. Your use of the source code for the these
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace org::apache::nifi::minifi::couchbase {

namespace {

constexpr std::array<::couchbase::errc::common, 9> temporary_connection_errors = {
constexpr auto temporary_connection_errors = std::to_array<::couchbase::errc::common>({
::couchbase::errc::common::temporary_failure,
::couchbase::errc::common::request_canceled,
::couchbase::errc::common::internal_server_failure,
Expand All @@ -36,7 +36,7 @@ constexpr std::array<::couchbase::errc::common, 9> temporary_connection_errors =
::couchbase::errc::common::unambiguous_timeout,
::couchbase::errc::common::rate_limited,
::couchbase::errc::common::quota_limited
};
});

CouchbaseErrorType getErrorType(const std::error_code& error_code) {
for (const auto& temporary_error : temporary_connection_errors) {
Expand Down Expand Up @@ -104,6 +104,7 @@ void CouchbaseClient::close() {
if (cluster_) {
cluster_->close().wait();
}
cluster_ = std::nullopt;
}

nonstd::expected<void, CouchbaseErrorType> CouchbaseClient::establishConnection() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class CouchbaseClusterService : public core::controller::ControllerService {
EXTENSIONAPI static constexpr const char* Description = "Provides a centralized Couchbase connection and bucket passwords management. Bucket passwords can be specified via dynamic properties.";

EXTENSIONAPI static constexpr auto ConnectionString = core::PropertyDefinitionBuilder<>::createProperty("Connection String")
.withDescription("The hostnames or ip addresses of the bootstraping nodes and optional parameters. Syntax) couchbase://node1,node2,nodeN?param1=value1&param2=value2&paramN=valueN")
.withDescription("The hostnames or ip addresses of the bootstraping nodes and optional parameters. Syntax: couchbase://node1,node2,nodeN?param1=value1&param2=value2&paramN=valueN")
.isRequired(true)
.build();
EXTENSIONAPI static constexpr auto UserName = core::PropertyDefinitionBuilder<>::createProperty("User Name")
Expand Down
2 changes: 1 addition & 1 deletion extensions/couchbase/processors/PutCouchbaseKey.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class PutCouchbaseKey final : public core::AbstractProcessor<PutCouchbaseKey> {
.withDescription("Collection to use inside the bucket scope. If not specified, the _default collection is used.")
.supportsExpressionLanguage(true)
.build();
EXTENSIONAPI static constexpr auto DocumentType = core::PropertyDefinitionBuilder<3>::createProperty("Document Type")
EXTENSIONAPI static constexpr auto DocumentType = core::PropertyDefinitionBuilder<magic_enum::enum_count<CouchbaseValueType>()>::createProperty("Document Type")
.withDescription("Content type to store data as.")
.isRequired(true)
.withDefaultValue(magic_enum::enum_name(CouchbaseValueType::Json))
Expand Down
3 changes: 1 addition & 2 deletions libminifi/include/Exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,11 @@ enum ExceptionType {
REGEX_EXCEPTION,
REPOSITORY_EXCEPTION,
PARAMETER_EXCEPTION,
CONTROLLER_ENABLE_EXCEPTION,
MAX_EXCEPTION
};

static const char *ExceptionStr[MAX_EXCEPTION] = { "File Operation", "Flow File Operation", "Processor Operation", "Process Session Operation", "Process Schedule Operation", "Site2Site Protocol",
"General Operation", "Regex Operation", "Repository Operation", "Parameter Operation", "Controller Enable Operation" };
"General Operation", "Regex Operation", "Repository Operation", "Parameter Operation" };

inline const char *ExceptionTypeToString(ExceptionType type) {
if (type < MAX_EXCEPTION)
Expand Down
34 changes: 5 additions & 29 deletions thirdparty/bustache/add-append.patch
Original file line number Diff line number Diff line change
@@ -1,42 +1,18 @@
fmt library 11.0.2 requires the implementation of the append function aside
from push_back method when formatting the bustache specific container

diff --git a/include/bustache/model.hpp b/include/bustache/model.hpp
index 575969a..6df2cff 100644
index 575969a..07bc89d 100644
--- a/include/bustache/model.hpp
+++ b/include/bustache/model.hpp
@@ -8,7 +8,7 @@
#define BUSTACHE_MODEL_HPP_INCLUDED

#include <bustache/format.hpp>
-#include <version>
+#include <version>
#include <vector>
#include <cstring>
#include <concepts>
@@ -330,6 +330,16 @@ namespace bustache::detail
@@ -330,6 +330,13 @@ namespace bustache::detail
buf[count++] = c;
}

+ template <typename U>
+ void append(const U* begin, const U* end)
+ void append(const char* const begin, const char* const end)
+ {
+ size_t content_count = end - begin;
+ for (size_t i = 0; i < content_count; ++i) {
+ push_back(begin[i]);
+ for (const char* it = begin; it != end; ++it) {
+ push_back(*it);
+ }
+ begin += content_count;
+ }
+
void flush() { os(buf, count); }

std::size_t count = 0;
@@ -592,7 +602,7 @@ namespace bustache
{
static constexpr model kind = model::atom;
};
-
+
template<String T>
struct impl_test<T>
{
163 changes: 47 additions & 116 deletions thirdparty/couchbase/remove-thirdparty.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
diff --git a/cmake/ThirdPartyDependencies.cmake b/cmake/ThirdPartyDependencies.cmake
index f02af02..1a51f82 100644
index f02af02..f83c181 100644
--- a/cmake/ThirdPartyDependencies.cmake
+++ b/cmake/ThirdPartyDependencies.cmake
@@ -15,48 +15,48 @@ function(declare_system_library target)
@@ -3,73 +3,30 @@
include(cmake/CPM.cmake)

# https://cmake.org/cmake/help/v3.28/policy/CMP0063.html
set(CMAKE_POLICY_DEFAULT_CMP0063 NEW)

function(declare_system_library target)
message(STATUS "Declaring system library ${target}")
get_target_property(target_aliased_name ${target} ALIASED_TARGET)
if(target_aliased_name)
set(target ${target_aliased_name})
endif()
set_target_properties(${target} PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
$<TARGET_PROPERTY:${target},INTERFACE_INCLUDE_DIRECTORIES>)
endfunction()

Expand Down Expand Up @@ -48,55 +60,39 @@ index f02af02..1a51f82 100644
- "SPDLOG_BUILD_SHARED OFF"
- "SPDLOG_FMT_EXTERNAL ON")
-endif()
+# if(NOT TARGET fmt::fmt)
+# # https://github.com/fmtlib/fmt/releases
+# cpmaddpackage(
+# NAME
+# fmt
+# GIT_TAG
+# 11.0.1
+# VERSION
+# 11.0.1
+# GITHUB_REPOSITORY
+# "fmtlib/fmt"
+# EXCLUDE_FROM_ALL ON
+# OPTIONS
+# "FMT_INSTALL OFF"
+# # Unicode support for MSVC enabled in CompilerWarnings.cmake
+# "FMT_UNICODE OFF"
+# "FMT_DOC OFF"
+# "BUILD_SHARED_LIBS OFF"
+# "CMAKE_C_VISIBILITY_PRESET hidden"
+# "CMAKE_CXX_VISIBILITY_PRESET hidden"
+# "CMAKE_POSITION_INDEPENDENT_CODE ON")
+# endif()
+
+# if(NOT TARGET spdlog::spdlog)
+# # https://github.com/gabime/spdlog/releases
+# cpmaddpackage(
+# NAME
+# spdlog
+# VERSION
+# 1.14.1
+# GITHUB_REPOSITORY
+# "gabime/spdlog"
+# EXCLUDE_FROM_ALL ON
+# OPTIONS
+# "SPDLOG_INSTALL OFF"
+# "BUILD_SHARED_LIBS OFF"
+# "CMAKE_C_VISIBILITY_PRESET hidden"
+# "CMAKE_CXX_VISIBILITY_PRESET hidden"
+# "CMAKE_POSITION_INDEPENDENT_CODE ON"
+# "SPDLOG_BUILD_SHARED OFF"
+# "SPDLOG_FMT_EXTERNAL ON")
+# endif()

-
if(NOT TARGET Microsoft.GSL::GSL)
# https://github.com/microsoft/GSL/releases
@@ -172,70 +172,70 @@ if(NOT TARGET taocpp::json)
cpmaddpackage(
NAME
gsl
VERSION
4.0.0
GITHUB_REPOSITORY
"microsoft/gsl"
EXCLUDE_FROM_ALL ON
OPTIONS
"GSL_INSTALL OFF"
"CMAKE_C_VISIBILITY_PRESET hidden"
"CMAKE_CXX_VISIBILITY_PRESET hidden"
"CMAKE_POSITION_INDEPENDENT_CODE ON")
@@ -159,93 +116,24 @@ if(NOT TARGET taocpp::json)
"CMAKE_POSITION_INDEPENDENT_CODE ON"
"BUILD_SHARED_LIBS OFF"
"PEGTL_INSTALL ${COUCHBASE_CXX_CLIENT_INSTALL}"
"PEGTL_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/pegtl"
"PEGTL_INSTALL_DOC_DIR ${CMAKE_INSTALL_DATAROOTDIR}/doc/tao/pegtl"
"PEGTL_BUILD_TESTS OFF"
"PEGTL_BUILD_EXAMPLES OFF"
"PEGTL_USE_BOOST_FILESYSTEM OFF"
"TAOCPP_JSON_INSTALL ${COUCHBASE_CXX_CLIENT_INSTALL}"
"TAOCPP_JSON_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/taocpp-json"
"TAOCPP_JSON_INSTALL_DOC_DIR ${CMAKE_INSTALL_DATAROOTDIR}/doc/tao/json"
"TAOCPP_JSON_BUILD_TESTS OFF"
"TAOCPP_JSON_BUILD_EXAMPLES OFF")
endif()

-
-if(NOT TARGET asio::asio)
- # https://github.com/chriskohlhoff/asio/tags
- cpmaddpackage(
Expand Down Expand Up @@ -161,81 +157,16 @@ index f02af02..1a51f82 100644
-
- add_library(asio::asio ALIAS asio)
-endif()
+# if(NOT TARGET asio::asio)
+# # https://github.com/chriskohlhoff/asio/tags
+# cpmaddpackage(
+# NAME
+# asio
+# GIT_TAG
+# asio-1-31-0
+# VERSION
+# 1.31.0
+# GITHUB_REPOSITORY
+# "chriskohlhoff/asio"
+# EXCLUDE_FROM_ALL ON)
+# endif()
+
+# # ASIO doesn't use CMake, we have to configure it manually. Extra notes for using on Windows:
+# #
+# # 1) If _WIN32_WINNT is not set, ASIO assumes _WIN32_WINNT=0x0501, i.e. Windows XP target, which is definitely not the
+# # platform which most users target.
+# #
+# # 2) WIN32_LEAN_AND_MEAN is defined to make Winsock2 work.
+# if(asio_ADDED)
+# add_library(asio STATIC ${asio_SOURCE_DIR}/asio/src/asio.cpp ${asio_SOURCE_DIR}/asio/src/asio_ssl.cpp)
+
+# target_include_directories(asio SYSTEM PUBLIC ${asio_SOURCE_DIR}/asio/include)
+# target_compile_definitions(asio PRIVATE ASIO_STANDALONE=1 ASIO_NO_DEPRECATED=1 ASIO_SEPARATE_COMPILATION=1)
+# target_link_libraries(asio PRIVATE Threads::Threads OpenSSL::SSL OpenSSL::Crypto)
+# set_target_properties(
+# asio
+# PROPERTIES C_VISIBILITY_PRESET hidden
+# CXX_VISIBILITY_PRESET hidden
+# POSITION_INDEPENDENT_CODE TRUE)
+
+# if(WIN32)
+# # macro see @ https://stackoverflow.com/a/40217291/1746503
+# macro(get_win32_winnt version)
+# if(CMAKE_SYSTEM_VERSION)
+# set(ver ${CMAKE_SYSTEM_VERSION})
+# string(REGEX MATCH "^([0-9]+).([0-9])" ver ${ver})
+# string(REGEX MATCH "^([0-9]+)" verMajor ${ver})
+# # Check for Windows 10, b/c we'll need to convert to hex 'A'.
+# if("${verMajor}" MATCHES "10")
+# set(verMajor "A")
+# string(REGEX REPLACE "^([0-9]+)" ${verMajor} ver ${ver})
+# endif("${verMajor}" MATCHES "10")
+# # Remove all remaining '.' characters.
+# string(REPLACE "." "" ver ${ver})
+# # Prepend each digit with a zero.
+# string(REGEX REPLACE "([0-9A-Z])" "0\\1" ver ${ver})
+# set(${version} "0x${ver}")
+# endif()
+# endmacro()
+
+# if(NOT DEFINED _WIN32_WINNT)
+# get_win32_winnt(ver)
+# set(_WIN32_WINNT ${ver})
+# endif()
+
+# message(STATUS "Set _WIN32_WINNT=${_WIN32_WINNT}")
+
+# target_compile_definitions(asio INTERFACE _WIN32_WINNT=${_WIN32_WINNT} WIN32_LEAN_AND_MEAN)
+# endif()
+
+# add_library(asio::asio ALIAS asio)
+# endif()

-
add_library(jsonsl OBJECT ${PROJECT_SOURCE_DIR}/third_party/jsonsl/jsonsl.c)
set_target_properties(jsonsl PROPERTIES C_VISIBILITY_PRESET hidden POSITION_INDEPENDENT_CODE TRUE)
@@ -245,7 +245,7 @@ declare_system_library(snappy)
target_include_directories(jsonsl SYSTEM PUBLIC ${PROJECT_SOURCE_DIR}/third_party/jsonsl)

declare_system_library(snappy)
declare_system_library(llhttp::llhttp)
declare_system_library(hdr_histogram_static)
declare_system_library(Microsoft.GSL::GSL)
-declare_system_library(spdlog::spdlog)
-declare_system_library(fmt::fmt)
-declare_system_library(asio)
+# declare_system_library(spdlog::spdlog)
+# declare_system_library(fmt::fmt)
+# declare_system_library(asio)
declare_system_library(taocpp::json)

0 comments on commit e99afe0

Please sign in to comment.