Close a sub-tree of nodes.
(self, prefix: str = "/")
| 550 | pass |
| 551 | |
| 552 | def close_subtree(self, prefix: str = "/") -> None: |
| 553 | """Close a sub-tree of nodes.""" |
| 554 | if not prefix.endswith("/"): |
| 555 | prefix = prefix + "/" |
| 556 | |
| 557 | cache = self.cache |
| 558 | registry = self.registry |
| 559 | |
| 560 | # Ensure tables are closed before their indices |
| 561 | paths = [ |
| 562 | path |
| 563 | for path in cache |
| 564 | if path.startswith(prefix) and "/_i_" not in path |
| 565 | ] |
| 566 | self._close_nodes(paths, cache.pop) |
| 567 | |
| 568 | # Close everything else (i.e. indices) |
| 569 | paths = [path for path in cache if path.startswith(prefix)] |
| 570 | self._close_nodes(paths, cache.pop) |
| 571 | |
| 572 | # Ensure tables are closed before their indices |
| 573 | paths = [ |
| 574 | path |
| 575 | for path in registry |
| 576 | if path.startswith(prefix) and "/_i_" not in path |
| 577 | ] |
| 578 | self._close_nodes(paths, registry.pop) |
| 579 | |
| 580 | # Close everything else (i.e. indices) |
| 581 | paths = [path for path in registry if path.startswith(prefix)] |
| 582 | self._close_nodes(paths, registry.pop) |
| 583 | |
| 584 | def shutdown(self) -> None: |
| 585 | """Shutdown the node manager.""" |
no test coverage detected