Skip to content

Commit

Permalink
remove obsolete code
Browse files Browse the repository at this point in the history
  • Loading branch information
fominok committed Dec 27, 2024
1 parent f7d4105 commit a771e6a
Showing 1 changed file with 0 additions and 65 deletions.
65 changes: 0 additions & 65 deletions grovedb/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,40 +114,6 @@ where
}
}

// /// Wrapper type that keeps path and key used to perform an operation.
// pub(crate) struct WithOrigin<'b, 'k, B, T> {
// pub(crate) path: SubtreePath<'b, B>,
// pub(crate) key: &'k [u8],
// pub(crate) value: T,
// }

// impl<'b, 'k, B, T> WithOrigin<'b, 'k, B, T> {
// pub(crate) fn run(
// path: SubtreePath<'b, B>,
// key: &'k [u8],
// f: impl FnOnce(SubtreePath<'b, B>, &'k [u8]) -> T,
// ) -> Self {
// WithOrigin {
// path: path.clone(),
// key,
// value: f(path, key),
// }
// }
// }

// impl<'b, 'k, B, T, E> WithOrigin<'b, 'k, B, CostResult<T, E>> {
// pub(crate) fn into_cost_result(self) -> CostResult<WithOrigin<'b, 'k, B,
// T>, E> { let mut cost = Default::default();
// let value = cost_return_on_error!(&mut cost, self.value);
// Ok(WithOrigin {
// value,
// path: self.path,
// key: self.key,
// })
// .wrap_with_cost(cost)
// }
// }

pub(crate) struct ResolvedReference<'db, 'b, 'c, B> {
pub target_merk: MerkHandle<'db, 'c>,
pub target_path: SubtreePathBuilder<'b, B>,
Expand Down Expand Up @@ -292,34 +258,3 @@ pub(crate) fn follow_reference_once<'db, 'b, 'c, B: AsRef<[u8]>>(
})
.wrap_with_cost(cost)
}

// #[cfg(test)]
// mod tests {
// use pretty_assertions::assert_eq;

// use super::*;
// use crate::tests::{make_deep_tree, TEST_LEAF};

// #[test]
// fn with_origin() {
// let version = GroveVersion::latest();
// let db = make_deep_tree(&version);

// let wo = WithOrigin::run(
// SubtreePath::from(&[TEST_LEAF, b"innertree"]),
// b"key1",
// |path, key| db.get(path, key, None, &version),
// );

// assert_eq!(wo.path, SubtreePath::from(&[TEST_LEAF, b"innertree"]));
// assert_eq!(wo.key, b"key1");

// let with_origin_cost_result: CostResult<_, _> =
// wo.into_cost_result();

// assert_eq!(
// with_origin_cost_result.unwrap().unwrap().value,
// Element::Item(b"value1".to_vec(), None)
// );
// }
// }

0 comments on commit a771e6a

Please sign in to comment.