lordgamez commented on a change in pull request #1158:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1158#discussion_r709067304
##########
File path: .github/workflows/ci.yml
##########
@@ -35,7 +35,7 @@ jobs:
export LDFLAGS="-L/usr/local/opt/flex/lib"
export CPPFLAGS="-I/usr/local/opt/flex/include"
# CPPFLAGS are not recognized by cmake, so we have to force them to
CFLAGS and CXXFLAGS to have flex 2.6 working
- ./bootstrap.sh -e -t && cd build && cmake
-DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="${CPPFLAGS} ${CFLAGS}"
-DCMAKE_CXX_FLAGS="${CPPFLAGS} ${CXXFLAGS}" -DENABLE_LUA_SCRIPTING=ON
-DENABLE_SQL=ON -DUSE_REAL_ODBC_TEST_DRIVER=ON -DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_RULE_MESSAGES=OFF -DSTRICT_GSL_CHECKS=AUDIT -DFAIL_ON_WARNINGS=ON .. &&
cmake --build . --parallel 4
+ ./bootstrap.sh -e -t && cd build && cmake
-DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="${CPPFLAGS} ${CFLAGS}"
-DCMAKE_CXX_FLAGS="${CPPFLAGS} ${CXXFLAGS}" -DENABLE_LUA_SCRIPTING=ON
-DENABLE_SQL=ON -DUSE_REAL_ODBC_TEST_DRIVER=ON -DENABLE_AZURE=ON
-DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES=OFF -DSTRICT_GSL_CHECKS=AUDIT
-DFAIL_ON_WARNINGS=ON .. && cmake --build . --parallel 4
Review comment:
It is already present in the ubuntu and windows builds and was only
missing in the MacOS build, so I added there as well.
##########
File path: extensions/azure/storage/AzureDataLakeStorageClient.cpp
##########
@@ -0,0 +1,55 @@
+/**
+ * @file AzureDataLakeStorageClient.cpp
+ * AzureDataLakeStorageClient class implementation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "AzureDataLakeStorageClient.h"
+
+namespace org::apache::nifi::minifi::azure::storage {
+
+void AzureDataLakeStorageClient::resetClientIfNeeded(const std::string&
connection_string, const std::string& file_system_name) {
+ if (client_ == nullptr || connection_string_ != connection_string ||
file_system_name_ != file_system_name) {
+ client_ =
std::make_unique<Azure::Storage::Files::DataLake::DataLakeFileSystemClient>(
+
Azure::Storage::Files::DataLake::DataLakeFileSystemClient::CreateFromConnectionString(connection_string,
file_system_name));
+ file_system_name_ = file_system_name;
+ connection_string_ = connection_string;
+ }
+}
+
+Azure::Storage::Files::DataLake::DataLakeFileClient
AzureDataLakeStorageClient::getFileClient(const
PutAzureDataLakeStorageParameters& params) {
+ resetClientIfNeeded(params.connection_string, params.file_system_name);
+ auto directory_client = client_->GetDirectoryClient(params.directory_name);
+ if (!params.directory_name.empty()) {
+ directory_client.CreateIfNotExists();
+ }
+ return directory_client.GetFileClient(params.filename);
+}
+
+bool AzureDataLakeStorageClient::createFile(const
PutAzureDataLakeStorageParameters& params) {
+ auto file_client = getFileClient(params);
+ auto response = file_client.CreateIfNotExists();
+ return response.Value.Created;
Review comment:
It is done in the AzureDataLakeStorage class. If an error occurs it
throws an exception from the SDK, but if the file already exists it does not
throw any errors, only sets the `response.Value.Created` value false. In
AzureDataLakeStorage::uploadFile we return these 3 possible values represented
in the UploadResultCode enum. I wanted to minimize the functionality of the
AzureDataLakeStorageClient as it is mocked in the tests, so it should mostly be
a wrapper of the Azure SDK client.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]