diff --git a/Cargo.toml b/Cargo.toml index fe89d3f6..fe3ea020 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,6 @@ tokio = { version = "1.28.2", features = ["full"] } serde = { version = "1", features = ["derive", "rc"] } serde_json = "1" bincode = "1.3.3" -async-trait = "0.1.68" integer-encoding = "3.0.4" strum_macros = "0.24" ordered-float = "3.0" diff --git a/rust-toolchain b/rust-toolchain index 3accb08b..c34ab853 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2023-09-29 \ No newline at end of file +nightly-2023-10-13 \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index ae2e8dd2..e7d9c23b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,6 +5,7 @@ #![feature(iterator_try_collect)] #![feature(slice_pattern)] #![feature(bound_map)] +#![feature(async_fn_in_trait)] extern crate core; pub mod binder; pub mod catalog; diff --git a/src/storage/kip.rs b/src/storage/kip.rs index 4be9e9f5..b6fffcec 100644 --- a/src/storage/kip.rs +++ b/src/storage/kip.rs @@ -8,7 +8,6 @@ use crate::types::errors::TypeError; use crate::types::index::{Index, IndexMeta, IndexMetaRef}; use crate::types::tuple::{Tuple, TupleId}; use crate::types::value::ValueRef; -use async_trait::async_trait; use kip_db::kernel::lsm::iterator::Iter as KipDBIter; use kip_db::kernel::lsm::mvcc::TransactionIter; use kip_db::kernel::lsm::storage::Config; @@ -37,7 +36,6 @@ impl KipStorage { } } -#[async_trait] impl Storage for KipStorage { type TransactionType = KipTransaction; @@ -56,7 +54,6 @@ pub struct KipTransaction { cache: ShardingLruCache, } -#[async_trait] impl Transaction for KipTransaction { type IterType<'a> = KipIter<'a>; diff --git a/src/storage/mod.rs b/src/storage/mod.rs index 58d37a9f..f720830a 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -8,17 +8,17 @@ use crate::storage::table_codec::TableCodec; use crate::types::errors::TypeError; use crate::types::index::{Index, IndexMetaRef}; use crate::types::tuple::{Tuple, TupleId}; -use async_trait::async_trait; use kip_db::error::CacheError; use kip_db::kernel::lsm::mvcc; use kip_db::KernelError; use std::collections::VecDeque; use std::ops::SubAssign; -#[async_trait] + pub trait Storage: Sync + Send + Clone + 'static { type TransactionType: Transaction; + #[allow(async_fn_in_trait)] async fn transaction(&self) -> Result; } @@ -26,7 +26,7 @@ pub trait Storage: Sync + Send + Clone + 'static { pub(crate) type Bounds = (Option, Option); type Projections = Vec; -#[async_trait] + pub trait Transaction: Sync + Send + 'static { type IterType<'a>: Iter; @@ -80,6 +80,7 @@ pub trait Transaction: Sync + Send + 'static { fn show_tables(&self) -> Result, StorageError>; + #[allow(async_fn_in_trait)] async fn commit(self) -> Result<(), StorageError>; }