MCPcopy Create free account
hub / github.com/apache/trafficserver / remove

Method remove

plugins/experimental/wasm/lib/src/shared_data.cc:97–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97WasmResult SharedData::remove(std::string_view vm_id, std::string_view key, uint32_t cas,
98 std::pair<std::string, uint32_t> *result) {
99 std::lock_guard<std::mutex> lock(mutex_);
100 std::unordered_map<std::string, std::pair<std::string, uint32_t>> *map;
101 auto map_it = data_.find(std::string(vm_id));
102 if (map_it == data_.end()) {
103 return WasmResult::NotFound;
104 }
105 map = &map_it->second;
106 auto it = map->find(std::string(key));
107 if (it != map->end()) {
108 if (cas != 0U && cas != it->second.second) {
109 return WasmResult::CasMismatch;
110 }
111 if (result != nullptr) {
112 *result = it->second;
113 }
114 map->erase(it);
115 return WasmResult::Ok;
116 }
117 return WasmResult::NotFound;
118}
119
120} // namespace proxy_wasm

Callers 7

removeSharedDataKeyMethod · 0.45
tsmemcache.ccFile · 0.45
loadMethod · 0.45
pre_loadMethod · 0.45
pre_loadMethod · 0.45
yaml_mergeFunction · 0.45
loadMethod · 0.45

Calls 4

stringClass · 0.85
findMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected