pvary commented on code in PR #23912:
URL: https://github.com/apache/flink/pull/23912#discussion_r1446081187


##########
flink-core/src/main/java/org/apache/flink/api/connector/sink2/StatefulSink.java:
##########
@@ -36,49 +34,43 @@
  * @param <WriterStateT> The type of the sink writer's state
  */
 @PublicEvolving
-public interface StatefulSink<InputT, WriterStateT> extends Sink<InputT> {
+@Deprecated

Review Comment:
   added in #24022



##########
flink-core/src/main/java/org/apache/flink/api/connector/sink2/SupportsWriterState.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.core.io.SimpleVersionedSerializer;
+
+import java.io.IOException;
+import java.util.Collection;
+
+/**
+ * A mixin interface for a {@link Sink} which supports a stateful {@link 
StatefulSinkWriter}.
+ *
+ * <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
+ * @param <WriterStateT> The type of the sink writer's state
+ */
+@PublicEvolving
+public interface SupportsWriterState<InputT, WriterStateT> {
+
+    /**
+     * Create a {@link StatefulSinkWriter} from a recovered state.
+     *
+     * @param context the runtime context.
+     * @return A sink writer.
+     * @throws IOException for any failure during creation.
+     */
+    StatefulSinkWriter<InputT, WriterStateT> restoreWriter(
+            WriterInitContext context, Collection<WriterStateT> 
recoveredState) throws IOException;
+
+    /**
+     * Any stateful sink needs to provide this state serializer and implement 
{@link
+     * StatefulSinkWriter#snapshotState(long)} properly. The respective state 
is used in {@link
+     * #restoreWriter(WriterInitContext, Collection)} on recovery.
+     *
+     * @return the serializer of the writer's state type.
+     */
+    SimpleVersionedSerializer<WriterStateT> getWriterStateSerializer();
+
+    /**
+     * A mix-in for {@link SupportsWriterState} that allows users to migrate 
from a sink with a
+     * compatible state to this sink.
+     */
+    @PublicEvolving
+    interface WithCompatibleState {
+        /**
+         * A list of state names of sinks from which the state can be 
restored. For example, the new

Review Comment:
   Fixed in #24022



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