diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37af8b60..5b100444 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,6 +89,28 @@ jobs: toolchain: stable - name: Run cargo machete uses: bnjbvr/cargo-machete@main + rust-cargo-tree: + name: show rust dependencies + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest, ubuntu-24.04-arm] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Install rust toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + - name: Print in-memory only foyer dependencies + run: | + cargo tree -p foyer --no-default-features -e normal + - name: Print hybrid foyer dependencies + run: | + cargo tree -p foyer -e normal + rust-udeps: name: rust udeps test strategy: @@ -205,6 +227,7 @@ jobs: - name: Run rust clippy check (stable) if: matrix.rust_toolchain == 'stable' run: | + cargo clippy -p foyer --no-default-features cargo clippy --all-targets ${{ matrix.serde }} --features tokio-console -- -D warnings cargo clippy --all-targets ${{ matrix.serde }} --features deadlock -- -D warnings cargo clippy --all-targets ${{ matrix.serde }} --features tracing -- -D warnings diff --git a/Cargo.toml b/Cargo.toml index 25ab3184..73fce5dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ edition = "2021" rust-version = "1.81.0" repository = "https://github.com/foyer-rs/foyer" homepage = "https://foyer.rs" -keywords = ["cache", "hybrid"] +keywords = ["cache", "hybrid", "tiered"] authors = ["MrCroxx "] license = "Apache-2.0" readme = "README.md" diff --git a/Makefile b/Makefile index e7a7a154..2d5b1c07 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ check-all: cargo sort -w taplo fmt cargo fmt --all + cargo clippy -p foyer --no-default-features cargo clippy --all-targets --features deadlock cargo clippy --all-targets --features tokio-console cargo clippy --all-targets --features tracing diff --git a/foyer-memory/src/raw.rs b/foyer-memory/src/raw.rs index 122dd6b8..2af7a4ad 100644 --- a/foyer-memory/src/raw.rs +++ b/foyer-memory/src/raw.rs @@ -344,9 +344,7 @@ where let (tx, rx) = oneshot::channel(); o.get_mut().push(tx); self.metrics.memory_queue.increase(1); - RawShardFetch::Wait(rx.in_span(Span::enter_with_local_parent( - "foyer::memory::raw::fetch_with_runtime::wait", - ))) + RawShardFetch::Wait(rx.in_span(Span::enter_with_local_parent("foyer::memory::raw::fetch_queue::wait"))) } HashMapEntry::Vacant(v) => { v.insert(vec![]); diff --git a/foyer/Cargo.toml b/foyer/Cargo.toml index 10f4222b..6281619d 100644 --- a/foyer/Cargo.toml +++ b/foyer/Cargo.toml @@ -22,7 +22,7 @@ equivalent = { workspace = true } fastrace = { workspace = true } foyer-common = { workspace = true } foyer-memory = { workspace = true } -foyer-storage = { workspace = true } +foyer-storage = { workspace = true, optional = true } mixtrics = { workspace = true } pin-project = { workspace = true } serde = { workspace = true } @@ -56,7 +56,8 @@ tokio = { package = "tokio", version = "1", features = [ ] } [features] -default = [] +default = ["hybrid"] +hybrid = ["dep:foyer-storage"] serde = ["foyer-common/serde", "foyer-storage/serde"] tracing = [ "fastrace/enable", diff --git a/foyer/src/lib.rs b/foyer/src/lib.rs index 0cdc7d00..e9475c9f 100644 --- a/foyer/src/lib.rs +++ b/foyer/src/lib.rs @@ -28,8 +28,10 @@ use foyer_common as common; use foyer_memory as memory; +#[cfg(feature = "hybrid")] use foyer_storage as storage; +#[cfg(feature = "hybrid")] mod hybrid; mod prelude; diff --git a/foyer/src/prelude.rs b/foyer/src/prelude.rs index 573f1f42..ea967c6b 100644 --- a/foyer/src/prelude.rs +++ b/foyer/src/prelude.rs @@ -21,15 +21,18 @@ pub use crate::{ range::RangeBoundsExt, tracing::TracingOptions, }, + memory::{ + Cache, CacheBuilder, CacheEntry, CacheHint, EvictionConfig, FetchState, FifoConfig, LfuConfig, LruConfig, + S3FifoConfig, Weighter, + }, +}; +#[cfg(feature = "hybrid")] +pub use crate::{ hybrid::{ builder::{HybridCacheBuilder, HybridCacheBuilderPhaseMemory, HybridCacheBuilderPhaseStorage}, cache::{HybridCache, HybridCacheEntry, HybridCachePolicy, HybridFetch}, writer::{HybridCacheStorageWriter, HybridCacheWriter}, }, - memory::{ - Cache, CacheBuilder, CacheEntry, CacheHint, EvictionConfig, FetchState, FifoConfig, LfuConfig, LruConfig, - S3FifoConfig, Weighter, - }, storage::{ AdmissionPicker, AdmitAllPicker, ChainedAdmissionPicker, ChainedAdmissionPickerBuilder, Compression, Dev, DevConfig, DevExt, DirectFileDevice, DirectFileDeviceOptions, DirectFsDevice, DirectFsDeviceOptions, Engine,