public class QueryManager extends Object
Partitioner
and allows you to control using your configured (or not)
partitioner, what queries are seen for each BulletRecord
. It also uses the QueryCategorizer
to
categorize your queries for you if you use the categorize()
(for categorizing all queries) or
categorize(BulletRecord)
(for categorizing all partitioned queries for a record). You can get the queries
relevant to your record (after applying any partitioner) using partition(BulletRecord)
. You can use the
addQuery(String, Querier)
to add a query to the manager and the removeAndGetQuery(String)
and
removeQueries(Set)
methods to remove a query from the manager.Modifier and Type | Class and Description |
---|---|
static class |
QueryManager.PartitionStat |
Modifier and Type | Field and Description |
---|---|
static int |
QUANTILE_STEP |
Constructor and Description |
---|
QueryManager(BulletConfig config)
The constructor that takes a non-null
BulletConfig instance that contains partitioning settings. |
Modifier and Type | Method and Description |
---|---|
void |
addQuery(String id,
Querier querier)
Adds a configured, initialized query instance
Querier to the manager. |
QueryCategorizer |
categorize()
Categorizes all the queries in the manager regardless of partitioning, using a
QueryCategorizer . |
QueryCategorizer |
categorize(com.yahoo.bullet.record.BulletRecord record)
Categorizes only the queries for the
BulletRecord after partitioning using the QueryCategorizer . |
Querier |
getQuery(String id)
Retrieves a query stored in the manager or null, if not found.
|
Map<QueryManager.PartitionStat,Object> |
getStats()
Gets some statistics about the current state of partitioning and queries in this manager.
|
boolean |
hasQuery(String id)
Checks to see if the given ID is stored in the manager.
|
Map<String,Querier> |
partition(com.yahoo.bullet.record.BulletRecord record)
Takes a
BulletRecord instance and returns the matching queries (according to the Partitioner )
for it as as Map of query IDs to the Querier instances. |
List<Querier> |
removeAndGetQueries(Set<String> ids)
|
Querier |
removeAndGetQuery(String id)
Removes and returns a
Querier from the manager. |
void |
removeQueries(Set<String> ids)
Removes all the queries for the given non-null
Set of query IDs from the manager completely. |
int |
size()
Returns the size of the queries in the manager.
|
public static final int QUANTILE_STEP
public QueryManager(BulletConfig config)
BulletConfig
instance that contains partitioning settings.config
- The non-null config.public void addQuery(String id, Querier querier)
Querier
to the manager.id
- The query ID.querier
- A fully initialized Querier
instance.public Querier removeAndGetQuery(String id)
Querier
from the manager. The manager does not have any information pertaining to
the query any longer.id
- The query ID to remove.Querier
instance.public void removeQueries(Set<String> ids)
Set
of query IDs from the manager completely. Use
removeAndGetQueries(Set)
to get these queries.ids
- The non-null Set
of query IDs to remove.public Querier getQuery(String id)
id
- The ID of the query.Querier
instance or null, if not present.public boolean hasQuery(String id)
id
- The ID of the query.public int size()
public Map<String,Querier> partition(com.yahoo.bullet.record.BulletRecord record)
BulletRecord
instance and returns the matching queries (according to the Partitioner
)
for it as as Map
of query IDs to the Querier
instances.record
- The non-null BulletRecord
instance.Map
of matching queries for the record.public QueryCategorizer categorize()
QueryCategorizer
.QueryCategorizer
instance with all the categorized queries in the manager.public QueryCategorizer categorize(com.yahoo.bullet.record.BulletRecord record)
BulletRecord
after partitioning using the QueryCategorizer
.record
- The BulletRecord
to consume for the partitioned queries.QueryCategorizer
instance with the categorized queries in the manager after partitioning.public Map<QueryManager.PartitionStat,Object> getStats()
Map
of QueryManager.PartitionStat
to their values for the current state of the manager.Copyright © 2021. All rights reserved.