Skip to content

Commit

Permalink
refactor: remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyXu committed Dec 4, 2023
1 parent 52eaed4 commit 5e6d6ce
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 53 deletions.
1 change: 0 additions & 1 deletion src/datanode/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ pub mod metrics;
pub mod region_server;
mod store;
#[cfg(test)]
#[allow(dead_code)]
mod tests;
52 changes: 0 additions & 52 deletions src/datanode/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,12 @@
// limitations under the License.

use std::any::Any;
use std::collections::HashMap;
use std::sync::Arc;

use api::v1::meta::HeartbeatResponse;
use async_trait::async_trait;
use common_error::ext::BoxedError;
use common_function::scalars::aggregate::AggregateFunctionMetaRef;
use common_function::scalars::FunctionRef;
use common_meta::heartbeat::handler::{
HeartbeatResponseHandlerContext, HeartbeatResponseHandlerExecutor,
};
use common_meta::heartbeat::mailbox::{HeartbeatMailbox, MessageMeta};
use common_meta::instruction::{Instruction, OpenRegion, RegionIdent};
use common_query::prelude::ScalarUdf;
use common_query::Output;
use common_recordbatch::SendableRecordBatchStream;
Expand All @@ -46,51 +39,6 @@ use tokio::sync::mpsc::{Receiver, Sender};
use crate::event_listener::NoopRegionServerEventListener;
use crate::region_server::RegionServer;

pub fn test_message_meta(id: u64, subject: &str, to: &str, from: &str) -> MessageMeta {
MessageMeta {
id,
subject: subject.to_string(),
to: to.to_string(),
from: from.to_string(),
}
}

async fn handle_instruction(
executor: Arc<dyn HeartbeatResponseHandlerExecutor>,
mailbox: Arc<HeartbeatMailbox>,
instruction: Instruction,
) {
let response = HeartbeatResponse::default();
let mut ctx: HeartbeatResponseHandlerContext =
HeartbeatResponseHandlerContext::new(mailbox, response);
ctx.incoming_message = Some((test_message_meta(1, "hi", "foo", "bar"), instruction));
executor.handle(ctx).await.unwrap();
}

fn close_region_instruction() -> Instruction {
Instruction::CloseRegion(RegionIdent {
table_id: 1024,
region_number: 0,
cluster_id: 1,
datanode_id: 2,
engine: "mito2".to_string(),
})
}

fn open_region_instruction() -> Instruction {
Instruction::OpenRegion(OpenRegion::new(
RegionIdent {
table_id: 1024,
region_number: 0,
cluster_id: 1,
datanode_id: 2,
engine: "mito2".to_string(),
},
"path/dir",
HashMap::new(),
))
}

pub struct MockQueryEngine;

#[async_trait]
Expand Down

0 comments on commit 5e6d6ce

Please sign in to comment.