Zhangyx39 commented on a change in pull request #986: SAMZA-2156: Couchbase 
support for Samza Table API
URL: https://github.com/apache/samza/pull/986#discussion_r273199213
 
 

 ##########
 File path: 
samza-kv-remote/src/main/java/org/apache/samza/table/remote/couchbase/BaseCouchbaseTableFunction.java
 ##########
 @@ -0,0 +1,277 @@
+/*
+ * 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.samza.table.remote.couchbase;
+
+import com.couchbase.client.java.Bucket;
+import com.couchbase.client.java.error.TemporaryFailureException;
+import com.couchbase.client.java.error.TemporaryLockFailureException;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
+import java.io.Serializable;
+import java.time.Duration;
+import java.util.List;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.samza.context.Context;
+import org.apache.samza.operators.functions.ClosableFunction;
+import org.apache.samza.operators.functions.InitableFunction;
+import org.apache.samza.serializers.Serde;
+
+
+/**
+ * Base class for {@link CouchbaseTableReadFunction} and {@link 
CouchbaseTableWriteFunction}
+ * @param <V> Type of values to read from / write to couchbase
+ */
+public abstract class BaseCouchbaseTableFunction<V> implements 
InitableFunction, ClosableFunction, Serializable {
+
+  // Clients
+  private final static CouchbaseBucketRegistry COUCHBASE_BUCKET_REGISTRY = new 
CouchbaseBucketRegistry();
+  protected transient Bucket bucket;
+
+  // Function Settings
+  protected Serde<V> valueSerde = null;
 
 Review comment:
   Thank you Raymond for review.
   There is one case when the valueType is JsonObject.class, we do not require 
a valueSerde. The (de)serialization is handled by Couchbase client in that 
case. That's why we don't enforce valueSerde to be not null.

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

Reply via email to