From f9039f7d7315ea5bded5a9b86923b25dff7141e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arpad=20M=C3=BCller?= Date: Sun, 28 Apr 2024 01:15:07 +0200 Subject: [PATCH] Remove async_trait again --- libs/postgres_backend/src/lib.rs | 5 ++--- pageserver/src/page_service.rs | 3 +-- proxy/src/console/mgmt.rs | 1 - safekeeper/src/handler.rs | 1 - 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/libs/postgres_backend/src/lib.rs b/libs/postgres_backend/src/lib.rs index df6a95e326..858e19968d 100644 --- a/libs/postgres_backend/src/lib.rs +++ b/libs/postgres_backend/src/lib.rs @@ -78,17 +78,16 @@ pub fn is_expected_io_error(e: &io::Error) -> bool { ) } -#[async_trait::async_trait] pub trait Handler: HandlerSync { /// Handle single query. /// postgres_backend will issue ReadyForQuery after calling this (this /// might be not what we want after CopyData streaming, but currently we don't /// care). It will also flush out the output buffer. - async fn process_query( + fn process_query( &mut self, pgb: &mut PostgresBackend, query_string: &str, - ) -> Result<(), QueryError>; + ) -> impl Future> + Send; } pub trait HandlerSync { /// Called on startup packet receival, allows to process params. diff --git a/pageserver/src/page_service.rs b/pageserver/src/page_service.rs index 6a21dc4ab6..510f676078 100644 --- a/pageserver/src/page_service.rs +++ b/pageserver/src/page_service.rs @@ -1412,13 +1412,12 @@ where type IO<'s> = std::pin::Pin<&'s mut tokio_io_timeout::TimeoutReader>; -#[async_trait::async_trait] impl<'s> postgres_backend::Handler> for PageServerHandler { #[instrument(skip_all, fields(tenant_id, timeline_id))] async fn process_query( &mut self, - pgb: &mut PostgresBackend, + pgb: &mut PostgresBackend>, query_string: &str, ) -> Result<(), QueryError> { self.process_query_(pgb, &query_string).await diff --git a/proxy/src/console/mgmt.rs b/proxy/src/console/mgmt.rs index 633252275d..2f41acff5a 100644 --- a/proxy/src/console/mgmt.rs +++ b/proxy/src/console/mgmt.rs @@ -75,7 +75,6 @@ pub type ComputeReady = DatabaseInfo; // TODO: replace with an http-based protocol. struct MgmtHandler; -#[async_trait::async_trait] impl postgres_backend::Handler for MgmtHandler { async fn process_query( &mut self, diff --git a/safekeeper/src/handler.rs b/safekeeper/src/handler.rs index bb3619ae15..e185ce64ec 100644 --- a/safekeeper/src/handler.rs +++ b/safekeeper/src/handler.rs @@ -192,7 +192,6 @@ impl postgres_backend::HandlerSync postgres_backend::Handler for SafekeeperPostgresHandler {