diff --git a/.github/template/template.yml b/.github/template/template.yml index 6b448a05..3c3ffc11 100644 --- a/.github/template/template.yml +++ b/.github/template/template.yml @@ -3,9 +3,10 @@ name: on: env: - RUST_TOOLCHAIN: nightly-2023-12-26 + RUST_TOOLCHAIN: stable + RUST_TOOLCHAIN_NIGHTLY: nightly-2024-03-17 CARGO_TERM_COLOR: always - CACHE_KEY_SUFFIX: 20240306 + CACHE_KEY_SUFFIX: 20240410-2 jobs: misc-check: @@ -132,7 +133,7 @@ jobs: - name: Install rust toolchain@v1 uses: actions-rs/toolchain@v1 with: - toolchain: ${{ env.RUST_TOOLCHAIN }} + toolchain: ${{ env.RUST_TOOLCHAIN_NIGHTLY }} - name: Cache Cargo home uses: actions/cache@v2 id: cache @@ -149,14 +150,14 @@ jobs: RUSTFLAGS: "-Zsanitizer=address --cfg tokio_unstable" RUST_LOG: info run: |- - cargo test --lib --bins --tests --target x86_64-unknown-linux-gnu -- --nocapture + cargo +${{ env.RUST_TOOLCHAIN_NIGHTLY }} test --lib --bins --tests --target x86_64-unknown-linux-gnu -- --nocapture - name: Run foyer-storage-bench With Address Sanitizer env: RUST_BACKTRACE: 1 RUSTFLAGS: "-Zsanitizer=address --cfg tokio_unstable" RUST_LOG: info run: |- - cargo build --all --target x86_64-unknown-linux-gnu + cargo +${{ env.RUST_TOOLCHAIN_NIGHTLY }} build --all --target x86_64-unknown-linux-gnu mkdir -p $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/asan timeout 2m ./target/x86_64-unknown-linux-gnu/debug/foyer-storage-bench --dir $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/asan --capacity 256 --region-size 16 --lookup-range 1000 --w-rate 1 --r-rate 1 --ticket-insert-rate-limit 10 --time 60 lsan: @@ -168,7 +169,7 @@ jobs: - name: Install rust toolchain@v1 uses: actions-rs/toolchain@v1 with: - toolchain: ${{ env.RUST_TOOLCHAIN }} + toolchain: ${{ env.RUST_TOOLCHAIN_NIGHTLY }} - name: Cache Cargo home uses: actions/cache@v2 id: cache @@ -185,14 +186,14 @@ jobs: RUSTFLAGS: "-Zsanitizer=leak --cfg tokio_unstable" RUST_LOG: info run: |- - cargo test --lib --bins --tests --target x86_64-unknown-linux-gnu -- --nocapture + cargo +${{ env.RUST_TOOLCHAIN_NIGHTLY }} test --lib --bins --tests --target x86_64-unknown-linux-gnu -- --nocapture - name: Run foyer-storage-bench With Leak Sanitizer env: RUST_BACKTRACE: 1 RUSTFLAGS: "-Zsanitizer=leak --cfg tokio_unstable" RUST_LOG: info run: |- - cargo build --all --target x86_64-unknown-linux-gnu + cargo +${{ env.RUST_TOOLCHAIN_NIGHTLY }} build --all --target x86_64-unknown-linux-gnu mkdir -p $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/lsan timeout 2m ./target/x86_64-unknown-linux-gnu/debug/foyer-storage-bench --dir $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/lsan --capacity 256 --region-size 16 --lookup-range 1000 --w-rate 1 --r-rate 1 --ticket-insert-rate-limit 10 --time 60 deterministic-test: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a80dcb10..be6d379a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,9 +11,10 @@ on: branches: [main] workflow_dispatch: env: - RUST_TOOLCHAIN: nightly-2023-12-26 + RUST_TOOLCHAIN: stable + RUST_TOOLCHAIN_NIGHTLY: nightly-2024-03-17 CARGO_TERM_COLOR: always - CACHE_KEY_SUFFIX: 20240306 + CACHE_KEY_SUFFIX: 20240410-2 jobs: misc-check: name: misc check @@ -139,7 +140,7 @@ jobs: - name: Install rust toolchain@v1 uses: actions-rs/toolchain@v1 with: - toolchain: ${{ env.RUST_TOOLCHAIN }} + toolchain: ${{ env.RUST_TOOLCHAIN_NIGHTLY }} - name: Cache Cargo home uses: actions/cache@v2 id: cache @@ -156,14 +157,14 @@ jobs: RUSTFLAGS: "-Zsanitizer=address --cfg tokio_unstable" RUST_LOG: info run: |- - cargo test --lib --bins --tests --target x86_64-unknown-linux-gnu -- --nocapture + cargo +${{ env.RUST_TOOLCHAIN_NIGHTLY }} test --lib --bins --tests --target x86_64-unknown-linux-gnu -- --nocapture - name: Run foyer-storage-bench With Address Sanitizer env: RUST_BACKTRACE: 1 RUSTFLAGS: "-Zsanitizer=address --cfg tokio_unstable" RUST_LOG: info run: |- - cargo build --all --target x86_64-unknown-linux-gnu + cargo +${{ env.RUST_TOOLCHAIN_NIGHTLY }} build --all --target x86_64-unknown-linux-gnu mkdir -p $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/asan timeout 2m ./target/x86_64-unknown-linux-gnu/debug/foyer-storage-bench --dir $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/asan --capacity 256 --region-size 16 --lookup-range 1000 --w-rate 1 --r-rate 1 --ticket-insert-rate-limit 10 --time 60 lsan: @@ -175,7 +176,7 @@ jobs: - name: Install rust toolchain@v1 uses: actions-rs/toolchain@v1 with: - toolchain: ${{ env.RUST_TOOLCHAIN }} + toolchain: ${{ env.RUST_TOOLCHAIN_NIGHTLY }} - name: Cache Cargo home uses: actions/cache@v2 id: cache @@ -192,14 +193,14 @@ jobs: RUSTFLAGS: "-Zsanitizer=leak --cfg tokio_unstable" RUST_LOG: info run: |- - cargo test --lib --bins --tests --target x86_64-unknown-linux-gnu -- --nocapture + cargo +${{ env.RUST_TOOLCHAIN_NIGHTLY }} test --lib --bins --tests --target x86_64-unknown-linux-gnu -- --nocapture - name: Run foyer-storage-bench With Leak Sanitizer env: RUST_BACKTRACE: 1 RUSTFLAGS: "-Zsanitizer=leak --cfg tokio_unstable" RUST_LOG: info run: |- - cargo build --all --target x86_64-unknown-linux-gnu + cargo +${{ env.RUST_TOOLCHAIN_NIGHTLY }} build --all --target x86_64-unknown-linux-gnu mkdir -p $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/lsan timeout 2m ./target/x86_64-unknown-linux-gnu/debug/foyer-storage-bench --dir $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/lsan --capacity 256 --region-size 16 --lookup-range 1000 --w-rate 1 --r-rate 1 --ticket-insert-rate-limit 10 --time 60 deterministic-test: diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 75518119..0133faa8 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -10,9 +10,10 @@ on: pull_request: branches: [main] env: - RUST_TOOLCHAIN: nightly-2023-12-26 + RUST_TOOLCHAIN: stable + RUST_TOOLCHAIN_NIGHTLY: nightly-2024-03-17 CARGO_TERM_COLOR: always - CACHE_KEY_SUFFIX: 20240306 + CACHE_KEY_SUFFIX: 20240410-2 jobs: misc-check: name: misc check @@ -138,7 +139,7 @@ jobs: - name: Install rust toolchain@v1 uses: actions-rs/toolchain@v1 with: - toolchain: ${{ env.RUST_TOOLCHAIN }} + toolchain: ${{ env.RUST_TOOLCHAIN_NIGHTLY }} - name: Cache Cargo home uses: actions/cache@v2 id: cache @@ -155,14 +156,14 @@ jobs: RUSTFLAGS: "-Zsanitizer=address --cfg tokio_unstable" RUST_LOG: info run: |- - cargo test --lib --bins --tests --target x86_64-unknown-linux-gnu -- --nocapture + cargo +${{ env.RUST_TOOLCHAIN_NIGHTLY }} test --lib --bins --tests --target x86_64-unknown-linux-gnu -- --nocapture - name: Run foyer-storage-bench With Address Sanitizer env: RUST_BACKTRACE: 1 RUSTFLAGS: "-Zsanitizer=address --cfg tokio_unstable" RUST_LOG: info run: |- - cargo build --all --target x86_64-unknown-linux-gnu + cargo +${{ env.RUST_TOOLCHAIN_NIGHTLY }} build --all --target x86_64-unknown-linux-gnu mkdir -p $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/asan timeout 2m ./target/x86_64-unknown-linux-gnu/debug/foyer-storage-bench --dir $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/asan --capacity 256 --region-size 16 --lookup-range 1000 --w-rate 1 --r-rate 1 --ticket-insert-rate-limit 10 --time 60 lsan: @@ -174,7 +175,7 @@ jobs: - name: Install rust toolchain@v1 uses: actions-rs/toolchain@v1 with: - toolchain: ${{ env.RUST_TOOLCHAIN }} + toolchain: ${{ env.RUST_TOOLCHAIN_NIGHTLY }} - name: Cache Cargo home uses: actions/cache@v2 id: cache @@ -191,14 +192,14 @@ jobs: RUSTFLAGS: "-Zsanitizer=leak --cfg tokio_unstable" RUST_LOG: info run: |- - cargo test --lib --bins --tests --target x86_64-unknown-linux-gnu -- --nocapture + cargo +${{ env.RUST_TOOLCHAIN_NIGHTLY }} test --lib --bins --tests --target x86_64-unknown-linux-gnu -- --nocapture - name: Run foyer-storage-bench With Leak Sanitizer env: RUST_BACKTRACE: 1 RUSTFLAGS: "-Zsanitizer=leak --cfg tokio_unstable" RUST_LOG: info run: |- - cargo build --all --target x86_64-unknown-linux-gnu + cargo +${{ env.RUST_TOOLCHAIN_NIGHTLY }} build --all --target x86_64-unknown-linux-gnu mkdir -p $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/lsan timeout 2m ./target/x86_64-unknown-linux-gnu/debug/foyer-storage-bench --dir $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/lsan --capacity 256 --region-size 16 --lookup-range 1000 --w-rate 1 --r-rate 1 --ticket-insert-rate-limit 10 --time 60 deterministic-test: diff --git a/Makefile b/Makefile index fd9cfa87..72c61773 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,8 @@ check: cargo sort -w cargo fmt --all cargo clippy --all-targets - cargo udeps --workspace --exclude foyer-workspace-hack + # TODO(MrCroxx): Restore udeps check after it doesn't requires nightly anymore. + # cargo udeps --workspace --exclude foyer-workspace-hack check-all: shellcheck ./scripts/* @@ -28,7 +29,8 @@ check-all: cargo clippy --all-targets --features tokio-console cargo clippy --all-targets --features trace cargo clippy --all-targets - cargo udeps --workspace --exclude foyer-workspace-hack + # TODO(MrCroxx): Restore udeps check after it doesn't requires nightly anymore. + # cargo udeps --workspace --exclude foyer-workspace-hack test: RUST_BACKTRACE=1 cargo nextest run --all diff --git a/foyer-common/src/lib.rs b/foyer-common/src/lib.rs index 735c635e..adb30f00 100644 --- a/foyer-common/src/lib.rs +++ b/foyer-common/src/lib.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(bound_map)] #![cfg_attr(coverage_nightly, feature(coverage_attribute))] pub mod async_queue; diff --git a/foyer-experimental/src/wal.rs b/foyer-experimental/src/wal.rs index 0d63b4e4..c5df56d6 100644 --- a/foyer-experimental/src/wal.rs +++ b/foyer-experimental/src/wal.rs @@ -143,7 +143,12 @@ impl TombstoneLog { path.push(format!("tombstone-{:08X}", config.id)); - let file = OpenOptions::new().write(true).read(true).create(true).open(path)?; + let file = OpenOptions::new() + .write(true) + .read(true) + .create(true) + .truncate(true) + .open(path)?; let inner = Arc::new(TombstoneLogInner { inflights: Mutex::new(vec![]), diff --git a/foyer-intrusive/src/core/adapter.rs b/foyer-intrusive/src/core/adapter.rs index 3f98d74e..eb09afbd 100644 --- a/foyer-intrusive/src/core/adapter.rs +++ b/foyer-intrusive/src/core/adapter.rs @@ -117,8 +117,6 @@ pub unsafe trait PriorityAdapter: Adapter { /// # Examples /// /// ``` -/// #![feature(offset_of)] -/// /// use foyer_intrusive::{intrusive_adapter, key_adapter}; /// use foyer_intrusive::core::adapter::{Adapter, KeyAdapter, Link}; /// use foyer_intrusive::core::pointer::Pointer; @@ -215,8 +213,6 @@ macro_rules! intrusive_adapter { /// # Examples /// /// ``` -/// #![feature(offset_of)] -/// /// use foyer_intrusive::{intrusive_adapter, key_adapter}; /// use foyer_intrusive::core::adapter::{Adapter, KeyAdapter, Link}; /// use foyer_intrusive::core::pointer::Pointer; @@ -286,8 +282,6 @@ macro_rules! key_adapter { /// # Examples /// /// ``` -/// #![feature(offset_of)] -/// /// use foyer_intrusive::{intrusive_adapter, priority_adapter}; /// use foyer_intrusive::core::adapter::{Adapter, PriorityAdapter, Link}; /// use foyer_intrusive::core::pointer::Pointer; diff --git a/foyer-intrusive/src/lib.rs b/foyer-intrusive/src/lib.rs index 038d1c2c..5fde39b0 100644 --- a/foyer-intrusive/src/lib.rs +++ b/foyer-intrusive/src/lib.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(offset_of)] // TODO(MrCroxx): use `expect` after `lint_reasons` is stable. #![allow(clippy::new_without_default)] @@ -24,8 +23,6 @@ pub use memoffset::offset_of; /// # Examples /// /// ``` -/// #![feature(offset_of)] -/// /// use foyer_intrusive::container_of; /// /// struct S { x: u32, y: u32 }; diff --git a/foyer-memory/src/lib.rs b/foyer-memory/src/lib.rs index 3b92ad5a..fe0e8ae6 100644 --- a/foyer-memory/src/lib.rs +++ b/foyer-memory/src/lib.rs @@ -62,8 +62,6 @@ //! The handle that does not appear in either the indexer or the eviction container, and has no external owner, will be //! destroyed. -#![feature(offset_of)] - pub trait Key: Send + Sync + 'static + std::hash::Hash + Eq + Ord {} pub trait Value: Send + Sync + 'static {} diff --git a/foyer-storage/Cargo.toml b/foyer-storage/Cargo.toml index 4aa1bb87..d15e0a33 100644 --- a/foyer-storage/Cargo.toml +++ b/foyer-storage/Cargo.toml @@ -13,6 +13,7 @@ homepage = "https://github.com/mrcroxx/foyer" normal = ["foyer-workspace-hack"] [dependencies] +allocator-api2 = "0.2" # TODO(MrCroxx): Remove this after `allocator_api` is stable. anyhow = "1.0" bitflags = "2.3.1" bitmaps = "3.2" diff --git a/foyer-storage/src/buffer.rs b/foyer-storage/src/buffer.rs index 0f600b65..5f5f2fe1 100644 --- a/foyer-storage/src/buffer.rs +++ b/foyer-storage/src/buffer.rs @@ -14,6 +14,7 @@ use std::fmt::Debug; +use allocator_api2::vec::Vec as VecA; use foyer_common::{ bits::{align_up, is_aligned}, code::{Cursor, Key, Value}, @@ -21,7 +22,7 @@ use foyer_common::{ use crate::{ compress::Compression, - device::{error::DeviceError, Device}, + device::{allocator::WritableVecA, error::DeviceError, Device}, flusher::Entry, generic::{checksum, EntryHeader}, region::{RegionHeader, RegionId, Version, REGION_MAGIC}, @@ -63,7 +64,7 @@ where { // TODO(MrCroxx): optimize buffer allocation /// io buffer - buffer: Vec, + buffer: VecA, /// current writing region region: Option, @@ -227,15 +228,17 @@ where let mut vcursor = value.into_cursor(); match compression { Compression::None => { - std::io::copy(&mut vcursor, &mut self.buffer).map_err(DeviceError::from)?; + std::io::copy(&mut vcursor, &mut WritableVecA(&mut self.buffer)).map_err(DeviceError::from)?; } Compression::Zstd => { - zstd::stream::copy_encode(&mut vcursor, &mut self.buffer, 0).map_err(DeviceError::from)?; + zstd::stream::copy_encode(&mut vcursor, &mut WritableVecA(&mut self.buffer), 0) + .map_err(DeviceError::from)?; } Compression::Lz4 => { + let buf = &mut WritableVecA(&mut self.buffer); let mut encoder = lz4::EncoderBuilder::new() .checksum(lz4::ContentChecksum::NoChecksum) - .build(&mut self.buffer) + .build(buf) .map_err(DeviceError::from)?; std::io::copy(&mut vcursor, &mut encoder).map_err(DeviceError::from)?; let (_w, res) = encoder.finish(); @@ -247,7 +250,7 @@ where // write key let mut kcursor = key.into_cursor(); - std::io::copy(&mut kcursor, &mut self.buffer).map_err(DeviceError::from)?; + std::io::copy(&mut kcursor, &mut WritableVecA(&mut self.buffer)).map_err(DeviceError::from)?; let encoded_key_len = self.buffer.len() - cursor; cursor = self.buffer.len(); diff --git a/foyer-storage/src/device/allocator.rs b/foyer-storage/src/device/allocator.rs index 3919334c..81091f23 100644 --- a/foyer-storage/src/device/allocator.rs +++ b/foyer-storage/src/device/allocator.rs @@ -12,10 +12,48 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::alloc::{Allocator, Global}; - +use allocator_api2::{ + alloc::{AllocError, Allocator, Global}, + vec::Vec as VecA, +}; use foyer_common::bits; +pub struct WritableVecA<'a, T, A: Allocator>(pub &'a mut VecA); + +impl<'a, A: Allocator> std::io::Write for WritableVecA<'a, u8, A> { + #[inline] + fn write(&mut self, buf: &[u8]) -> std::io::Result { + self.0.extend_from_slice(buf); + Ok(buf.len()) + } + + #[inline] + fn write_vectored(&mut self, bufs: &[std::io::IoSlice<'_>]) -> std::io::Result { + let len = bufs.iter().map(|b| b.len()).sum(); + self.0.reserve(len); + for buf in bufs { + self.0.extend_from_slice(buf); + } + Ok(len) + } + + // #[inline] + // fn is_write_vectored(&self) -> bool { + // true + // } + + #[inline] + fn write_all(&mut self, buf: &[u8]) -> std::io::Result<()> { + self.0.extend_from_slice(buf); + Ok(()) + } + + #[inline] + fn flush(&mut self) -> std::io::Result<()> { + Ok(()) + } +} + #[derive(Debug, Clone, Copy)] pub struct AlignedAllocator { align: usize, @@ -29,7 +67,7 @@ impl AlignedAllocator { } unsafe impl Allocator for AlignedAllocator { - fn allocate(&self, layout: std::alloc::Layout) -> Result, std::alloc::AllocError> { + fn allocate(&self, layout: std::alloc::Layout) -> Result, AllocError> { let layout = std::alloc::Layout::from_size_align(layout.size(), bits::align_up(self.align, layout.align())).unwrap(); Global.allocate(layout) @@ -51,7 +89,7 @@ mod tests { const ALIGN: usize = 512; let allocator = AlignedAllocator::new(ALIGN); - let mut buf: Vec = Vec::with_capacity_in(ALIGN * 8, &allocator); + let mut buf: VecA = VecA::with_capacity_in(ALIGN * 8, &allocator); bits::assert_aligned(ALIGN, buf.as_ptr() as _); buf.extend_from_slice(&[b'x'; ALIGN * 8]); diff --git a/foyer-storage/src/device/fs.rs b/foyer-storage/src/device/fs.rs index d7ba50d2..b03fbc12 100644 --- a/foyer-storage/src/device/fs.rs +++ b/foyer-storage/src/device/fs.rs @@ -19,6 +19,7 @@ use std::{ sync::Arc, }; +use allocator_api2::vec::Vec as VecA; use foyer_common::range::RangeBoundsExt; use futures::future::try_join_all; use itertools::Itertools; @@ -172,9 +173,9 @@ impl Device for FsDevice { &self.inner.io_buffer_allocator } - fn io_buffer(&self, len: usize, capacity: usize) -> Vec { + fn io_buffer(&self, len: usize, capacity: usize) -> VecA { assert!(len <= capacity); - let mut buf = Vec::with_capacity_in(capacity, self.inner.io_buffer_allocator); + let mut buf = VecA::with_capacity_in(capacity, self.inner.io_buffer_allocator); unsafe { buf.set_len(len) }; buf } diff --git a/foyer-storage/src/device/mod.rs b/foyer-storage/src/device/mod.rs index 1cae8ba6..2e35ccfc 100644 --- a/foyer-storage/src/device/mod.rs +++ b/foyer-storage/src/device/mod.rs @@ -16,8 +16,9 @@ pub mod allocator; pub mod error; pub mod fs; -use std::{alloc::Allocator, fmt::Debug}; +use std::fmt::Debug; +use allocator_api2::{alloc::Allocator, vec::Vec as VecA}; use error::DeviceResult; use foyer_common::range::RangeBoundsExt; use futures::Future; @@ -84,7 +85,7 @@ pub trait Device: Sized + Clone + Send + Sync + 'static + Debug { fn io_buffer_allocator(&self) -> &Self::IoBufferAllocator; - fn io_buffer(&self, len: usize, capacity: usize) -> Vec; + fn io_buffer(&self, len: usize, capacity: usize) -> VecA; fn region_size(&self) -> usize { debug_assert!(self.capacity() % self.regions() == 0); @@ -98,7 +99,7 @@ pub trait DeviceExt: Device { &self, region: RegionId, range: impl IoRange, - ) -> impl Future>> + Send { + ) -> impl Future>> + Send { async move { let range = range.bounds(0..self.region_size()); let size = range.size().unwrap(); @@ -218,8 +219,8 @@ pub mod tests { &self.0 } - fn io_buffer(&self, len: usize, capacity: usize) -> Vec { - let mut buf = Vec::with_capacity_in(capacity, self.0); + fn io_buffer(&self, len: usize, capacity: usize) -> VecA { + let mut buf = VecA::with_capacity_in(capacity, self.0); unsafe { buf.set_len(len) }; buf } diff --git a/foyer-storage/src/lib.rs b/foyer-storage/src/lib.rs index eadf2d09..3c54019b 100644 --- a/foyer-storage/src/lib.rs +++ b/foyer-storage/src/lib.rs @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(allocator_api)] -#![feature(offset_of)] - pub mod admission; pub mod buffer; pub mod catalog; diff --git a/foyer-storage/src/region.rs b/foyer-storage/src/region.rs index 4280d395..ef98e1d2 100644 --- a/foyer-storage/src/region.rs +++ b/foyer-storage/src/region.rs @@ -22,6 +22,7 @@ use std::{ }, }; +use allocator_api2::vec::Vec as VecA; use bytes::{Buf, BufMut}; use foyer_common::range::RangeBoundsExt; use parking_lot::Mutex; @@ -107,7 +108,7 @@ where { // TODO(MrCroxx): use `expect` after `lint_reasons` is stable. #[allow(clippy::type_complexity)] - waits: BTreeMap<(usize, usize), Vec>>>>>, + waits: BTreeMap<(usize, usize), Vec>>>>>, } #[derive(Debug, Clone)] @@ -156,7 +157,7 @@ where // TODO(MrCroxx): use `expect` after `lint_reasons` is stable. #[allow(clippy::type_complexity)] #[tracing::instrument(skip(self, view))] - pub async fn load(&self, view: RegionView) -> Result>>> { + pub async fn load(&self, view: RegionView) -> Result>>> { let res = self .load_range(view.offset as usize..view.offset as usize + view.len as usize) .await; @@ -172,7 +173,7 @@ where pub async fn load_range( &self, range: impl RangeBounds, - ) -> Result>>> { + ) -> Result>>> { let range = range.bounds(0..self.device.region_size()); let rx = { diff --git a/foyer-workspace-hack/Cargo.toml b/foyer-workspace-hack/Cargo.toml index 153f7282..d18a747c 100644 --- a/foyer-workspace-hack/Cargo.toml +++ b/foyer-workspace-hack/Cargo.toml @@ -18,6 +18,7 @@ publish = true ### BEGIN HAKARI SECTION [dependencies] ahash = { version = "0.8" } +allocator-api2 = { version = "0.2" } crossbeam-channel = { version = "0.5" } crossbeam-epoch = { version = "0.9" } crossbeam-utils = { version = "0.8" } diff --git a/rust-toolchain b/rust-toolchain deleted file mode 100644 index ef0ed508..00000000 --- a/rust-toolchain +++ /dev/null @@ -1,2 +0,0 @@ -[toolchain] -channel = "nightly-2023-12-26" \ No newline at end of file diff --git a/rustfmt.toml b/rustfmt.toml index d9905931..16bafd46 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,6 +1,8 @@ -imports_granularity = "Crate" -group_imports = "StdExternalCrate" +# TODO(MrCroxx): Restore comments after the features are stable. + +# imports_granularity = "Crate" +# group_imports = "StdExternalCrate" tab_spaces = 4 -wrap_comments = true +# wrap_comments = true max_width = 120 -comment_width = 120 \ No newline at end of file +# comment_width = 120