| 346 | |
| 347 | |
| 348 | comm::RetCode Store::CheckAddRequest(const comm::proto::AddRequest &req) { |
| 349 | |
| 350 | auto topic_id(impl_->topic_id); |
| 351 | |
| 352 | comm::RetCode ret; |
| 353 | |
| 354 | if (comm::RetCode::RET_OK != (ret = CheckRequestComm(req.store_id(), req.queue_id()))) { |
| 355 | QLErr("CheckRequestComm ret %d", as_integer(ret)); |
| 356 | return ret; |
| 357 | } |
| 358 | |
| 359 | |
| 360 | shared_ptr<const config::TopicConfig> topic_config; |
| 361 | if (comm::RetCode::RET_OK != |
| 362 | (ret = config::GlobalConfig::GetThreadInstance()-> |
| 363 | GetTopicConfigByTopicID(topic_id, topic_config))) { |
| 364 | QLErr("GetTopicConfigByTopicID ret %d", as_integer(ret)); |
| 365 | return ret; |
| 366 | } |
| 367 | |
| 368 | size_t byte_size{0}; |
| 369 | for (int i{0}; i < req.items_size(); ++i) { |
| 370 | byte_size += req.items(i).ByteSize(); |
| 371 | } |
| 372 | |
| 373 | if (byte_size > topic_config->GetProto().topic().items_byte_size_limit()) { |
| 374 | QLErr("size too large. byte_size %d >= size_limit %d", |
| 375 | req.ByteSize(), topic_config->GetProto().topic().items_byte_size_limit()); |
| 376 | return comm::RetCode::RET_ERR_SIZE_TOO_LARGE; |
| 377 | } |
| 378 | |
| 379 | return comm::RetCode::RET_OK; |
| 380 | } |
| 381 | |
| 382 | comm::RetCode Store::CheckGetRequest(const comm::proto::GetRequest &req) { |
| 383 |
nothing calls this directly
no test coverage detected