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

Method OnEntryAddedToStream

src/server/server.cc:718–738  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

716}
717
718void Server::OnEntryAddedToStream(const std::string &ns, const std::string &key, const redis::StreamEntryID &entry_id) {
719 std::lock_guard<std::mutex> guard(blocked_stream_consumers_mu_);
720
721 auto iter = blocked_stream_consumers_.find(key);
722 if (iter == blocked_stream_consumers_.end() || iter->second.empty()) {
723 return;
724 }
725
726 for (auto it = iter->second.begin(); it != iter->second.end();) {
727 auto consumer = *it;
728 if (consumer->ns == ns && entry_id > consumer->last_consumed_id) {
729 auto s = consumer->owner->EnableWriteEvent(consumer->fd);
730 if (!s.IsOK()) {
731 ERROR("[server] Failed to enable write event on blocked stream consumer {}: {}", consumer->fd, s.Msg());
732 }
733 it = iter->second.erase(it);
734 } else {
735 ++it;
736 }
737 }
738}
739
740void Server::BlockOnWait(redis::Connection *conn, rocksdb::SequenceNumber target_seq, uint64_t num_replicas) {
741 std::unique_lock<std::shared_mutex> guard(wait_contexts_mu_);

Callers 2

ExecuteMethod · 0.80
parseWriteBatchMethod · 0.80

Calls 5

endMethod · 0.80
beginMethod · 0.80
EnableWriteEventMethod · 0.80
IsOKMethod · 0.45
MsgMethod · 0.45

Tested by

no test coverage detected