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

Method SSubscribeChannel

src/server/server.cc:564–574  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

562}
563
564void Server::SSubscribeChannel(const std::string &channel, redis::Connection *conn, uint16_t slot) {
565 assert((config_->cluster_enabled && slot < HASH_SLOTS_SIZE) || slot == 0);
566 std::lock_guard<std::mutex> guard(pubsub_shard_channels_mu_);
567
568 auto conn_ctx = ConnContext(conn->Owner(), conn->GetFD());
569 if (auto iter = pubsub_shard_channels_[slot].find(channel); iter == pubsub_shard_channels_[slot].end()) {
570 pubsub_shard_channels_[slot].emplace(channel, std::list<ConnContext>{conn_ctx});
571 } else {
572 iter->second.emplace_back(conn_ctx);
573 }
574}
575
576void Server::SUnsubscribeChannel(const std::string &channel, redis::Connection *conn, uint16_t slot) {
577 assert((config_->cluster_enabled && slot < HASH_SLOTS_SIZE) || slot == 0);

Callers 1

ExecuteMethod · 0.45

Calls 4

ConnContextClass · 0.85
OwnerMethod · 0.80
GetFDMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected