public class QueryLifecycle extends Object
initialize(Query)
)authorize(HttpServletRequest)
execute()
emitLogsAndMetrics(Throwable, String, long)
Modifier and Type | Class and Description |
---|---|
static class |
QueryLifecycle.QueryResponse |
Constructor and Description |
---|
QueryLifecycle(QueryToolChestWarehouse warehouse,
QuerySegmentWalker texasRanger,
GenericQueryMetricsFactory queryMetricsFactory,
ServiceEmitter emitter,
RequestLogger requestLogger,
AuthorizerMapper authorizerMapper,
long startMs,
long startNs) |
Modifier and Type | Method and Description |
---|---|
Access |
authorize(AuthenticationResult authenticationResult)
Authorize the query.
|
Access |
authorize(javax.servlet.http.HttpServletRequest req)
Authorize the query.
|
void |
emitLogsAndMetrics(Throwable e,
String remoteAddress,
long bytesWritten)
Emit logs and metrics for this query.
|
QueryLifecycle.QueryResponse |
execute()
Execute the query.
|
Query |
getQuery() |
void |
initialize(Query baseQuery)
Initializes this object to execute a specific query.
|
<T> Sequence<T> |
runSimple(Query<T> query,
AuthenticationResult authenticationResult,
String remoteAddress)
For callers where simplicity is desiredĀ over flexibility.
|
public QueryLifecycle(QueryToolChestWarehouse warehouse, QuerySegmentWalker texasRanger, GenericQueryMetricsFactory queryMetricsFactory, ServiceEmitter emitter, RequestLogger requestLogger, AuthorizerMapper authorizerMapper, long startMs, long startNs)
public <T> Sequence<T> runSimple(Query<T> query, AuthenticationResult authenticationResult, @Nullable String remoteAddress)
query
- the queryauthenticationResult
- authentication result indicating identity of the requesterremoteAddress
- remote address, for logging; or null if unknownpublic void initialize(Query baseQuery)
baseQuery
- the querypublic Access authorize(AuthenticationResult authenticationResult)
authenticationResult
- authentication result indicating the identity of the requesterpublic Access authorize(javax.servlet.http.HttpServletRequest req)
req
- HTTP request object of the request. If provided, the auth-related fields in the HTTP request
will be automatically set.public QueryLifecycle.QueryResponse execute()
emitLogsAndMetrics(Throwable, String, long)
to emit logs and metrics.public void emitLogsAndMetrics(@Nullable Throwable e, @Nullable String remoteAddress, long bytesWritten)
e
- exception that occurred while processing this queryremoteAddress
- remote address, for logging; or null if unknownbytesWritten
- number of bytes written; will become a query/bytes metric if >= 0public Query getQuery()
Copyright © 2011–2018. All rights reserved.