mirror of
https://github.com/apache/nifi.git
synced 2025-02-07 18:48:51 +00:00
NIFI-11595 Backported StateMap.getStateVersion() for StateProviders
Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
parent
bf0bb81361
commit
ca05da490a
@ -18,6 +18,7 @@
|
||||
package org.apache.nifi.components.state;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Provides a representation of a component's state at some point in time.
|
||||
@ -31,8 +32,20 @@ public interface StateMap {
|
||||
*
|
||||
* @return the version associated with the state
|
||||
*/
|
||||
@Deprecated
|
||||
long getVersion();
|
||||
|
||||
/**
|
||||
* Get state version is not guaranteed to be numeric, but can be used to compare against an expected version.
|
||||
* The default implementation uses the available version number and considers -1 as indicating an empty version
|
||||
*
|
||||
* @return State version or empty when not known
|
||||
*/
|
||||
default Optional<String> getStateVersion() {
|
||||
final long version = getVersion();
|
||||
return version == -1 ? Optional.empty() : Optional.of(String.valueOf(version));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value associated with the given key
|
||||
*
|
||||
|
@ -64,6 +64,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
Loading…
x
Reference in New Issue
Block a user