public class QueryableStateClient extends Object
You can mark state as queryable via StateDescriptor.setQueryable(String)
.
The state instance created from this descriptor will be published for queries
when it's created on the TaskManagers and the location will be reported to
the JobManager.
The client resolves the location of the requested KvState via the JobManager. Resolved locations are cached. When the server address of the requested KvState instance is determined, the client sends out a request to the server.
Constructor and Description |
---|
QueryableStateClient(Configuration config,
HighAvailabilityServices highAvailabilityServices)
Creates a client from the given configuration.
|
QueryableStateClient(KvStateLocationLookupService lookupService,
KvStateClient kvStateClient,
scala.concurrent.ExecutionContext executionContext)
Creates a client.
|
Modifier and Type | Method and Description |
---|---|
scala.concurrent.ExecutionContext |
getExecutionContext()
Returns the execution context of this client.
|
scala.concurrent.Future<byte[]> |
getKvState(JobID jobId,
String queryableStateName,
int keyHashCode,
byte[] serializedKeyAndNamespace)
Returns a future holding the serialized request result.
|
void |
shutDown()
Shuts down the client and all components.
|
public QueryableStateClient(Configuration config, HighAvailabilityServices highAvailabilityServices) throws Exception
This will create multiple Thread pools: one for the started actor system and another for the network client.
config
- Configuration to use.highAvailabilityServices
- Service factory for high availability servicesException
- Failures are forwardedpublic QueryableStateClient(KvStateLocationLookupService lookupService, KvStateClient kvStateClient, scala.concurrent.ExecutionContext executionContext)
lookupService
- Location lookup servicekvStateClient
- Network client for queriesexecutionContext
- Execution context for futurespublic scala.concurrent.ExecutionContext getExecutionContext()
public void shutDown()
public scala.concurrent.Future<byte[]> getKvState(JobID jobId, String queryableStateName, int keyHashCode, byte[] serializedKeyAndNamespace)
If the server does not serve a KvState instance with the given ID,
the Future will be failed with a UnknownKvStateID
.
If the KvState instance does not hold any data for the given key
and namespace, the Future will be failed with a UnknownKeyOrNamespace
.
All other failures are forwarded to the Future.
jobId
- JobID of the job the queryable state
belongs toqueryableStateName
- Name under which the state is queryablekeyHashCode
- Integer hash code of the key (result of
a call to Object.hashCode()
serializedKeyAndNamespace
- Serialized key and namespace to query
KvState instance withCopyright © 2014–2018 The Apache Software Foundation. All rights reserved.