Skip to content

Commit

Permalink
feat: kamt: remove "ignore dead links" feature (#1975)
Browse files Browse the repository at this point in the history
It was unused and we've removed it from the HAMT as well.
  • Loading branch information
Stebalien authored Jan 25, 2024
1 parent f3c20d6 commit 40d396e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 15 deletions.
4 changes: 0 additions & 4 deletions ipld/kamt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ fvm_ipld_encoding = { workspace = true }
fvm_ipld_blockstore = { workspace = true }
forest_hash_utils = "0.1"

[features]
# This feature should just be used for testing (ignoring links that don't exist in store)
ignore-dead-links = []

[dev-dependencies]
hex = { workspace = true }
criterion = { workspace = true }
Expand Down
7 changes: 0 additions & 7 deletions ipld/kamt/src/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,7 @@ where
if let Some(node) = store.get_cbor::<Node<K, V, H, N>>(cid)? {
node
} else {
#[cfg(not(feature = "ignore-dead-links"))]
return Err(Error::CidNotFound(cid.to_string()));

#[cfg(feature = "ignore-dead-links")]
continue;
};

// Ignore error intentionally, the cache value will always be the same
Expand Down Expand Up @@ -122,10 +118,7 @@ where
} else {
let node = match self.store.get_cbor::<Node<K, V, H, N>>(cid) {
Ok(Some(node)) => node,
#[cfg(not(feature = "ignore-dead-links"))]
Ok(None) => return Some(Err(Error::CidNotFound(cid.to_string()))),
#[cfg(feature = "ignore-dead-links")]
Ok(None) => continue,
Err(err) => return Some(Err(err.into())),
};

Expand Down
4 changes: 0 additions & 4 deletions ipld/kamt/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,7 @@ where
let node: Box<Node<K, V, H, N>> = if let Some(node) = store.get_cbor(cid)? {
node
} else {
#[cfg(not(feature = "ignore-dead-links"))]
return Err(Error::CidNotFound(cid.to_string()));

#[cfg(feature = "ignore-dead-links")]
return Ok(None);
};
// Intentionally ignoring error, cache will always be the same.
cache.get_or_init(|| node)
Expand Down

0 comments on commit 40d396e

Please sign in to comment.