MikeThomsen commented on a change in pull request #4635: URL: https://github.com/apache/nifi/pull/4635#discussion_r529952509
########## File path: nifi-nar-bundles/nifi-cassandra-bundle/nifi-cassandra-distributedmapcache-service/src/main/java/org/apache/nifi/controller/cassandra/CassandraDistributedMapCache.java ########## @@ -0,0 +1,241 @@ +/* + * 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. + */ + +package org.apache.nifi.controller.cassandra; + +import com.datastax.driver.core.BoundStatement; +import com.datastax.driver.core.PreparedStatement; +import com.datastax.driver.core.ResultSet; +import com.datastax.driver.core.Row; +import com.datastax.driver.core.Session; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.annotation.lifecycle.OnDisabled; +import org.apache.nifi.annotation.lifecycle.OnEnabled; +import org.apache.nifi.cassandra.CassandraSessionProviderService; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.controller.ConfigurationContext; +import org.apache.nifi.distributed.cache.client.Deserializer; +import org.apache.nifi.distributed.cache.client.DistributedMapCacheClient; +import org.apache.nifi.distributed.cache.client.Serializer; +import org.apache.nifi.processor.util.StandardValidators; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import static org.apache.nifi.controller.cassandra.QueryUtils.createDeleteStatement; +import static org.apache.nifi.controller.cassandra.QueryUtils.createExistsQuery; +import static org.apache.nifi.controller.cassandra.QueryUtils.createFetchQuery; +import static org.apache.nifi.controller.cassandra.QueryUtils.createInsertStatement; + +@Tags({"map", "cache", "distributed", "cassandra"}) +@CapabilityDescription("Provides a DistributedMapCache client that is based on Apache Cassandra.") +public class CassandraDistributedMapCache extends AbstractControllerService implements DistributedMapCacheClient { + public static final PropertyDescriptor SESSION_PROVIDER = new PropertyDescriptor.Builder() + .name("cassandra-dmc-session-provider") + .displayName("Session Provider") + .description("The client service that will configure the cassandra client connection.") + .required(true) + .identifiesControllerService(CassandraSessionProviderService.class) + .build(); + + public static final PropertyDescriptor TABLE_NAME = new PropertyDescriptor.Builder() + .name("cassandra-dmc-table-name") + .displayName("Table Name") + .description("The name of the table where the cache will be stored.") + .required(true) + .addValidator(StandardValidators.NON_EMPTY_EL_VALIDATOR) + .build(); + + public static final PropertyDescriptor KEY_FIELD_NAME = new PropertyDescriptor.Builder() + .name("cassandra-dmc-key-field-name") + .displayName("Key Field Name") + .description("The name of the field that acts as the unique key. (The CQL type should be \"blob\")") Review comment: I'd rather do it now because my team is planning to actually use this before 1.13.0 is released, so I'd like to make sure we just git right. What types besides text and varchar should realistically be supported? ---------------------------------------------------------------- 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: us...@infra.apache.org