fapaul commented on a change in pull request #18302:
URL: https://github.com/apache/flink/pull/18302#discussion_r781234978



##########
File path: 
flink-core/src/main/java/org/apache/flink/api/connector/sink2/Sink.java
##########
@@ -0,0 +1,106 @@
+/*
+ * 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.api.connector.sink2;
+
+import org.apache.flink.annotation.PublicEvolving;
+import org.apache.flink.api.common.operators.MailboxExecutor;
+import org.apache.flink.api.common.operators.ProcessingTimeService;
+import org.apache.flink.api.common.serialization.SerializationSchema;
+import org.apache.flink.metrics.groups.SinkWriterMetricGroup;
+import org.apache.flink.util.UserCodeClassLoader;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.OptionalLong;
+
+/**
+ * Base interface for developing a sink. A basic {@link Sink} is a stateless 
sink that can flush
+ * data on checkpoint to achieve at-least-once consistency. Sinks with 
additional requirements
+ * should implement {@link StatefulSink} or {@link TwoPhaseCommittingSink}.
+ *
+ * <p>The {@link Sink} needs to be serializable. All configuration should be 
validated eagerly. The
+ * respective sink writers are transient and will only be created in the 
subtasks on the
+ * taskmanagers.
+ *
+ * @param <InputT> The type of the sink's input
+ */
+@PublicEvolving
+public interface Sink<InputT> extends Serializable {
+
+    /**
+     * Create a {@link SinkWriter}.
+     *
+     * @param context the runtime context.
+     * @return A sink writer.
+     * @throws IOException for any failure during creation.
+     */
+    SinkWriter<InputT> createWriter(InitContext context) throws IOException;
+
+    /** The interface exposes some runtime info for creating a {@link 
SinkWriter}. */
+    @PublicEvolving
+    interface InitContext {
+        /** The first checkpoint id when an application is started. */
+        long INITIAL_CHECKPOINT_ID = 1;
+
+        /**
+         * Gets the {@link UserCodeClassLoader} to load classes that are not 
in system's classpath,
+         * but are part of the jar file of a user job.
+         *
+         * @see UserCodeClassLoader
+         */
+        UserCodeClassLoader getUserCodeClassLoader();
+
+        /**
+         * Returns the mailbox executor that allows to execute {@link 
Runnable}s inside the task
+         * thread in between record processing.
+         *
+         * <p>Note that this method should not be used per-record for 
performance reasons in the

Review comment:
       Note seems to be correct here.




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


Reply via email to