martinzink commented on code in PR #1751:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1751#discussion_r1553149815


##########
extensions/http-curl/tests/C2AssetSyncTest.cpp:
##########
@@ -0,0 +1,257 @@
+/**
+ *
+ * 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.
+ */
+
+#undef NDEBUG
+#include <vector>
+#include <string>
+#include <fstream>
+#include <iterator>
+
+#include "HTTPIntegrationBase.h"
+#include "HTTPHandlers.h"
+#include "utils/IntegrationTestUtils.h"
+#include "utils/Environment.h"
+#include "utils/file/FileUtils.h"
+#include "utils/file/AssetManager.h"
+
+class FileProvider : public ServerAwareHandler {

Review Comment:
   Just noting for visibility that this will cause some conflict with #1749



##########
libminifi/src/core/state/nodes/AssetInformation.cpp:
##########
@@ -0,0 +1,47 @@
+/**
+ * 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 "core/state/nodes/AssetInformation.h"
+#include "core/Resource.h"
+#include "core/logging/LoggerFactory.h"
+
+namespace org::apache::nifi::minifi::state::response {
+
+AssetInformation::AssetInformation()
+  : logger_(core::logging::LoggerFactory<AssetInformation>().getLogger()) {}
+
+void 
AssetInformation::setAssetManager(std::shared_ptr<utils::file::AssetManager> 
asset_manager) {
+  asset_manager_ = asset_manager;
+  if (!asset_manager_) {
+    logger_->log_error("No asset manager is provided, asset information will 
not be available");
+  }
+}
+
+std::vector<SerializedResponseNode> AssetInformation::serialize() {
+  if (!asset_manager_) {
+    return {};
+  }
+  SerializedResponseNode node;
+  node.name = "hash";
+  node.value = asset_manager_->hash();
+
+  return std::vector<SerializedResponseNode>{node};
+}
+
+REGISTER_RESOURCE(AssetInformation, DescriptionOnly);
+
+}  // namespace org::apache::nifi::minifi::state::response

Review Comment:
   ```suggestion
   }  // namespace org::apache::nifi::minifi::state::response
   
   ```



##########
libminifi/src/core/state/nodes/AssetInformation.cpp:
##########
@@ -0,0 +1,47 @@
+/**
+ * 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 "core/state/nodes/AssetInformation.h"
+#include "core/Resource.h"
+#include "core/logging/LoggerFactory.h"
+
+namespace org::apache::nifi::minifi::state::response {
+
+AssetInformation::AssetInformation()
+  : logger_(core::logging::LoggerFactory<AssetInformation>().getLogger()) {}
+
+void 
AssetInformation::setAssetManager(std::shared_ptr<utils::file::AssetManager> 
asset_manager) {
+  asset_manager_ = asset_manager;

Review Comment:
   ```suggestion
     asset_manager_ = std::move(asset_manager);
   ```



##########
extensions/http-curl/tests/C2AssetSyncTest.cpp:
##########
@@ -0,0 +1,257 @@
+/**
+ *
+ * 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.
+ */
+
+#undef NDEBUG
+#include <vector>
+#include <string>
+#include <fstream>
+#include <iterator>
+
+#include "HTTPIntegrationBase.h"
+#include "HTTPHandlers.h"
+#include "utils/IntegrationTestUtils.h"
+#include "utils/Environment.h"

Review Comment:
   ```suggestion
   ```
   This include seems to be unused



##########
conf/minifi.properties:
##########
@@ -90,7 +90,7 @@ nifi.content.repository.class.name=DatabaseContentRepository
 #nifi.c2.rest.url=
 #nifi.c2.rest.url.ack=
 #nifi.c2.rest.ssl.context.service=
-nifi.c2.root.classes=DeviceInfoNode,AgentInformation,FlowInformation
+nifi.c2.root.classes=DeviceInfoNode,AgentInformation,FlowInformation,AssetInformation

Review Comment:
   Since this feature is opt in, I think we would need to emphasize this (in 
case of already existing conf, upgrade etc) so people dont forget to modify 
their configuration.
   Could you include a quick introduction about this feature in the README?



##########
libminifi/src/utils/file/AssetManager.cpp:
##########
@@ -0,0 +1,153 @@
+/**
+ * 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 "utils/file/AssetManager.h"
+#include "utils/file/FileUtils.h"
+#include "rapidjson/document.h"
+#include "rapidjson/writer.h"
+#include "core/logging/LoggerFactory.h"
+#include "utils/Hash.h"
+
+#undef GetObject
+
+namespace org::apache::nifi::minifi::utils::file {
+
+AssetManager::AssetManager(std::shared_ptr<Configure> configuration)

Review Comment:
   This could be a const Configure& instead 



##########
libminifi/include/core/state/nodes/AssetInformation.h:
##########
@@ -0,0 +1,42 @@
+/**
+ * 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.
+ */
+#pragma once
+
+#include "core/state/nodes/MetricsBase.h"
+#include "utils/file/AssetManager.h"
+#include "core/logging/Logger.h"
+
+namespace org::apache::nifi::minifi::state::response {
+
+class AssetInformation : public ResponseNode {
+ public:
+  AssetInformation();
+  explicit AssetInformation(std::string name, const utils::Identifier& uuid = 
{}) : ResponseNode(std::move(name), uuid) {}

Review Comment:
   ResponseNode ctor takes std::string_view, so we should probably do that here 
aswell.



-- 
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]

Reply via email to