diff --git a/table_engine/src/lib.rs b/table_engine/src/lib.rs index ac60c1e8dc..3ec6e0c384 100644 --- a/table_engine/src/lib.rs +++ b/table_engine/src/lib.rs @@ -10,6 +10,7 @@ pub mod memory; pub mod partition; pub mod predicate; pub mod provider; +pub mod remote; pub mod stream; pub mod table; diff --git a/table_engine/src/remote/mock_impl.rs b/table_engine/src/remote/mock_impl.rs new file mode 100644 index 0000000000..55bb821795 --- /dev/null +++ b/table_engine/src/remote/mock_impl.rs @@ -0,0 +1,19 @@ +// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0. + +//! Mock impl for remote table engine + +use async_trait::async_trait; +pub struct MockImpl; + +#[async_trait] +impl RemoteEngine for MockImpl { + /// Read from the remote engine + async fn read(&self, request: ReadRequest) -> Result { + todo!() + } + + /// Write to the remote engine + async fn write(&self, request: WriteRequest) -> Result { + todo!() + } +} diff --git a/table_engine/src/remote/mod.rs b/table_engine/src/remote/mod.rs new file mode 100644 index 0000000000..607d3a8ec9 --- /dev/null +++ b/table_engine/src/remote/mod.rs @@ -0,0 +1,27 @@ +// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0. + +//! Remote table engine + +pub mod model; + +use async_trait::async_trait; +use common_util::define_result; +use model::{ReadRequest, WriteRequest}; +use snafu::Snafu; + +use crate::stream::SendableRecordBatchStream; + +#[derive(Debug, Snafu)] +pub enum Error {} + +define_result!(Error); + +/// Remote table engine interface +#[async_trait] +pub trait RemoteEngine { + /// Read from the remote engine + async fn read(&self, request: ReadRequest) -> Result; + + /// Write to the remote engine + async fn write(&self, request: WriteRequest) -> Result; +} diff --git a/table_engine/src/remote/model.rs b/table_engine/src/remote/model.rs new file mode 100644 index 0000000000..9913a20e06 --- /dev/null +++ b/table_engine/src/remote/model.rs @@ -0,0 +1,24 @@ +// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0. + +//! Model for remote table engine + +use crate::table::{ReadRequest as TableReadRequest, WriteRequest as TableWriteRequest}; + +#[allow(dead_code)] +pub struct TableIdentifier { + pub catalog: String, + pub schema: String, + pub table: String, +} + +#[allow(dead_code)] +pub struct ReadRequest { + pub table: TableIdentifier, + pub table_request: TableReadRequest, +} + +#[allow(dead_code)] +pub struct WriteRequest { + pub table: TableIdentifier, + pub table_request: TableWriteRequest, +}