You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@bahir.apache.org by GitBox <gi...@apache.org> on 2021/03/17 12:48:20 UTC

[GitHub] [bahir-flink] 1p4pk commented on a change in pull request #114: InfluxDBv2.0 Connector

1p4pk commented on a change in pull request #114:
URL: https://github.com/apache/bahir-flink/pull/114#discussion_r595982807



##########
File path: flink-connector-influxdb2/src/main/java/org/apache/flink/streaming/connectors/influxdb/sink/InfluxDBSinkBuilder.java
##########
@@ -0,0 +1,101 @@
+/*
+ * 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.flink.streaming.connectors.influxdb.sink;
+
+import static org.apache.flink.streaming.connectors.influxdb.sink.InfluxDBSinkOptions.INFLUXDB_BUCKET;
+import static org.apache.flink.streaming.connectors.influxdb.sink.InfluxDBSinkOptions.INFLUXDB_ORGANIZATION;
+import static org.apache.flink.streaming.connectors.influxdb.sink.InfluxDBSinkOptions.INFLUXDB_PASSWORD;
+import static org.apache.flink.streaming.connectors.influxdb.sink.InfluxDBSinkOptions.INFLUXDB_URL;
+import static org.apache.flink.streaming.connectors.influxdb.sink.InfluxDBSinkOptions.INFLUXDB_USERNAME;
+import static org.apache.flink.streaming.connectors.influxdb.sink.InfluxDBSinkOptions.WRITE_BUFFER_SIZE;
+import static org.apache.flink.streaming.connectors.influxdb.sink.InfluxDBSinkOptions.WRITE_DATA_POINT_CHECKPOINT;
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
+import java.util.Properties;
+import org.apache.flink.streaming.connectors.influxdb.sink.writer.InfluxDBSchemaSerializer;
+
+public final class InfluxDBSinkBuilder<IN> {
+    private InfluxDBSchemaSerializer<IN> influxDBSchemaSerializer;
+    private final Properties properties;
+
+    public InfluxDBSinkBuilder() {
+        this.influxDBSchemaSerializer = null;
+        this.properties = new Properties();
+    }
+
+    public InfluxDBSinkBuilder<IN> setInfluxDBUrl(final String influxDBUrl) {
+        return this.setProperty(INFLUXDB_URL.key(), influxDBUrl);
+    }
+
+    public InfluxDBSinkBuilder<IN> setInfluxDBUsername(final String influxDBUrl) {
+        return this.setProperty(INFLUXDB_USERNAME.key(), influxDBUrl);
+    }
+
+    public InfluxDBSinkBuilder<IN> setInfluxDBPassword(final String influxDBUrl) {
+        return this.setProperty(INFLUXDB_PASSWORD.key(), influxDBUrl);
+    }
+
+    public InfluxDBSinkBuilder<IN> setInfluxDBBucket(final String influxDBUrl) {
+        return this.setProperty(INFLUXDB_BUCKET.key(), influxDBUrl);
+    }
+
+    public InfluxDBSinkBuilder<IN> setInfluxDBOrganization(final String influxDBUrl) {
+        return this.setProperty(INFLUXDB_ORGANIZATION.key(), influxDBUrl);
+    }
+
+    public InfluxDBSinkBuilder<IN> setInfluxDBSchemaSerializer(
+            final InfluxDBSchemaSerializer<IN> influxDBSchemaSerializer) {
+        this.influxDBSchemaSerializer = influxDBSchemaSerializer;
+        return this;
+    }
+
+    public InfluxDBSinkBuilder<IN> setDataPointCheckpoint(final boolean shouldWrite) {
+        return this.setProperty(WRITE_DATA_POINT_CHECKPOINT.key(), String.valueOf(shouldWrite));
+    }
+
+    public InfluxDBSinkBuilder<IN> setWriteBufferSize(final int bufferSize) {

Review comment:
       This trade-off can be seen in the benchmarks. Further description needed?




----------------------------------------------------------------
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:
users@infra.apache.org