fix: tree child container index (#284)

This commit is contained in:
Leon Zhao 2024-03-02 16:21:31 +08:00 committed by GitHub
parent 71addcb6de
commit da782c7659
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -338,10 +338,15 @@ impl ContainerState for TreeState {
/// Get the index of the child container
fn get_child_index(&self, id: &ContainerID) -> Option<Index> {
let id = id.as_normal().unwrap();
Some(Index::Node(TreeID {
let tree_id = TreeID {
peer: *id.0,
counter: *id.1,
}))
};
if !self.trees.contains_key(&tree_id) || self.is_node_deleted(&tree_id) {
None
} else {
Some(Index::Node(tree_id))
}
}
fn get_child_containers(&self) -> Vec<ContainerID> {