MCPcopy Create free account
hub / github.com/couchbase/fleece / get

Method get

Fleece/Tree/MutableHashTree.cc:83–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 6

asImmutableMethod · 0.80
findNearestMethod · 0.45
isMutableMethod · 0.45
asMutableMethod · 0.45
matchesMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected