| 302 | } |
| 303 | |
| 304 | comm::RetCode Store::CheckRequestComm(const int store_id, const int queue_id) { |
| 305 | auto topic_id(impl_->topic_id); |
| 306 | |
| 307 | comm::RetCode ret; |
| 308 | |
| 309 | shared_ptr<const config::StoreConfig> store_config; |
| 310 | if (comm::RetCode::RET_OK != |
| 311 | (ret = config::GlobalConfig::GetThreadInstance()-> |
| 312 | GetStoreConfig(topic_id, store_config))) { |
| 313 | QLErr("GetStoreConfig ret %d topic_id %d", as_integer(ret), topic_id); |
| 314 | return ret; |
| 315 | } |
| 316 | |
| 317 | shared_ptr<const config::proto::Store> store; |
| 318 | if (comm::RetCode::RET_OK != (ret = store_config->GetStoreByAddr(impl_->addr, store))) { |
| 319 | QLErr("GetStoreByAddr ret %d", as_integer(ret)); |
| 320 | return ret; |
| 321 | } |
| 322 | |
| 323 | // check store_id |
| 324 | if (store->store_id() != store_id) { |
| 325 | QLErr("store_id unmatch. store_id %d req_store_id %d", store->store_id(), store_id); |
| 326 | return comm::RetCode::RET_ERR_RANGE_STORE; |
| 327 | } |
| 328 | |
| 329 | shared_ptr<const config::TopicConfig> topic_config; |
| 330 | if (comm::RetCode::RET_OK != |
| 331 | (ret = config::GlobalConfig::GetThreadInstance()-> |
| 332 | GetTopicConfigByTopicID(topic_id, topic_config))) { |
| 333 | QLErr("GetTopicConfigByTopicID ret %d", as_integer(ret)); |
| 334 | return ret; |
| 335 | } |
| 336 | |
| 337 | // check queue_id |
| 338 | if (!topic_config->IsValidQueue(queue_id)) { |
| 339 | QLErr("IsValidQueue fail. queue_id %d", queue_id); |
| 340 | return comm::RetCode::RET_ERR_RANGE_PUB; |
| 341 | } |
| 342 | |
| 343 | return comm::RetCode::RET_OK; |
| 344 | |
| 345 | } |
| 346 | |
| 347 | |
| 348 | comm::RetCode Store::CheckAddRequest(const comm::proto::AddRequest &req) { |
nothing calls this directly
no test coverage detected