| 167 | } |
| 168 | |
| 169 | Status Parser::ParseWriteBatch(const std::string &batch_string) { |
| 170 | rocksdb::WriteBatch write_batch(batch_string); |
| 171 | WriteBatchExtractor write_batch_extractor(slot_id_encoded_, -1, true); |
| 172 | |
| 173 | auto db_status = write_batch.Iterate(&write_batch_extractor); |
| 174 | if (!db_status.ok()) |
| 175 | return {Status::NotOK, fmt::format("failed to iterate over the write batch: {}", db_status.ToString())}; |
| 176 | |
| 177 | auto resp_commands = write_batch_extractor.GetRESPCommands(); |
| 178 | for (const auto &iter : *resp_commands) { |
| 179 | auto s = writer_->Write(iter.first, iter.second); |
| 180 | if (!s.IsOK()) { |
| 181 | ERROR("Failed to write to AOF from the write batch. Error: {}", s.Msg()); |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | return Status::OK(); |
| 186 | } |
no test coverage detected