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

Method GetAddrScale

phxqueue/test/simpleconsumer.cpp:72–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70
71
72comm::RetCode SimpleConsumer::GetAddrScale(const comm::proto::GetAddrScaleRequest &req,
73 comm::proto::GetAddrScaleResponse &resp) {
74 // return default
75 comm::RetCode ret;
76
77 shared_ptr<const config::ConsumerConfig> consumer_config;
78 if (comm::RetCode::RET_OK != (ret = config::GlobalConfig::GetThreadInstance()->
79 GetConsumerConfig(GetTopicID(), consumer_config))) {
80 QLErr("GetConsumerConfig ret %d", as_integer(ret));
81 return ret;
82 }
83
84 for (int i{0}; i < consumer_config->GetProto().consumers_size(); ++i) {
85 auto &&consumer = consumer_config->GetProto().consumers(i);
86 auto &&addr_scale = resp.add_addr_scales();
87 addr_scale->mutable_addr()->CopyFrom(consumer.addr());
88 addr_scale->set_scale(consumer.scale());
89 }
90
91 return comm::RetCode::RET_OK;
92}
93
94comm::RetCode SimpleConsumer::GetQueueByAddrScale(const std::vector<consumer::Queue_t> &queues,
95 const consumer::AddrScales &addr_scales,

Callers 1

TestGetAddrScaleFunction · 0.45

Calls 2

as_integerFunction · 0.85
GetConsumerConfigMethod · 0.80

Tested by

no test coverage detected