K
- The type of the keyN
- The type of the namespaceS
- The type of the State
SD
- The type of the StateDescriptor
Backend
- The type of the backend that can restore the state from this snapshot.public abstract class AsynchronousKvStateSnapshot<K,N,S extends State,SD extends StateDescriptor<S,?>,Backend extends AbstractStateBackend> extends Object implements KvStateSnapshot<K,N,S,SD,Backend>
KvStateSnapshot
that asynchronously materializes the state that it represents. Instead
of representing a materialized handle to state this would normally hold the (immutable) state
internally and materializes it when materialize()
is called.Constructor and Description |
---|
AsynchronousKvStateSnapshot() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
long |
getStateSize()
Returns the size of the state in bytes.
|
abstract KvStateSnapshot<K,N,S,SD,Backend> |
materialize()
Materializes the state held by this
AsynchronousKvStateSnapshot . |
KvState<K,N,S,SD,Backend> |
restoreState(Backend stateBackend,
TypeSerializer<K> keySerializer,
ClassLoader classLoader)
Loads the key/value state back from this snapshot.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
discardState
public abstract KvStateSnapshot<K,N,S,SD,Backend> materialize() throws Exception
AsynchronousKvStateSnapshot
.Exception
public final KvState<K,N,S,SD,Backend> restoreState(Backend stateBackend, TypeSerializer<K> keySerializer, ClassLoader classLoader) throws Exception
KvStateSnapshot
restoreState
in interface KvStateSnapshot<K,N,S extends State,SD extends StateDescriptor<S,?>,Backend extends AbstractStateBackend>
stateBackend
- The state backend that created this snapshot and can restore the key/value state
from this snapshot.keySerializer
- The serializer for the keys.classLoader
- The class loader for user-defined types.Exception
- Exceptions can occur during the state loading and are forwarded.public long getStateSize() throws Exception
StateObject
If the the size is not known, return 0
.
getStateSize
in interface StateObject
Exception
- If the operation fails during size retrieval.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.