Skip to content

Commit

Permalink
remove unused methods
Browse files Browse the repository at this point in the history
Signed-off-by: tison <[email protected]>
  • Loading branch information
tisonkun committed May 1, 2024
1 parent cb094aa commit af71593
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 212 deletions.
97 changes: 3 additions & 94 deletions tests-integration/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ use api::v1::greptime_database_client::GreptimeDatabaseClient;
use api::v1::greptime_request::Request;
use api::v1::query_request::Query;
use api::v1::{
AlterExpr, AuthHeader, CreateTableExpr, DdlRequest, DeleteRequests, DropTableExpr,
GreptimeRequest, InsertRequests, PromRangeQuery, QueryRequest, RequestHeader,
RowInsertRequests, TruncateTableExpr,
AlterExpr, AuthHeader, CreateTableExpr, DdlRequest, GreptimeRequest, InsertRequests,
QueryRequest, RequestHeader,
};
use arrow_flight::Ticket;
use async_stream::stream;
Expand All @@ -38,8 +37,6 @@ use prost::Message;
use snafu::{ensure, ResultExt};
use tonic::transport::Channel;

use crate::stream_insert::StreamInserter;

pub const DEFAULT_LOOKBACK_STRING: &str = "5m";

#[derive(Clone, Debug, Default)]
Expand Down Expand Up @@ -104,34 +101,14 @@ impl Database {
}
}

pub fn catalog(&self) -> &String {
&self.catalog
}

pub fn set_catalog(&mut self, catalog: impl Into<String>) {
self.catalog = catalog.into();
}

pub fn schema(&self) -> &String {
&self.schema
}

pub fn set_schema(&mut self, schema: impl Into<String>) {
self.schema = schema.into();
}

pub fn dbname(&self) -> &String {
&self.dbname
}

pub fn set_dbname(&mut self, dbname: impl Into<String>) {
self.dbname = dbname.into();
}

pub fn timezone(&self) -> &String {
&self.timezone
}

pub fn set_timezone(&mut self, timezone: impl Into<String>) {
self.timezone = timezone.into();
}
Expand All @@ -146,34 +123,6 @@ impl Database {
self.handle(Request::Inserts(requests)).await
}

pub async fn row_insert(&self, requests: RowInsertRequests) -> Result<u32> {
self.handle(Request::RowInserts(requests)).await
}

pub fn streaming_inserter(&self) -> Result<StreamInserter> {
self.streaming_inserter_with_channel_size(65536)
}

pub fn streaming_inserter_with_channel_size(
&self,
channel_size: usize,
) -> Result<StreamInserter> {
let client = make_database_client(&self.client)?.inner;

let stream_inserter = StreamInserter::new(
client,
self.dbname().to_string(),
self.ctx.auth_header.clone(),
channel_size,
);

Ok(stream_inserter)
}

pub async fn delete(&self, request: DeleteRequests) -> Result<u32> {
self.handle(Request::Deletes(request)).await
}

async fn handle(&self, request: Request) -> Result<u32> {
let mut client = make_database_client(&self.client)?.inner;
let request = self.to_rpc_request(request);
Expand Down Expand Up @@ -207,32 +156,6 @@ impl Database {
.await
}

pub async fn logical_plan(&self, logical_plan: Vec<u8>) -> Result<Output> {
self.do_get(Request::Query(QueryRequest {
query: Some(Query::LogicalPlan(logical_plan)),
}))
.await
}

pub async fn prom_range_query(
&self,
promql: &str,
start: &str,
end: &str,
step: &str,
) -> Result<Output> {
self.do_get(Request::Query(QueryRequest {
query: Some(Query::PromRangeQuery(PromRangeQuery {
query: promql.to_string(),
start: start.to_string(),
end: end.to_string(),
step: step.to_string(),
lookback: DEFAULT_LOOKBACK_STRING.to_string(),
})),
}))
.await
}

pub async fn create(&self, expr: CreateTableExpr) -> Result<Output> {
self.do_get(Request::Ddl(DdlRequest {
expr: Some(DdlExpr::CreateTable(expr)),
Expand All @@ -247,20 +170,6 @@ impl Database {
.await
}

pub async fn drop_table(&self, expr: DropTableExpr) -> Result<Output> {
self.do_get(Request::Ddl(DdlRequest {
expr: Some(DdlExpr::DropTable(expr)),
}))
.await
}

pub async fn truncate_table(&self, expr: TruncateTableExpr) -> Result<Output> {
self.do_get(Request::Ddl(DdlRequest {
expr: Some(DdlExpr::TruncateTable(expr)),
}))
.await
}

async fn do_get(&self, request: Request) -> Result<Output> {
let request = self.to_rpc_request(request);
let request = Ticket {
Expand Down Expand Up @@ -354,7 +263,7 @@ impl Database {
}

#[derive(Default, Debug, Clone)]
pub struct FlightContext {
struct FlightContext {
auth_header: Option<AuthHeader>,
}

Expand Down
1 change: 0 additions & 1 deletion tests-integration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ mod instance;
mod opentsdb;
mod otlp;
mod prom_store;
mod stream_insert;
pub mod test_util;

pub mod standalone;
Expand Down
117 changes: 0 additions & 117 deletions tests-integration/src/stream_insert.rs

This file was deleted.

0 comments on commit af71593

Please sign in to comment.