martinzink commented on code in PR #1634: URL: https://github.com/apache/nifi-minifi-cpp/pull/1634#discussion_r1320130779
########## libminifi/include/utils/file/ListedFile.h: ########## @@ -0,0 +1,104 @@ +/** + * + * 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 <utility> +#include <string> + +#include "../ListingStateManager.h" + +namespace org::apache::nifi::minifi::utils { + +struct FileFilter { + std::optional<std::regex> filename_filter; + std::optional<std::regex> path_filter; + std::optional<std::chrono::milliseconds> minimum_file_age; + std::optional<std::chrono::milliseconds> maximum_file_age; + std::optional<uint64_t> minimum_file_size; + std::optional<uint64_t> maximum_file_size; + bool ignore_hidden_files = true; +}; + +class ListedFile : public utils::ListedObject { + public: + explicit ListedFile(std::filesystem::path full_file_path, std::filesystem::path input_directory) : full_file_path_(std::move(full_file_path)), input_directory_(std::move(input_directory)) { + if (auto last_write_time = utils::file::last_write_time(full_file_path_)) { + last_modified_time_ = utils::file::to_sys(*last_write_time); + } + } + + [[nodiscard]] std::chrono::system_clock::time_point getLastModified() const override { + return std::chrono::time_point_cast<std::chrono::milliseconds>(last_modified_time_); Review Comment: ListFile historically relied on the ms precision so for keeping the functionality I've left this in (without this the ListFileTests fail) https://github.com/apache/nifi-minifi-cpp/blob/main/extensions/standard-processors/processors/ListFile.cpp#L102 -- 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]
