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

Method SubscribeChannel

src/server/server.cc:481–490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

479}
480
481void Server::SubscribeChannel(const std::string &channel, redis::Connection *conn) {
482 std::lock_guard<std::mutex> guard(pubsub_channels_mu_);
483
484 auto conn_ctx = ConnContext(conn->Owner(), conn->GetFD());
485 if (auto iter = pubsub_channels_.find(channel); iter == pubsub_channels_.end()) {
486 pubsub_channels_.emplace(channel, std::list<ConnContext>{conn_ctx});
487 } else {
488 iter->second.emplace_back(conn_ctx);
489 }
490}
491
492void Server::UnsubscribeChannel(const std::string &channel, redis::Connection *conn) {
493 std::lock_guard<std::mutex> guard(pubsub_channels_mu_);

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