Skip to content

Commit

Permalink
forgotten with_guard
Browse files Browse the repository at this point in the history
  • Loading branch information
density215 committed Oct 24, 2024
1 parent 0fbfdd3 commit 6e42233
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 36 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ inetnum = "0.1.0"
log = "^0.4"
roaring = "0.10.3"
# rotonda-macros = { version = "0.4.0-rc0" }
rotonda-macros = { path = "../rotonda-macros" }
# rotonda-macros = { git = "https://github.com/nlnetlabs/rotonda-macros", branch = "main" }
# rotonda-macros = { path = "../rotonda-macros" }
rotonda-macros = { git = "https://github.com/nlnetlabs/rotonda-macros", branch = "main" }
routecore = { version = "0.5.0-rc1", features = ["bgp", "bmp", "fsm", "serde"] }

ansi_term = { version = "0.12", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions src/local_array/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ macro_rules! insert_match {
// but ultimately we will return the accumulated count of all
// retry_count from this macro.
let local_retry_count = 0;
// retrieve_node_mut_with_guard updates the bitmap index if necessary.
if let Some(current_node) = $self.store.retrieve_node_mut_with_guard($cur_i, $record.multi_uniq_id) {
// retrieve_node_mut updates the bitmap index if necessary.
if let Some(current_node) = $self.store.retrieve_node_mut($cur_i, $record.multi_uniq_id) {
match current_node {
$(
SizedStrideRef::$variant(current_node) => {
Expand Down
36 changes: 9 additions & 27 deletions src/local_array/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ where

let root_node_id = self.get_root_node_id();
let mut node = match self.store.get_stride_for_id(root_node_id) {
3 => self.store.retrieve_node_with_guard(root_node_id).unwrap(),
4 => self.store.retrieve_node_with_guard(root_node_id).unwrap(),
_ => self.store.retrieve_node_with_guard(root_node_id).unwrap(),
3 => self.store.retrieve_node(root_node_id).unwrap(),
4 => self.store.retrieve_node(root_node_id).unwrap(),
_ => self.store.retrieve_node(root_node_id).unwrap(),
};

let mut nibble;
Expand Down Expand Up @@ -419,10 +419,7 @@ where
// exit nodes.
(Some(n), Some(pfx_idx)) => {
match_prefix_idx = Some(pfx_idx);
node = self
.store
.retrieve_node_with_guard(n)
.unwrap();
node = self.store.retrieve_node(n).unwrap();

if last_stride {
if options.include_more_specifics {
Expand All @@ -441,10 +438,7 @@ where
}
}
(Some(n), None) => {
node = self
.store
.retrieve_node_with_guard(n)
.unwrap();
node = self.store.retrieve_node(n).unwrap();

if last_stride {
if options.include_more_specifics {
Expand Down Expand Up @@ -543,10 +537,7 @@ where
) {
(Some(n), Some(pfx_idx)) => {
match_prefix_idx = Some(pfx_idx);
node = self
.store
.retrieve_node_with_guard(n)
.unwrap();
node = self.store.retrieve_node(n).unwrap();

if last_stride {
if options.include_more_specifics {
Expand All @@ -565,10 +556,7 @@ where
}
}
(Some(n), None) => {
node = self
.store
.retrieve_node_with_guard(n)
.unwrap();
node = self.store.retrieve_node(n).unwrap();

if last_stride {
if options.include_more_specifics {
Expand Down Expand Up @@ -656,10 +644,7 @@ where
) {
(Some(n), Some(pfx_idx)) => {
match_prefix_idx = Some(pfx_idx);
node = self
.store
.retrieve_node_with_guard(n)
.unwrap();
node = self.store.retrieve_node(n).unwrap();

if last_stride {
if options.include_more_specifics {
Expand All @@ -678,10 +663,7 @@ where
}
}
(Some(n), None) => {
node = self
.store
.retrieve_node_with_guard(n)
.unwrap();
node = self.store.retrieve_node(n).unwrap();

if last_stride {
if options.include_more_specifics {
Expand Down
4 changes: 2 additions & 2 deletions src/local_array/store/iterators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ impl<

if let Some(next_ptr) = next_ptr {
let node = if self.mui.is_none() {
self.store.retrieve_node_with_guard(next_ptr)
self.store.retrieve_node(next_ptr)
} else {
self.store.retrieve_node_for_mui(
next_ptr,
Expand Down Expand Up @@ -755,7 +755,7 @@ impl<
let node = if let Some(mui) = mui {
self.retrieve_node_for_mui(start_node_id, mui)
} else {
self.retrieve_node_with_guard(start_node_id)
self.retrieve_node(start_node_id)
};

if let Some(node) = node {
Expand Down
6 changes: 3 additions & 3 deletions src/local_array/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ impl<
) -> Result<UpsertReport, PrefixStoreError> {
trace!("Updating the default route...");

if let Some(root_node) = self.store.retrieve_node_mut_with_guard(
if let Some(root_node) = self.store.retrieve_node_mut(
self.store.get_root_node_id(),
record.multi_uniq_id,
// guard,
Expand Down Expand Up @@ -595,8 +595,8 @@ impl<
start_node_id: StrideNodeId<AF>,
found_pfx_vec: &mut Vec<PrefixId<AF>>,
) {
trace!("{:?}", self.store.retrieve_node_with_guard(start_node_id));
match self.store.retrieve_node_with_guard(start_node_id) {
trace!("{:?}", self.store.retrieve_node(start_node_id));
match self.store.retrieve_node(start_node_id) {
Some(SizedStrideRef::Stride3(n)) => {
found_pfx_vec.extend(
n.pfx_iter(start_node_id).collect::<Vec<PrefixId<AF>>>(),
Expand Down

0 comments on commit 6e42233

Please sign in to comment.