common_meta/
node_manager.rsuse std::sync::Arc;
use api::region::RegionResponse;
use api::v1::flow::{FlowRequest, FlowResponse};
use api::v1::region::{InsertRequests, RegionRequest};
pub use common_base::AffectedRows;
use common_query::request::QueryRequest;
use common_recordbatch::SendableRecordBatchStream;
use crate::error::Result;
use crate::peer::Peer;
#[async_trait::async_trait]
pub trait Datanode: Send + Sync {
async fn handle(&self, request: RegionRequest) -> Result<RegionResponse>;
async fn handle_query(&self, request: QueryRequest) -> Result<SendableRecordBatchStream>;
}
pub type DatanodeRef = Arc<dyn Datanode>;
#[async_trait::async_trait]
pub trait Flownode: Send + Sync {
async fn handle(&self, request: FlowRequest) -> Result<FlowResponse>;
async fn handle_inserts(&self, request: InsertRequests) -> Result<FlowResponse>;
}
pub type FlownodeRef = Arc<dyn Flownode>;
#[async_trait::async_trait]
pub trait NodeManager: Send + Sync {
async fn datanode(&self, node: &Peer) -> DatanodeRef;
async fn flownode(&self, node: &Peer) -> FlownodeRef;
}
pub type NodeManagerRef = Arc<dyn NodeManager>;