MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / insert

Method insert

src/ifcparse/rocksdb_map_adapter.h:344–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342 }
343
344 std::pair<iterator, bool> insert(const value_type& val) {
345#ifdef IFOPSH_WITH_ROCKSDB
346 std::string key_str = key_to_string(val.first);
347 std::string full_key = prefix_ + key_str;
348 std::string existing;
349 rocksdb::Status s = db_->Get(rocksdb::ReadOptions{}, full_key, &existing);
350 if (s.ok()) {
351 // Key already exists.
352 return { find(val.first), false };
353 }
354 std::string encoded = codec_.encode(val.second);
355 s = db_->Put(rocksdb::WriteOptions{}, full_key, encoded);
356 if (!s.ok()) {
357 return { end(), false };
358 }
359#endif
360 return { find(val.first), true };
361 }
362};
363
364#endif

Callers

nothing calls this directly

Calls 4

key_to_stringFunction · 0.85
GetMethod · 0.80
endFunction · 0.70
encodeMethod · 0.45

Tested by

no test coverage detected