MCPcopy Create free account
hub / github.com/dhbloo/rapfi / isKeyReferenced

Function isKeyReferenced

Rapfi/database/dbclient.cpp:150–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148/// Check if this key is referenced by any other key.
149template <typename IsDeletedParentKeyPredicate>
150bool isKeyReferenced(DBStorage &storage, const DBKey &key, IsDeletedParentKeyPredicate pred)
151{
152 bool result = false;
153
154 iterateParentKeys(storage,
155 key,
156 [&](const DBKey &parentKey, const StonePos &, TransformType) -> bool {
157 if (pred(parentKey))
158 return false;
159
160 DBRecord record;
161 if (storage.get(parentKey, record, RECORD_MASK_NONE)) {
162 result = true;
163 return true; // terminate iteration now
164 }
165
166 return false;
167 });
168
169 return result;
170}
171
172/// Delete all children of a board position from the database storage.
173/// @return The number of records deleted.

Callers 1

recursiveDeleteChildrenFunction · 0.85

Calls 2

iterateParentKeysFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected