MCPcopy Create free account
hub / github.com/Tencent/phxqueue / CheckAddRequest

Method CheckAddRequest

phxqueue/store/store.cpp:348–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346
347
348comm::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
382comm::RetCode Store::CheckGetRequest(const comm::proto::GetRequest &req) {
383

Callers

nothing calls this directly

Calls 2

as_integerFunction · 0.85

Tested by

no test coverage detected