本文整理汇总了Java中org.apache.flink.api.common.state.StateDescriptor.Type方法的典型用法代码示例。如果您正苦于以下问题:Java StateDescriptor.Type方法的具体用法?Java StateDescriptor.Type怎么用?Java StateDescriptor.Type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flink.api.common.state.StateDescriptor
的用法示例。
在下文中一共展示了StateDescriptor.Type方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RegisteredBackendStateMetaInfo
import org.apache.flink.api.common.state.StateDescriptor; //导入方法依赖的package包/类
public RegisteredBackendStateMetaInfo(
StateDescriptor.Type stateType,
String name,
TypeSerializer<N> namespaceSerializer,
TypeSerializer<S> stateSerializer) {
this.stateType = checkNotNull(stateType);
this.name = checkNotNull(name);
this.namespaceSerializer = checkNotNull(namespaceSerializer);
this.stateSerializer = checkNotNull(stateSerializer);
}
示例2: RegisteredKeyedBackendStateMetaInfo
import org.apache.flink.api.common.state.StateDescriptor; //导入方法依赖的package包/类
public RegisteredKeyedBackendStateMetaInfo(
StateDescriptor.Type stateType,
String name,
TypeSerializer<N> namespaceSerializer,
TypeSerializer<S> stateSerializer) {
this.stateType = checkNotNull(stateType);
this.name = checkNotNull(name);
this.namespaceSerializer = checkNotNull(namespaceSerializer);
this.stateSerializer = checkNotNull(stateSerializer);
}
示例3: Snapshot
import org.apache.flink.api.common.state.StateDescriptor; //导入方法依赖的package包/类
private Snapshot(
StateDescriptor.Type stateType,
String name,
TypeSerializer<N> namespaceSerializer,
TypeSerializer<S> stateSerializer,
TypeSerializerConfigSnapshot namespaceSerializerConfigSnapshot,
TypeSerializerConfigSnapshot stateSerializerConfigSnapshot) {
this.stateType = Preconditions.checkNotNull(stateType);
this.name = Preconditions.checkNotNull(name);
this.namespaceSerializer = Preconditions.checkNotNull(namespaceSerializer);
this.stateSerializer = Preconditions.checkNotNull(stateSerializer);
this.namespaceSerializerConfigSnapshot = Preconditions.checkNotNull(namespaceSerializerConfigSnapshot);
this.stateSerializerConfigSnapshot = Preconditions.checkNotNull(stateSerializerConfigSnapshot);
}
示例4: tryRegisterStateTable
import org.apache.flink.api.common.state.StateDescriptor; //导入方法依赖的package包/类
private <N, V> StateTable<K, N, V> tryRegisterStateTable(
String stateName,
StateDescriptor.Type stateType,
TypeSerializer<N> namespaceSerializer,
TypeSerializer<V> valueSerializer) throws StateMigrationException {
final RegisteredKeyedBackendStateMetaInfo<N, V> newMetaInfo =
new RegisteredKeyedBackendStateMetaInfo<>(stateType, stateName, namespaceSerializer, valueSerializer);
@SuppressWarnings("unchecked")
StateTable<K, N, V> stateTable = (StateTable<K, N, V>) stateTables.get(stateName);
if (stateTable == null) {
stateTable = newStateTable(newMetaInfo);
stateTables.put(stateName, stateTable);
} else {
// TODO with eager registration in place, these checks should be moved to restorePartitionedState()
Preconditions.checkState(
stateName.equals(stateTable.getMetaInfo().getName()),
"Incompatible state names. " +
"Was [" + stateTable.getMetaInfo().getName() + "], " +
"registered with [" + newMetaInfo.getName() + "].");
if (!newMetaInfo.getStateType().equals(StateDescriptor.Type.UNKNOWN)
&& !stateTable.getMetaInfo().getStateType().equals(StateDescriptor.Type.UNKNOWN)) {
Preconditions.checkState(
newMetaInfo.getStateType().equals(stateTable.getMetaInfo().getStateType()),
"Incompatible state types. " +
"Was [" + stateTable.getMetaInfo().getStateType() + "], " +
"registered with [" + newMetaInfo.getStateType() + "].");
}
@SuppressWarnings("unchecked")
RegisteredKeyedBackendStateMetaInfo.Snapshot<N, V> restoredMetaInfo =
(RegisteredKeyedBackendStateMetaInfo.Snapshot<N, V>) restoredKvStateMetaInfos.get(stateName);
// check compatibility results to determine if state migration is required
CompatibilityResult<N> namespaceCompatibility = CompatibilityUtil.resolveCompatibilityResult(
restoredMetaInfo.getNamespaceSerializer(),
null,
restoredMetaInfo.getNamespaceSerializerConfigSnapshot(),
newMetaInfo.getNamespaceSerializer());
CompatibilityResult<V> stateCompatibility = CompatibilityUtil.resolveCompatibilityResult(
restoredMetaInfo.getStateSerializer(),
UnloadableDummyTypeSerializer.class,
restoredMetaInfo.getStateSerializerConfigSnapshot(),
newMetaInfo.getStateSerializer());
if (!namespaceCompatibility.isRequiresMigration() && !stateCompatibility.isRequiresMigration()) {
// new serializers are compatible; use them to replace the old serializers
stateTable.setMetaInfo(newMetaInfo);
} else {
// TODO state migration currently isn't possible.
// NOTE: for heap backends, it is actually fine to proceed here without failing the restore,
// since the state has already been deserialized to objects and we can just continue with
// the new serializer; we're deliberately failing here for now to have equal functionality with
// the RocksDB backend to avoid confusion for users.
throw new StateMigrationException("State migration isn't supported, yet.");
}
}
return stateTable;
}
示例5: getStateType
import org.apache.flink.api.common.state.StateDescriptor; //导入方法依赖的package包/类
public StateDescriptor.Type getStateType() {
return stateType;
}
示例6: setStateType
import org.apache.flink.api.common.state.StateDescriptor; //导入方法依赖的package包/类
void setStateType(StateDescriptor.Type stateType) {
this.stateType = stateType;
}