mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2025-12-26 08:00:01 +00:00
chore: add some method for log query handler (#5685)
* chore: add some method for log query handler * chore: make clippy happy * chore: add some method for log query handler * Update src/frontend/src/instance/logs.rs Co-authored-by: shuiyisong <113876041+shuiyisong@users.noreply.github.com> --------- Co-authored-by: shuiyisong <113876041+shuiyisong@users.noreply.github.com>
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use std::ops::Deref;
|
||||
|
||||
use auth::{PermissionChecker, PermissionCheckerRef, PermissionReq};
|
||||
use client::Output;
|
||||
use common_error::ext::BoxedError;
|
||||
@@ -20,7 +22,7 @@ use server_error::Result as ServerResult;
|
||||
use servers::error::{self as server_error, AuthSnafu, ExecuteQuerySnafu};
|
||||
use servers::interceptor::{LogQueryInterceptor, LogQueryInterceptorRef};
|
||||
use servers::query_handler::LogQueryHandler;
|
||||
use session::context::QueryContextRef;
|
||||
use session::context::{QueryContext, QueryContextRef};
|
||||
use snafu::ResultExt;
|
||||
use tonic::async_trait;
|
||||
|
||||
@@ -64,4 +66,8 @@ impl LogQueryHandler for Instance {
|
||||
|
||||
Ok(interceptor.as_ref().post_query(output, ctx.clone())?)
|
||||
}
|
||||
|
||||
fn catalog_manager(&self, _ctx: &QueryContext) -> ServerResult<&dyn catalog::CatalogManager> {
|
||||
Ok(self.catalog_manager.deref())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ use std::sync::Arc;
|
||||
use api::prom_store::remote::ReadRequest;
|
||||
use api::v1::RowInsertRequests;
|
||||
use async_trait::async_trait;
|
||||
use catalog::CatalogManager;
|
||||
use common_query::Output;
|
||||
use headers::HeaderValue;
|
||||
use log_query::LogQuery;
|
||||
@@ -172,7 +173,11 @@ pub trait PipelineHandler {
|
||||
/// Handle log query requests.
|
||||
#[async_trait]
|
||||
pub trait LogQueryHandler {
|
||||
/// Execute a log query.
|
||||
async fn query(&self, query: LogQuery, ctx: QueryContextRef) -> Result<Output>;
|
||||
|
||||
/// Get catalog manager.
|
||||
fn catalog_manager(&self, ctx: &QueryContext) -> Result<&dyn CatalogManager>;
|
||||
}
|
||||
|
||||
/// Handle Jaeger query requests.
|
||||
|
||||
Reference in New Issue
Block a user