From ca621a264dead7b9074cb669f2d9f5aa737a0a9f Mon Sep 17 00:00:00 2001 From: Ruediger Klaehn Date: Thu, 14 Jul 2022 11:55:53 +0200 Subject: [PATCH 1/3] switch to radixdb store --- Cargo.lock | 212 +++++++++++++++++++++++++++++++---------------------- Cargo.toml | 2 +- src/db.rs | 55 ++++---------- src/lib.rs | 2 +- 4 files changed, 139 insertions(+), 132 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c25a6b8..26fda1d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -471,6 +471,28 @@ dependencies = [ "digest 0.10.3", ] +[[package]] +name = "blake2b_simd" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587" +dependencies = [ + "arrayref", + "arrayvec", + "constant_time_eq", +] + +[[package]] +name = "blake2s_simd" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e461a7034e85b211a4acb57ee2e6730b32912b06c08cc242243c39fc21ae6a2" +dependencies = [ + "arrayref", + "arrayvec", + "constant_time_eq", +] + [[package]] name = "blake3" version = "0.3.8" @@ -728,12 +750,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - [[package]] name = "cookie" version = "0.14.4" @@ -927,19 +943,6 @@ dependencies = [ "syn", ] -[[package]] -name = "derive_more" -version = "0.99.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" -dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "rustc_version 0.4.0", - "syn", -] - [[package]] name = "difflib" version = "0.4.0" @@ -1035,6 +1038,19 @@ dependencies = [ "syn", ] +[[package]] +name = "env_logger" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + [[package]] name = "escargot" version = "0.5.7" @@ -1053,18 +1069,6 @@ version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71" -[[package]] -name = "fallible-iterator" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" - -[[package]] -name = "fallible-streaming-iterator" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" - [[package]] name = "fastrand" version = "1.7.0" @@ -1348,15 +1352,6 @@ dependencies = [ "ahash", ] -[[package]] -name = "hashlink" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7249a3129cbc1ffccd74857f81464a323a152173cdb134e0fd81bc803b29facf" -dependencies = [ - "hashbrown 0.11.2", -] - [[package]] name = "heck" version = "0.3.3" @@ -1475,6 +1470,12 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9100414882e15fb7feccb4897e5f0ff0ff1ca7d1a86a23208ada4d7a18e6c6c4" +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "idna" version = "0.2.3" @@ -1530,6 +1531,12 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64e9829a50b42bb782c1df523f78d332fe371b10c661e78b7a3c34b0198e9fac" +[[package]] +name = "inplace-vec-builder" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf64c2edc8226891a71f127587a2861b132d2b942310843814d5001d99a1d307" + [[package]] name = "instant" version = "0.1.12" @@ -1571,7 +1578,7 @@ dependencies = [ "fnv", "futures", "futures-timer", - "ipfs-sqlite-block-store", + "ipfs-radixdb-block-store", "lazy_static", "libipld", "libp2p", @@ -1614,20 +1621,23 @@ dependencies = [ ] [[package]] -name = "ipfs-sqlite-block-store" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "025ff3ea1adb63aed8cb6cebd3a7fcf992847c6ce7604b2c07823d6bbc1f1a77" +name = "ipfs-radixdb-block-store" +version = "0.1.0" dependencies = [ "anyhow", - "derive_more", + "env_logger", "fnv", - "futures", - "itertools 0.10.3", + "hex", "libipld", - "parking_lot 0.11.2", - "rusqlite", - "tracing", + "log", + "maplit", + "num-traits", + "parking_lot 0.12.0", + "radixdb", + "ref-cast", + "sha2 0.10.2", + "smallvec", + "tempfile", ] [[package]] @@ -1708,6 +1718,7 @@ dependencies = [ "libipld-cbor", "libipld-cbor-derive", "libipld-core", + "libipld-json", "libipld-macro", "libipld-pb", "log", @@ -1752,6 +1763,19 @@ dependencies = [ "thiserror", ] +[[package]] +name = "libipld-json" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cf3a6d0e65a5b3f48774f99951d063bc28f7fd799be0a3891de4b10939434e3" +dependencies = [ + "base64 0.13.0", + "libipld-core", + "multihash 0.14.0", + "serde", + "serde_json", +] + [[package]] name = "libipld-macro" version = "0.12.0" @@ -2175,17 +2199,6 @@ dependencies = [ "syn", ] -[[package]] -name = "libsqlite3-sys" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cafc7c74096c336d9d27145f7ebd4f4b6f95ba16aa5a282387267e6925cb58" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - [[package]] name = "linked-hash-map" version = "0.5.4" @@ -2262,6 +2275,16 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +[[package]] +name = "memmap" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "memoffset" version = "0.6.5" @@ -2329,9 +2352,14 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "752a61cd890ff691b4411423d23816d5866dd5621e4d1c5687a53b94b5a979d8" dependencies = [ + "blake2b_simd", + "blake2s_simd", "blake3", + "digest 0.9.0", "generic-array", "multihash-derive 0.7.2", + "sha2 0.9.9", + "sha3", "unsigned-varint", ] @@ -2780,12 +2808,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pkg-config" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" - [[package]] name = "polling" version = "2.2.0" @@ -3081,6 +3103,19 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radixdb" +version = "0.1.0" +dependencies = [ + "anyhow", + "fnv", + "hex", + "inplace-vec-builder", + "memmap", + "parking_lot 0.12.0", + "smallvec", +] + [[package]] name = "rand" version = "0.4.6" @@ -3198,6 +3233,26 @@ dependencies = [ "bitflags", ] +[[package]] +name = "ref-cast" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685d58625b6c2b83e4cc88a27c4bf65adb7b6b16dbdc413e515c9405b47432ab" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a043824e29c94169374ac5183ac0ed43f5724dc4556b19568007486bd840fa1f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "regex" version = "1.5.5" @@ -3279,21 +3334,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "rusqlite" -version = "0.26.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ba4d3462c8b2e4d7f4fcfcf2b296dc6b65404fbbc7b63daa37fd485c149daf7" -dependencies = [ - "bitflags", - "fallible-iterator", - "fallible-streaming-iterator", - "hashlink", - "libsqlite3-sys", - "memchr", - "smallvec", -] - [[package]] name = "rustc_version" version = "0.2.3" @@ -4142,12 +4182,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "vec_map" version = "0.8.2" diff --git a/Cargo.toml b/Cargo.toml index 1acf9f0..31fa08d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,6 @@ chrono = "0.4.19" fnv = "1.0.7" futures = "0.3.21" futures-timer = "3.0.2" -ipfs-sqlite-block-store = "0.12.0" lazy_static = "1.4.0" libipld = { version = "0.12.0", default-features = false } libp2p-bitswap = "0.22.0" @@ -44,6 +43,7 @@ tokio-crate = { package = "tokio", version = "1.17.0", features = ["rt"], option tracing = "0.1.32" trust-dns-resolver = "0.20" void = "1.0.2" +ipfs-radixdb-block-store = { path = "../ipfs-radixdb-block-store" } [dependencies.libp2p] version = "0.43.0" diff --git a/src/db.rs b/src/db.rs index ea6542b..b65d985 100644 --- a/src/db.rs +++ b/src/db.rs @@ -1,8 +1,10 @@ -pub use ipfs_sqlite_block_store::TempPin; -use ipfs_sqlite_block_store::{ - cache::{CacheTracker, InMemCacheTracker, SqliteCacheTracker}, - BlockStore, Config, Synchronous, -}; +// pub use ipfs_sqlite_block_store::TempPin; +// use ipfs_sqlite_block_store::{ +// cache::{CacheTracker, InMemCacheTracker, SqliteCacheTracker}, +// BlockStore, Config, Synchronous, +// }; +pub use ipfs_radixdb_block_store::TempPin; +use ipfs_radixdb_block_store::BlockStore as BlockStore; use lazy_static::lazy_static; use libipld::{codec::References, store::StoreParams, Block, Cid, Ipld, Result}; use parking_lot::Mutex; @@ -15,7 +17,6 @@ use std::{future::Future, path::PathBuf, sync::Arc, time::Duration}; use tracing::info; use crate::executor::{Executor, JoinHandle}; -use std::collections::HashSet; /// Storage configuration. #[derive(Clone, Debug, Eq, PartialEq)] @@ -126,33 +127,19 @@ where Ipld: References, { pub fn open(config: StorageConfig, executor: Executor) -> Result { - let store_config = Config::default() - .with_size_targets(config.cache_size_blocks, config.cache_size_bytes) - .with_pragma_synchronous(Synchronous::Normal); - let tracker: Arc = if let Some(path) = config.access_db_path { - let path = if path.is_file() { - path - } else { - std::fs::create_dir_all(&path)?; - path.join("access") - }; - Arc::new(SqliteCacheTracker::open(&path, |access, _| Some(access))?) - } else { - Arc::new(InMemCacheTracker::new(|access, _| Some(access))) - }; let is_memory = config.path.is_none(); // create DB connection - let store = if let Some(path) = config.path { + let store: BlockStore = if let Some(path) = config.path { let path = if path.is_file() { path } else { std::fs::create_dir_all(&path)?; path.join("db") }; - BlockStore::open(path, store_config.with_cache_tracker(tracker))? + todo!() } else { - BlockStore::memory(store_config.with_cache_tracker(tracker))? + todo!() }; let store = Arc::new(Mutex::new(store)); @@ -160,7 +147,7 @@ where let gc_interval = config.gc_interval; let gc_min_blocks = config.gc_min_blocks; let gc_target_duration = config.gc_target_duration; - let gc_task = if is_memory { + let gc_task = { let gc = store.clone(); executor.spawn(async move { loop { @@ -175,20 +162,6 @@ where .ok(); } }) - } else { - let mut gc = store.lock().additional_connection()?; - executor.spawn(async move { - loop { - futures_timer::Delay::new(gc_interval).await; - info!("going for gc!"); - gc.incremental_gc(gc_min_blocks, gc_target_duration) - .map_err(|e| { - tracing::warn!("failure during incremental gc: {:#}", e); - e - }) - .ok(); - } - }) }; Ok(Self { executor, @@ -267,7 +240,7 @@ where self.rw("resolve", |x| x.resolve(alias)) } - pub fn reverse_alias(&self, cid: &Cid) -> Result>>> { + pub fn reverse_alias(&self, cid: &Cid) -> Result>>> { self.rw("reverse_alias", |x| x.reverse_alias(cid)) } @@ -396,7 +369,7 @@ impl SqliteStoreCollector { } /// A handle for performing batch operations on an ipfs storage -pub struct Batch<'a, S>(ipfs_sqlite_block_store::Transaction<'a, S>); +pub struct Batch<'a, S>(ipfs_radixdb_block_store::Transaction<'a, S>); impl<'a, S: StoreParams> Batch<'a, S> where @@ -447,7 +420,7 @@ where Ok(self.0.aliases()?) } - pub fn reverse_alias(&mut self, cid: &Cid) -> Result>>> { + pub fn reverse_alias(&mut self, cid: &Cid) -> Result>>> { Ok(self.0.reverse_alias(cid)?) } diff --git a/src/lib.rs b/src/lib.rs index 0c287b5..014e30c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -398,7 +398,7 @@ where /// Returns a list of aliases preventing a `Cid` from being garbage /// collected. - pub fn reverse_alias(&self, cid: &Cid) -> Result>>> { + pub fn reverse_alias(&self, cid: &Cid) -> Result>>> { self.storage.reverse_alias(cid) } From 289ce5f7d71f44324c016bf20010c83a11303dd3 Mon Sep 17 00:00:00 2001 From: Ruediger Klaehn Date: Thu, 14 Jul 2022 13:33:45 +0200 Subject: [PATCH 2/3] WIP --- Cargo.lock | 1 + Cargo.toml | 1 + src/db.rs | 11 ++++++----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 26fda1d..f5c5c8b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1589,6 +1589,7 @@ dependencies = [ "parking_lot 0.11.2", "pin-project 1.0.10", "prometheus", + "radixdb", "rand 0.8.5", "regex", "tempdir", diff --git a/Cargo.toml b/Cargo.toml index 31fa08d..28cbcb4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,6 +44,7 @@ tracing = "0.1.32" trust-dns-resolver = "0.20" void = "1.0.2" ipfs-radixdb-block-store = { path = "../ipfs-radixdb-block-store" } +radixdb = { path = "../radixdb" } [dependencies.libp2p] version = "0.43.0" diff --git a/src/db.rs b/src/db.rs index b65d985..1a13748 100644 --- a/src/db.rs +++ b/src/db.rs @@ -3,8 +3,8 @@ // cache::{CacheTracker, InMemCacheTracker, SqliteCacheTracker}, // BlockStore, Config, Synchronous, // }; +use ipfs_radixdb_block_store::BlockStore; pub use ipfs_radixdb_block_store::TempPin; -use ipfs_radixdb_block_store::BlockStore as BlockStore; use lazy_static::lazy_static; use libipld::{codec::References, store::StoreParams, Block, Cid, Ipld, Result}; use parking_lot::Mutex; @@ -13,6 +13,7 @@ use prometheus::{ proto::MetricFamily, HistogramOpts, HistogramVec, IntCounterVec, IntGauge, Opts, Registry, }; +use radixdb::store::{DynBlobStore, MemStore}; use std::{future::Future, path::PathBuf, sync::Arc, time::Duration}; use tracing::info; @@ -127,20 +128,20 @@ where Ipld: References, { pub fn open(config: StorageConfig, executor: Executor) -> Result { - let is_memory = config.path.is_none(); // create DB connection - let store: BlockStore = if let Some(path) = config.path { + let blob_store: DynBlobStore = if let Some(path) = config.path { let path = if path.is_file() { path } else { std::fs::create_dir_all(&path)?; path.join("db") }; - todo!() + todo!(); } else { - todo!() + Arc::new(MemStore::default()) }; + let store = BlockStore::new(blob_store)?; let store = Arc::new(Mutex::new(store)); // spawn GC task From 1fb34c26950094a4890843c48b79e5a8683e5bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Klaehn?= Date: Wed, 7 Sep 2022 17:42:41 +0200 Subject: [PATCH 3/3] Make the tests work --- src/db.rs | 43 +++++++++++++++++++--------------- src/lib.rs | 68 ++++++++++++++++++++++-------------------------------- 2 files changed, 53 insertions(+), 58 deletions(-) diff --git a/src/db.rs b/src/db.rs index 1a13748..3cb5f59 100644 --- a/src/db.rs +++ b/src/db.rs @@ -13,8 +13,14 @@ use prometheus::{ proto::MetricFamily, HistogramOpts, HistogramVec, IntCounterVec, IntGauge, Opts, Registry, }; -use radixdb::store::{DynBlobStore, MemStore}; -use std::{future::Future, path::PathBuf, sync::Arc, time::Duration}; +use radixdb::store::{DynBlobStore, MemStore, PagedFileStore}; +use std::{ + fs::{File, OpenOptions}, + future::Future, + path::PathBuf, + sync::Arc, + time::Duration, +}; use tracing::info; use crate::executor::{Executor, JoinHandle}; @@ -137,7 +143,12 @@ where std::fs::create_dir_all(&path)?; path.join("db") }; - todo!(); + let file = OpenOptions::new() + .read(true) + .write(true) + .create(true) + .open(path)?; + Arc::new(PagedFileStore::<16777216>::new(file)?) } else { Arc::new(MemStore::default()) }; @@ -241,6 +252,10 @@ where self.rw("resolve", |x| x.resolve(alias)) } + pub fn is_pinned(&self, cid: &Cid) -> Result { + self.rw("is_pinned", |x| x.is_pinned(cid)) + } + pub fn reverse_alias(&self, cid: &Cid) -> Result>>> { self.rw("reverse_alias", |x| x.reverse_alias(cid)) } @@ -425,6 +440,10 @@ where Ok(self.0.reverse_alias(cid)?) } + pub fn is_pinned(&mut self, cid: &Cid) -> Result { + Ok(self.0.is_pinned(cid)?) + } + pub fn missing_blocks(&mut self, cid: &Cid) -> Result> { Ok(self.0.get_missing_blocks(cid)?) } @@ -443,31 +462,19 @@ mod tests { macro_rules! assert_evicted { ($store:expr, $block:expr) => { - assert_eq!($store.reverse_alias($block.cid()).unwrap(), None); + assert_eq!($store.is_pinned($block.cid()).unwrap(), false); }; } macro_rules! assert_pinned { ($store:expr, $block:expr) => { - assert_eq!( - $store - .reverse_alias($block.cid()) - .unwrap() - .map(|a| !a.is_empty()), - Some(true) - ); + assert_eq!($store.is_pinned($block.cid()).unwrap(), true); }; } macro_rules! assert_unpinned { ($store:expr, $block:expr) => { - assert_eq!( - $store - .reverse_alias($block.cid()) - .unwrap() - .map(|a| !a.is_empty()), - Some(false) - ); + assert_eq!($store.is_pinned($block.cid()).unwrap(), false); }; } diff --git a/src/lib.rs b/src/lib.rs index 014e30c..e610fa9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -611,25 +611,13 @@ mod tests { macro_rules! assert_pinned { ($store:expr, $block:expr) => { - assert_eq!( - $store - .reverse_alias($block.cid()) - .unwrap() - .map(|a| !a.is_empty()), - Some(true) - ); + assert_eq!($store.is_pinned($block.cid()).unwrap(), true); }; } macro_rules! assert_unpinned { ($store:expr, $block:expr) => { - assert_eq!( - $store - .reverse_alias($block.cid()) - .unwrap() - .map(|a| !a.is_empty()), - Some(false) - ); + assert_eq!($store.is_pinned($block.cid()).unwrap(), false); }; } @@ -657,51 +645,51 @@ mod tests { let _ = local1.insert(c1.clone())?; local1.alias(x, Some(c1.cid()))?; local1.flush().await?; - assert_pinned!(&local1, &a1); - assert_pinned!(&local1, &b1); - assert_pinned!(&local1, &c1); + assert_pinned!(&local1.storage, &a1); + assert_pinned!(&local1.storage, &b1); + assert_pinned!(&local1.storage, &c1); local2.alias(&x, Some(c1.cid()))?; local2.sync(c1.cid(), vec![local1.local_peer_id()]).await?; local2.flush().await?; - assert_pinned!(&local2, &a1); - assert_pinned!(&local2, &b1); - assert_pinned!(&local2, &c1); + assert_pinned!(&local2.storage, &a1); + assert_pinned!(&local2.storage, &b1); + assert_pinned!(&local2.storage, &c1); let _ = local2.insert(b2.clone())?; let _ = local2.insert(c2.clone())?; local2.alias(x, Some(c2.cid()))?; local2.flush().await?; - assert_pinned!(&local2, &a1); - assert_unpinned!(&local2, &b1); - assert_unpinned!(&local2, &c1); - assert_pinned!(&local2, &b2); - assert_pinned!(&local2, &c2); + assert_pinned!(&local2.storage, &a1); + assert_unpinned!(&local2.storage, &b1); + assert_unpinned!(&local2.storage, &c1); + assert_pinned!(&local2.storage, &b2); + assert_pinned!(&local2.storage, &c2); local1.alias(x, Some(c2.cid()))?; local1.sync(c2.cid(), vec![local2.local_peer_id()]).await?; local1.flush().await?; - assert_pinned!(&local1, &a1); - assert_unpinned!(&local1, &b1); - assert_unpinned!(&local1, &c1); - assert_pinned!(&local1, &b2); - assert_pinned!(&local1, &c2); + assert_pinned!(&local1.storage, &a1); + assert_unpinned!(&local1.storage, &b1); + assert_unpinned!(&local1.storage, &c1); + assert_pinned!(&local1.storage, &b2); + assert_pinned!(&local1.storage, &c2); local2.alias(x, None)?; local2.flush().await?; - assert_unpinned!(&local2, &a1); - assert_unpinned!(&local2, &b1); - assert_unpinned!(&local2, &c1); - assert_unpinned!(&local2, &b2); - assert_unpinned!(&local2, &c2); + assert_unpinned!(&local2.storage, &a1); + assert_unpinned!(&local2.storage, &b1); + assert_unpinned!(&local2.storage, &c1); + assert_unpinned!(&local2.storage, &b2); + assert_unpinned!(&local2.storage, &c2); local1.alias(x, None)?; local2.flush().await?; - assert_unpinned!(&local1, &a1); - assert_unpinned!(&local1, &b1); - assert_unpinned!(&local1, &c1); - assert_unpinned!(&local1, &b2); - assert_unpinned!(&local1, &c2); + assert_unpinned!(&local1.storage, &a1); + assert_unpinned!(&local1.storage, &b1); + assert_unpinned!(&local1.storage, &c1); + assert_unpinned!(&local1.storage, &b2); + assert_unpinned!(&local1.storage, &c2); Ok(()) }