fix: Rename SkippedCompactionService to CompactionService

To make a good place for other compactor-related gRPC actions in the
future.
pull/24376/head
Carol (Nichols || Goulding) 2022-10-21 12:42:06 -04:00
parent 699332fd6b
commit 0132a33946
No known key found for this signature in database
GPG Key ID: E907EE5A736F87D4
7 changed files with 21 additions and 23 deletions

View File

@ -3,7 +3,7 @@
use crate::handler::{CompactorHandler, ListSkippedCompactionsError};
use generated_types::influxdata::iox::compactor::v1::{
self as proto,
skipped_compaction_service_server::{SkippedCompactionService, SkippedCompactionServiceServer},
compaction_service_server::{CompactionService, CompactionServiceServer},
};
use std::sync::Arc;
use tonic::{Request, Response};
@ -21,22 +21,20 @@ impl<I: CompactorHandler + Send + Sync + 'static> GrpcDelegate<I> {
Self { compactor_handler }
}
/// Acquire a SkippedCompaction gRPC service implementation.
pub fn skipped_compaction_service(
&self,
) -> SkippedCompactionServiceServer<impl SkippedCompactionService> {
SkippedCompactionServiceServer::new(SkippedCompactionServiceImpl::new(Arc::clone(
&self.compactor_handler,
) as _))
/// Acquire a Compaction gRPC service implementation.
pub fn compaction_service(&self) -> CompactionServiceServer<impl CompactionService> {
CompactionServiceServer::new(CompactionServiceImpl::new(
Arc::clone(&self.compactor_handler) as _,
))
}
}
/// Implementation of skipped compaction
struct SkippedCompactionServiceImpl {
struct CompactionServiceImpl {
handler: Arc<dyn CompactorHandler + Send + Sync + 'static>,
}
impl SkippedCompactionServiceImpl {
impl CompactionServiceImpl {
pub fn new(handler: Arc<dyn CompactorHandler + Send + Sync + 'static>) -> Self {
Self { handler }
}
@ -54,7 +52,7 @@ impl From<ListSkippedCompactionsError> for tonic::Status {
}
#[tonic::async_trait]
impl SkippedCompactionService for SkippedCompactionServiceImpl {
impl CompactionService for CompactionServiceImpl {
async fn list_skipped_compactions(
&self,
_request: Request<proto::ListSkippedCompactionsRequest>,

View File

@ -49,7 +49,7 @@ fn generate_grpc_types(root: &Path) -> Result<()> {
let proto_files = vec![
catalog_path.join("parquet_file.proto"),
catalog_path.join("service.proto"),
compactor_path.join("skipped_compaction.proto"),
compactor_path.join("service.proto"),
delete_path.join("service.proto"),
ingester_path.join("parquet_metadata.proto"),
ingester_path.join("query.proto"),

View File

@ -2,7 +2,7 @@ syntax = "proto3";
package influxdata.iox.compactor.v1;
option go_package = "github.com/influxdata/iox/compactor/v1";
service SkippedCompactionService {
service CompactionService {
// List all skipped compactions in the catalog
rpc ListSkippedCompactions(ListSkippedCompactionsRequest) returns (ListSkippedCompactionsResponse);
}

View File

@ -1,6 +1,6 @@
//! This module implements the `skipped-compactions` CLI command
use influxdb_iox_client::{connection::Connection, skipped_compactions};
use influxdb_iox_client::{compactor, connection::Connection};
use thiserror::Error;
#[derive(Debug, Error)]
@ -27,7 +27,7 @@ enum Command {
}
pub async fn command(connection: Connection, config: Config) -> Result<(), Error> {
let mut client = skipped_compactions::Client::new(connection);
let mut client = compactor::Client::new(connection);
match config.command {
Command::List => {
let skipped_compactions = client.skipped_compactions().await?;

View File

@ -1,6 +1,9 @@
/// Client for interacting with a remote catalog
pub mod catalog;
/// Client for the compactor API
pub mod compactor;
/// Client for delete API
pub mod delete;
@ -20,9 +23,6 @@ pub mod namespace;
/// Client for schema API
pub mod schema;
/// Client for the skipped compactions API
pub mod skipped_compactions;
/// Client for interacting with a remote object store
pub mod store;

View File

@ -1,4 +1,4 @@
use self::generated_types::{skipped_compaction_service_client::SkippedCompactionServiceClient, *};
use self::generated_types::{compaction_service_client::CompactionServiceClient, *};
use crate::{connection::Connection, error::Error};
use client_util::connection::GrpcConnection;
@ -7,17 +7,17 @@ pub mod generated_types {
pub use generated_types::influxdata::iox::compactor::v1::*;
}
/// A basic client for fetching the Schema for a Namespace.
/// A basic client for interacting with the compaction service.
#[derive(Debug, Clone)]
pub struct Client {
inner: SkippedCompactionServiceClient<GrpcConnection>,
inner: CompactionServiceClient<GrpcConnection>,
}
impl Client {
/// Creates a new client with the provided connection
pub fn new(connection: Connection) -> Self {
Self {
inner: SkippedCompactionServiceClient::new(connection.into_grpc_connection()),
inner: CompactionServiceClient::new(connection.into_grpc_connection()),
}
}

View File

@ -87,7 +87,7 @@ impl<C: CompactorHandler + std::fmt::Debug + 'static> ServerType for CompactorSe
/// Provide a placeholder gRPC service.
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().skipped_compaction_service());
add_service!(builder, self.server.grpc().compaction_service());
serve_builder!(builder);
Ok(())