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

Method GetKeyNameFromCursor

src/server/server.cc:2263–2284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2261}
2262
2263std::string Server::GetKeyNameFromCursor(const std::string &cursor, CursorType cursor_type) {
2264 // When cursor is 0, cursor string is empty
2265 if (cursor.empty() || !config_->redis_cursor_compatible) {
2266 return cursor;
2267 }
2268
2269 auto s = ParseInt<uint64_t>(cursor, 10);
2270 // When Cursor 0 or not a Integer return empty string.
2271 // Although the parameter 'cursor' is not expected to be 0, we still added a check for 0 to increase the robustness of
2272 // the code.
2273 if (!s.IsOK() || *s == 0) {
2274 return {};
2275 }
2276 auto number_cursor = NumberCursor(*s);
2277 // Because the index information is fully stored in the cursor, we can directly obtain the index from the cursor.
2278 auto item = cursor_dict_->at(number_cursor.GetIndex());
2279 if (number_cursor.IsMatch(item, cursor_type)) {
2280 return item.key_name;
2281 }
2282
2283 return {};
2284}
2285
2286AuthResult Server::AuthenticateUser(const std::string &user_password, std::string *ns) {
2287 const auto &requirepass = GetConfig()->requirepass;

Callers 4

ExecuteMethod · 0.80
ExecuteMethod · 0.80
ExecuteMethod · 0.80
ExecuteMethod · 0.80

Calls 4

NumberCursorClass · 0.85
GetIndexMethod · 0.80
IsOKMethod · 0.45
IsMatchMethod · 0.45

Tested by

no test coverage detected