refactor: expose underlying gRPC implementations
Changes the gRPC delegate to return the underlying service (type erased) implementations instead of the RPC service wrappers.pull/24376/head
parent
ac8fa293cb
commit
1a7679bcee
|
@ -7,7 +7,13 @@ use iox_catalog::interface::Catalog;
|
|||
use ioxd_common::{
|
||||
add_service,
|
||||
http::error::{HttpApiError, HttpApiErrorSource},
|
||||
reexport::tonic::transport::Endpoint,
|
||||
reexport::{
|
||||
generated_types::influxdata::iox::{
|
||||
catalog::v1::catalog_service_server, object_store::v1::object_store_service_server,
|
||||
schema::v1::schema_service_server,
|
||||
},
|
||||
tonic::transport::Endpoint,
|
||||
},
|
||||
rpc::RpcBuilderInput,
|
||||
serve_builder,
|
||||
server_type::{CommonServerState, RpcError, ServerType},
|
||||
|
@ -207,9 +213,20 @@ where
|
|||
/// [`RpcWriteGrpcDelegate`]: router::server::grpc::RpcWriteGrpcDelegate
|
||||
async fn server_grpc(self: Arc<Self>, builder_input: RpcBuilderInput) -> Result<(), RpcError> {
|
||||
let builder = setup_builder!(builder_input, self);
|
||||
add_service!(builder, self.server.grpc().schema_service());
|
||||
add_service!(builder, self.server.grpc().catalog_service());
|
||||
add_service!(builder, self.server.grpc().object_store_service());
|
||||
add_service!(
|
||||
builder,
|
||||
schema_service_server::SchemaServiceServer::new(self.server.grpc().schema_service())
|
||||
);
|
||||
add_service!(
|
||||
builder,
|
||||
catalog_service_server::CatalogServiceServer::new(self.server.grpc().catalog_service())
|
||||
);
|
||||
add_service!(
|
||||
builder,
|
||||
object_store_service_server::ObjectStoreServiceServer::new(
|
||||
self.server.grpc().object_store_service()
|
||||
)
|
||||
);
|
||||
serve_builder!(builder);
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -49,49 +49,33 @@ impl RpcWriteGrpcDelegate {
|
|||
/// Acquire a [`SchemaService`] gRPC service implementation.
|
||||
///
|
||||
/// [`SchemaService`]: generated_types::influxdata::iox::schema::v1::schema_service_server::SchemaService.
|
||||
pub fn schema_service(&self) -> schema_service_server::SchemaServiceServer<SchemaService> {
|
||||
schema_service_server::SchemaServiceServer::new(SchemaService::new(Arc::clone(
|
||||
&self.catalog,
|
||||
)))
|
||||
pub fn schema_service(&self) -> SchemaService {
|
||||
SchemaService::new(Arc::clone(&self.catalog))
|
||||
}
|
||||
|
||||
/// Acquire a [`CatalogService`] gRPC service implementation.
|
||||
///
|
||||
/// [`CatalogService`]: generated_types::influxdata::iox::catalog::v1::catalog_service_server::CatalogService.
|
||||
pub fn catalog_service(
|
||||
&self,
|
||||
) -> catalog_service_server::CatalogServiceServer<impl catalog_service_server::CatalogService>
|
||||
{
|
||||
catalog_service_server::CatalogServiceServer::new(CatalogService::new(Arc::clone(
|
||||
&self.catalog,
|
||||
)))
|
||||
pub fn catalog_service(&self) -> impl catalog_service_server::CatalogService {
|
||||
CatalogService::new(Arc::clone(&self.catalog))
|
||||
}
|
||||
|
||||
/// Acquire a [`ObjectStoreService`] gRPC service implementation.
|
||||
///
|
||||
/// [`ObjectStoreService`]: generated_types::influxdata::iox::object_store::v1::object_store_service_server::ObjectStoreService.
|
||||
pub fn object_store_service(
|
||||
&self,
|
||||
) -> object_store_service_server::ObjectStoreServiceServer<
|
||||
impl object_store_service_server::ObjectStoreService,
|
||||
> {
|
||||
object_store_service_server::ObjectStoreServiceServer::new(ObjectStoreService::new(
|
||||
Arc::clone(&self.catalog),
|
||||
Arc::clone(&self.object_store),
|
||||
))
|
||||
pub fn object_store_service(&self) -> impl object_store_service_server::ObjectStoreService {
|
||||
ObjectStoreService::new(Arc::clone(&self.catalog), Arc::clone(&self.object_store))
|
||||
}
|
||||
|
||||
/// Acquire a [`NamespaceService`] gRPC service implementation.
|
||||
///
|
||||
/// [`NamespaceService`]: generated_types::influxdata::iox::namespace::v1::namespace_service_server::NamespaceService.
|
||||
pub fn namespace_service(
|
||||
&self,
|
||||
) -> namespace_service_server::NamespaceServiceServer<NamespaceService> {
|
||||
namespace_service_server::NamespaceServiceServer::new(NamespaceService::new(
|
||||
pub fn namespace_service(&self) -> impl namespace_service_server::NamespaceService {
|
||||
NamespaceService::new(
|
||||
Arc::clone(&self.catalog),
|
||||
Some(self.topic_id),
|
||||
Some(self.query_id),
|
||||
))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue