Parses the pool name and backend_id from the topic key if it is valid. Returns true if the topic key is valid and pool_name and backend_id are set.
| 342 | // Parses the pool name and backend_id from the topic key if it is valid. |
| 343 | // Returns true if the topic key is valid and pool_name and backend_id are set. |
| 344 | static inline bool ParsePoolTopicKey( |
| 345 | const string& topic_key, string* pool_name, string* backend_id) { |
| 346 | // Pool topic keys will look something like: poolname!hostname:22000 |
| 347 | size_t pos = topic_key.find_last_of(TOPIC_KEY_DELIMITER); |
| 348 | if (pos == string::npos || pos >= topic_key.size() - 1) { |
| 349 | VLOG_QUERY << "Invalid topic key for pool: " << topic_key; |
| 350 | return false; |
| 351 | } |
| 352 | *pool_name = topic_key.substr(0, pos); |
| 353 | *backend_id = topic_key.substr(pos + 1); |
| 354 | return true; |
| 355 | } |
| 356 | |
| 357 | // Checks a query will exceed the admission service process memory limit. |
| 358 | // If the limit is exceeded, returns true and the 'rejection_reason'. |
no test coverage detected