1
0
Fork 0
mirror of https://github.com/dragonflydb/dragonfly.git synced 2024-12-14 11:58:02 +00:00

fix: replace journal executor reply builder (#1120)

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
This commit is contained in:
Vladislav 2023-04-23 13:27:47 +03:00 committed by GitHub
parent 78a471582f
commit 520e66c4b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -38,11 +38,16 @@ template <typename... Ts> journal::ParsedEntry::CmdData BuildFromParts(Ts... par
} // namespace
JournalExecutor::JournalExecutor(Service* service)
: service_{service}, conn_context_{&null_sink_, nullptr} {
: service_{service}, reply_builder_{facade::ReplyMode::NONE}, conn_context_{nullptr,
&reply_builder_} {
conn_context_.is_replicating = true;
conn_context_.journal_emulated = true;
}
JournalExecutor::~JournalExecutor() {
conn_context_.Inject(nullptr);
}
void JournalExecutor::Execute(DbIndex dbid, std::vector<journal::ParsedEntry::CmdData>& cmds) {
SelectDb(dbid);
for (auto& cmd : cmds) {

View file

@ -4,6 +4,7 @@
#pragma once
#include "facade/reply_capture.h"
#include "server/journal/types.h"
namespace dfly {
@ -14,6 +15,10 @@ class Service;
class JournalExecutor {
public:
JournalExecutor(Service* service);
~JournalExecutor();
JournalExecutor(JournalExecutor&&) = delete;
void Execute(DbIndex dbid, std::vector<journal::ParsedEntry::CmdData>& cmds);
void Execute(DbIndex dbid, journal::ParsedEntry::CmdData& cmd);
@ -26,8 +31,8 @@ class JournalExecutor {
void SelectDb(DbIndex dbid);
Service* service_;
facade::CapturingReplyBuilder reply_builder_;
ConnectionContext conn_context_;
io::NullSink null_sink_;
std::vector<bool> ensured_dbs_;
};