Skip to content

Commit

Permalink
Refactor skiplist delete new search random_level methods.
Browse files Browse the repository at this point in the history
Signed-off-by: Wyatt Jia <i@eventloop.live>
  • Loading branch information
WyattJia committed Dec 21, 2023
1 parent 7e64640 commit 9975ac0
Show file tree
Hide file tree
Showing 2 changed files with 571 additions and 437 deletions.
8 changes: 4 additions & 4 deletions src/slsm/skiplist/src/node.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
use std::fmt;

pub struct Node<K, V> {
key: K,
value: V,
pub(crate) key: K,
pub(crate) value: V,
// forwards: vector of links to next node at the respective level.
// this vector must be of length `self.level + 1`.
// links[0] stores a pointer to the same node as next.
forwards: Vec<Option<Box<Node<K, V>>>>,
pub(crate) forwards: Vec<Option<Box<Node<K, V>>>>,
prev: Option<Box<Node<K, V>>>,
next: Option<Box<Node<K, V>>>,
links_len: usize,
}

impl<K, V> Node<K, V> {
fn new(key: K, value: V, level: usize) -> Self {
pub(crate) fn new(key: K, value: V, level: usize) -> Self {
Node {
key,
value,
Expand Down
Loading

0 comments on commit 9975ac0

Please sign in to comment.