tillrohrmann commented on a change in pull request #13644:
URL: https://github.com/apache/flink/pull/13644#discussion_r516785922



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/leaderelection/LeaderElectionDriver.java
##########
@@ -0,0 +1,52 @@
+/*
+ * 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.runtime.leaderelection;
+
+/**
+ * A {@link LeaderElectionDriver} is responsible for performing the leader 
election and storing the leader information.
+ * All the leader internal state is guarded by lock in {@link 
LeaderElectionService}. Different driver
+ * implementations do not need to care about the lock. And it should use 
{@link LeaderElectionEventHandler}
+ * if it want to respond to the leader change events.
+ *
+ * <p><strong>Important</strong>: The {@link LeaderElectionDriver} could not 
guarantee that there is no
+ * {@link LeaderElectionEventHandler} callbacks happen after {@link #close()}.
+ */
+public interface LeaderElectionDriver {
+
+       /**
+        * Write the current leader information to external persistent 
storage(e.g. Zookeeper, Kubernetes ConfigMap). This
+        * is a blocking IO operation.
+        *
+        * @param leaderInformation current leader information. It could be 
{@link LeaderInformation#empty()}, which means
+        * the caller want to clear the leader information on external storage.
+        */
+       void writeLeaderInformation(LeaderInformation leaderInformation);

Review comment:
       Sounds good.




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


Reply via email to