bakaid commented on a change in pull request #605: MINIFICPP-550 - Implement RocksDB controller service and component st… URL: https://github.com/apache/nifi-minifi-cpp/pull/605#discussion_r393551822
########## File path: extensions/standard-processors/controllers/UnorderedMapPersistableKeyValueStoreService.h ########## @@ -0,0 +1,87 @@ +/** + * 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. + */ +#ifndef __UNORDERED_MAP_PERSISTABLE_KEY_VALUE_STORE_SERVICE_H__ +#define __UNORDERED_MAP_PERSISTABLE_KEY_VALUE_STORE_SERVICE_H__ + +#include "controllers/keyvalue/AbstractAutoPersistingKeyValueStoreService.h" +#include "UnorderedMapKeyValueStoreService.h" +#include "core/Core.h" +#include "properties/Configure.h" +#include "core/logging/Logger.h" +#include "core/logging/LoggerConfiguration.h" +#include "core/Resource.h" + +#include <unordered_map> +#include <string> +#include <mutex> +#include <memory> +#include <utility> + +namespace org { +namespace apache { +namespace nifi { +namespace minifi { +namespace controllers { + +class UnorderedMapPersistableKeyValueStoreService : public AbstractAutoPersistingKeyValueStoreService, Review comment: The motivation is twofold: to provide an implementation without any third party requirements, and to provide a serialized format which is human-readable and easily editable. As for the first motivation: we don't want to make it a hard requirement to have rocksdb to use stateful processors, because that would hinder low-footprint usages, nor do I want to make any other third party a dependency for this: it would, again, introduce an unwanted requirement for low-footprint usages and we would have to find one that supports all target platforms, and maintain it, which is not a negligible maintenance burden. For the second one: so far users could easily clear a state by deleting the state file or directory. With the rocksdb state storage this is no longer a trivial task. The C2 methods introduced here attempt to solve this problem, but until they are finalized (or if someone does not want to use, or can't use C2), they aren't really useful. A solution for this is using this state storage method: its serialized format is trivial and editable in text format without any third party tools, making it easy to clear (or even modify) the state of processors. Finally for the support argument: this is a trivial, and, if you take a look at `PersistableKeyValueStoreServiceTest.cpp`, well-tested implementation, that I don't think would introduce a significant maintenance burden going forward. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
