MCPcopy Create free account
hub / github.com/apache/kvrocks / ListSChannelSubscribeNum

Method ListSChannelSubscribeNum

src/server/server.cc:608–620  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

606}
607
608void Server::ListSChannelSubscribeNum(const std::vector<std::string> &channels,
609 std::vector<ChannelSubscribeNum> *channel_subscribe_nums) {
610 std::lock_guard<std::mutex> guard(pubsub_shard_channels_mu_);
611
612 for (const auto &chan : channels) {
613 uint16_t slot = config_->cluster_enabled ? GetSlotIdFromKey(chan) : 0;
614 if (auto iter = pubsub_shard_channels_[slot].find(chan); iter != pubsub_shard_channels_[slot].end()) {
615 channel_subscribe_nums->emplace_back(ChannelSubscribeNum{iter->first, iter->second.size()});
616 } else {
617 channel_subscribe_nums->emplace_back(ChannelSubscribeNum{chan, 0});
618 }
619 }
620}
621
622void Server::BlockOnKey(const std::string &key, redis::Connection *conn) {
623 std::lock_guard<std::mutex> guard(blocking_keys_mu_);

Callers 1

ExecuteMethod · 0.80

Calls 2

GetSlotIdFromKeyFunction · 0.85
endMethod · 0.80

Tested by

no test coverage detected