| 81 | } |
| 82 | |
| 83 | Value MutableHashTree::get(slice key) const { |
| 84 | if (_root) { |
| 85 | Target target(key); |
| 86 | NodeRef leaf = _root->findNearest(target.hash); |
| 87 | if (leaf) { |
| 88 | if (leaf.isMutable()) { |
| 89 | auto mleaf = (MutableLeaf*)leaf.asMutable(); |
| 90 | if (mleaf->matches(target)) |
| 91 | return mleaf->_value; |
| 92 | } else { |
| 93 | if (leaf.asImmutable()->leaf.matches(key)) |
| 94 | return leaf.asImmutable()->leaf.value(); |
| 95 | } |
| 96 | } |
| 97 | } else if (_imRoot) { |
| 98 | return _imRoot->get(key); |
| 99 | } |
| 100 | return nullptr; |
| 101 | } |
| 102 | |
| 103 | bool MutableHashTree::insert(slice key, InsertCallback callback) { |
| 104 | if (!_root) |
nothing calls this directly
no test coverage detected