Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FLINK-7908][QS] Restructure the queryable state module.
The QS module is split into core and client. The core should be put in the lib folder to enable queryable state, while the client is the one that the user will program against. The reason for the restructuring in mainly to remove the dependency on the flink-runtime from the user's program.
- Loading branch information
Showing
98 changed files
with
1,601 additions
and
335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
flink-queryable-state/flink-queryable-state-client-java/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
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. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.apache.flink</groupId> | ||
<artifactId>flink-queryable-state</artifactId> | ||
<version>1.4-SNAPSHOT</version> | ||
<relativePath>..</relativePath> | ||
</parent> | ||
|
||
<artifactId>flink-queryable-state-client-java_${scala.binary.version}</artifactId> | ||
<name>flink-queryable-state-client-java</name> | ||
<packaging>jar</packaging> | ||
|
||
<dependencies> | ||
|
||
<!-- core dependencies --> | ||
|
||
<dependency> | ||
<groupId>org.apache.flink</groupId> | ||
<artifactId>flink-core</artifactId> | ||
<version>${project.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.flink</groupId> | ||
<artifactId>flink-shaded-netty</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.flink</groupId> | ||
<artifactId>flink-shaded-guava</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.flink</groupId> | ||
<artifactId>flink-core</artifactId> | ||
<version>${project.version}</version> | ||
<scope>test</scope> | ||
<type>test-jar</type> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.flink</groupId> | ||
<artifactId>flink-test-utils-junit</artifactId> | ||
<version>${project.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>test-jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
43 changes: 43 additions & 0 deletions
43
...ueryable-state-client-java/src/main/java/org/apache/flink/queryablestate/FutureUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* 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.queryablestate; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
/** | ||
* Utility class for {@link java.util.concurrent.Future Java Futures}. | ||
*/ | ||
public class FutureUtils { | ||
|
||
// ------------------------------------------------------------------------ | ||
// Future Completed with an exception. | ||
// ------------------------------------------------------------------------ | ||
|
||
/** | ||
* Returns a {@link CompletableFuture} that has failed with the exception | ||
* provided as argument. | ||
* @param throwable the exception to fail the future with. | ||
* @return The failed future. | ||
*/ | ||
public static <T> CompletableFuture<T> getFailedFuture(Throwable throwable) { | ||
CompletableFuture<T> failedAttempt = new CompletableFuture<>(); | ||
failedAttempt.completeExceptionally(throwable); | ||
return failedAttempt; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
...state-client-java/src/main/java/org/apache/flink/queryablestate/client/VoidNamespace.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* 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.queryablestate.client; | ||
|
||
import org.apache.flink.annotation.Internal; | ||
|
||
import java.io.ObjectStreamException; | ||
|
||
/** | ||
* Singleton placeholder class for state without a namespace. | ||
* | ||
* <p><b>THIS WAS COPIED FROM RUNTIME SO THAT WE AVOID THE DEPENDENCY.</b> | ||
*/ | ||
@Internal | ||
public final class VoidNamespace { | ||
|
||
// ------------------------------------------------------------------------ | ||
// Singleton instance. | ||
// ------------------------------------------------------------------------ | ||
|
||
/** The singleton instance. */ | ||
public static final VoidNamespace INSTANCE = new VoidNamespace(); | ||
|
||
/** Getter for the singleton instance. */ | ||
public static VoidNamespace get() { | ||
return INSTANCE; | ||
} | ||
|
||
/** This class should not be instantiated. */ | ||
private VoidNamespace() {} | ||
|
||
// ------------------------------------------------------------------------ | ||
// Standard Utilities | ||
// ------------------------------------------------------------------------ | ||
|
||
@Override | ||
public int hashCode() { | ||
return 99; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
return obj == this; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return getClass().getSimpleName(); | ||
} | ||
|
||
// ------------------------------------------------------------------------ | ||
// Singleton serialization | ||
// ------------------------------------------------------------------------ | ||
|
||
// make sure that we preserve the singleton properly on serialization | ||
private Object readResolve() throws ObjectStreamException { | ||
return INSTANCE; | ||
} | ||
} |
Oops, something went wrong.