mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
Remove cmd name from args (#1057)
chore: remove cmd name from the list of arguments Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io> Co-authored-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
8600eacdc4
commit
a12ddfe108
25 changed files with 564 additions and 573 deletions
|
@ -32,18 +32,7 @@ void JournalWriter::Write(std::string_view sv) {
|
|||
sink_->Write(io::Buffer(sv));
|
||||
}
|
||||
|
||||
void JournalWriter::Write(CmdArgList args) {
|
||||
Write(args.size());
|
||||
size_t cmd_size = 0;
|
||||
for (auto v : args) {
|
||||
cmd_size += v.size();
|
||||
}
|
||||
Write(cmd_size);
|
||||
for (auto v : args)
|
||||
Write(facade::ToSV(v));
|
||||
}
|
||||
|
||||
void JournalWriter::Write(std::pair<std::string_view, ArgSlice> args) {
|
||||
template <typename C> void JournalWriter::Write(std::pair<std::string_view, C> args) {
|
||||
auto [cmd, tail_args] = args;
|
||||
|
||||
Write(1 + tail_args.size());
|
||||
|
@ -55,10 +44,17 @@ void JournalWriter::Write(std::pair<std::string_view, ArgSlice> args) {
|
|||
Write(cmd_size);
|
||||
|
||||
Write(cmd);
|
||||
for (auto v : tail_args)
|
||||
Write(v);
|
||||
for (auto v : tail_args) {
|
||||
if constexpr (is_same_v<C, CmdArgList>)
|
||||
Write(facade::ToSV(v));
|
||||
else
|
||||
Write(v);
|
||||
}
|
||||
}
|
||||
|
||||
template void JournalWriter::Write(pair<string_view, CmdArgList>);
|
||||
template void JournalWriter::Write(pair<string_view, ArgSlice>);
|
||||
|
||||
void JournalWriter::Write(std::monostate) {
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue