Package org.apache.flink.runtime.query
Class KvStateRegistry
- java.lang.Object
-
- org.apache.flink.runtime.query.KvStateRegistry
-
public class KvStateRegistry extends Object
A registry forInternalKvState
instances per task manager.This is currently only used for KvState queries: KvState instances, which are marked as queryable in their state descriptor are registered here and can be queried by the
KvStateServer
.KvState is registered when it is created/restored and unregistered when the owning operator stops running.
-
-
Constructor Summary
Constructors Constructor Description KvStateRegistry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TaskKvStateRegistry
createTaskRegistry(JobID jobId, JobVertexID jobVertexId)
Creates aTaskKvStateRegistry
facade for theTask
identified by the given JobID and JobVertexID instance.KvStateEntry<?,?,?>
getKvState(KvStateID kvStateId)
Returns theKvStateEntry
containing the requested instance as identified by the given KvStateID, along with itsKvStateInfo
ornull
if none is registered.KvStateID
registerKvState(JobID jobId, JobVertexID jobVertexId, KeyGroupRange keyGroupRange, String registrationName, InternalKvState<?,?,?> kvState, ClassLoader userClassLoader)
Registers the KvState instance and returns the assigned ID.void
registerListener(JobID jobId, KvStateRegistryListener listener)
Registers a listener with the registry.void
unregisterKvState(JobID jobId, JobVertexID jobVertexId, KeyGroupRange keyGroupRange, String registrationName, KvStateID kvStateId)
Unregisters the KvState instance identified by the given KvStateID.void
unregisterListener(JobID jobId)
Unregisters the listener with the registry.
-
-
-
Method Detail
-
registerListener
public void registerListener(JobID jobId, KvStateRegistryListener listener)
Registers a listener with the registry.- Parameters:
jobId
- identifying the job for which to register aKvStateRegistryListener
listener
- The registry listener.- Throws:
IllegalStateException
- If there is a registered listener
-
unregisterListener
public void unregisterListener(JobID jobId)
Unregisters the listener with the registry.- Parameters:
jobId
- for which to unregister theKvStateRegistryListener
-
registerKvState
public KvStateID registerKvState(JobID jobId, JobVertexID jobVertexId, KeyGroupRange keyGroupRange, String registrationName, InternalKvState<?,?,?> kvState, ClassLoader userClassLoader)
Registers the KvState instance and returns the assigned ID.- Parameters:
jobId
- JobId the KvState instance belongs tojobVertexId
- JobVertexID the KvState instance belongs tokeyGroupRange
- Key group range the KvState instance belongs toregistrationName
- Name under which the KvState is registeredkvState
- KvState instance to be registered- Returns:
- Assigned KvStateID
-
unregisterKvState
public void unregisterKvState(JobID jobId, JobVertexID jobVertexId, KeyGroupRange keyGroupRange, String registrationName, KvStateID kvStateId)
Unregisters the KvState instance identified by the given KvStateID.- Parameters:
jobId
- JobId the KvState instance belongs tokvStateId
- KvStateID to identify the KvState instancekeyGroupRange
- Key group range the KvState instance belongs to
-
getKvState
public KvStateEntry<?,?,?> getKvState(KvStateID kvStateId)
Returns theKvStateEntry
containing the requested instance as identified by the given KvStateID, along with itsKvStateInfo
ornull
if none is registered.- Parameters:
kvStateId
- KvStateID to identify the KvState instance- Returns:
- The
KvStateEntry
instance identified by the KvStateID ornull
if there is none
-
createTaskRegistry
public TaskKvStateRegistry createTaskRegistry(JobID jobId, JobVertexID jobVertexId)
Creates aTaskKvStateRegistry
facade for theTask
identified by the given JobID and JobVertexID instance.- Parameters:
jobId
- JobID of the taskjobVertexId
- JobVertexID of the task- Returns:
- A
TaskKvStateRegistry
facade for the task
-
-