Java Code Examples for org.apache.flink.runtime.state.StateEntry#SimpleStateEntry
The following examples show how to use
org.apache.flink.runtime.state.StateEntry#SimpleStateEntry .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NestedStateMap.java From flink with Apache License 2.0 | 6 votes |
@Override public StateEntry<K, N, S> next() { if (!hasNext()) { throw new NoSuchElementException(); } if (!keyValueIterator.hasNext()) { namespace = namespaceIterator.next(); keyValueIterator = namespace.getValue().entrySet().iterator(); } Map.Entry<K, S> entry = keyValueIterator.next(); return new StateEntry.SimpleStateEntry<>( entry.getKey(), namespace.getKey(), entry.getValue()); }
Example 2
Source File: CopyOnWriteSkipListStateMap.java From flink with Apache License 2.0 | 6 votes |
/** * Returns the state entry of the node. */ private StateEntry<K, N, S> helpGetStateEntry(long node) { Node nodeStorage = getNodeSegmentAndOffset(node); MemorySegment segment = nodeStorage.nodeSegment; int offsetInSegment = nodeStorage.nodeOffset; int level = SkipListUtils.getLevel(segment, offsetInSegment); int keyDataLen = SkipListUtils.getKeyLen(segment, offsetInSegment); int keyDataOffset = offsetInSegment + SkipListUtils.getKeyDataOffset(level); K key = skipListKeySerializer.deserializeKey(segment, keyDataOffset, keyDataLen); N namespace = skipListKeySerializer.deserializeNamespace(segment, keyDataOffset, keyDataLen); long valuePointer = SkipListUtils.getValuePointer(segment, offsetInSegment); S state = helpGetState(valuePointer); return new StateEntry.SimpleStateEntry<>(key, namespace, state); }
Example 3
Source File: NestedStateMap.java From flink with Apache License 2.0 | 6 votes |
@Override public StateEntry<K, N, S> next() { if (!hasNext()) { throw new NoSuchElementException(); } if (!keyValueIterator.hasNext()) { namespace = namespaceIterator.next(); keyValueIterator = namespace.getValue().entrySet().iterator(); } Map.Entry<K, S> entry = keyValueIterator.next(); return new StateEntry.SimpleStateEntry<>( entry.getKey(), namespace.getKey(), entry.getValue()); }
Example 4
Source File: NestedStateMap.java From flink with Apache License 2.0 | 5 votes |
private boolean keyIteratorHasNext() { while (nextEntry == null && keyValueIterator != null && keyValueIterator.hasNext()) { Map.Entry<K, S> next = keyValueIterator.next(); Map<K, S> ns = namespaceMap.getOrDefault(namespace.getKey(), null); S upToDateValue = ns == null ? null : ns.getOrDefault(next.getKey(), null); if (upToDateValue != null) { nextEntry = new StateEntry.SimpleStateEntry<>(next.getKey(), namespace.getKey(), upToDateValue); } } return nextEntry != null; }
Example 5
Source File: NestedStateMap.java From flink with Apache License 2.0 | 5 votes |
private boolean keyIteratorHasNext() { while (nextEntry == null && keyValueIterator != null && keyValueIterator.hasNext()) { Map.Entry<K, S> next = keyValueIterator.next(); Map<K, S> ns = namespaceMap.getOrDefault(namespace.getKey(), null); S upToDateValue = ns == null ? null : ns.getOrDefault(next.getKey(), null); if (upToDateValue != null) { nextEntry = new StateEntry.SimpleStateEntry<>(next.getKey(), namespace.getKey(), upToDateValue); } } return nextEntry != null; }