MCPcopy Create free account
hub / github.com/apache/kvrocks / Add

Method Add

src/server/namespace.cc:168–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168Status Namespace::Add(const std::string& ns, const std::string& token) {
169 {
170 std::shared_lock lock(tokens_mu_);
171 // duplicate namespace
172 for (const auto& iter : tokens_) {
173 if (iter.second == ns) {
174 if (iter.first == token) return Status::OK();
175 return {Status::NotOK, kErrNamespaceExists};
176 }
177 }
178 // duplicate token
179 if (tokens_.find(token) != tokens_.end()) {
180 return {Status::NotOK, kErrTokenExists};
181 }
182 }
183
184 // we don't need to lock the mutex here because the Set method will lock it
185 return Set(ns, token);
186}
187
188Status Namespace::Del(const std::string& ns) {
189 if (ns == kDefaultNamespace) {

Callers

nothing calls this directly

Calls 2

SetClass · 0.85
endMethod · 0.80

Tested by

no test coverage detected