PragmaTwice commented on code in PR #1287:
URL:
https://github.com/apache/incubator-kvrocks/pull/1287#discussion_r1122012748
##########
src/storage/storage.cc:
##########
@@ -639,12 +677,33 @@ void Storage::SetIORateLimit(int64_t max_io_mb) {
rocksdb::DB *Storage::GetDB() { return db_; }
-Status Storage::WriteToPropagateCF(const std::string &key, const std::string
&value) {
- rocksdb::WriteBatch batch;
+void Storage::BeginTxn() {
+ is_txn_mode_ = true;
+ txn_write_batch_ = std::make_unique<rocksdb::WriteBatchWithIndex>();
+}
+
+Status Storage::CommitTxn() {
+ is_txn_mode_ = false;
+ auto s = Write(write_opts_, txn_write_batch_->GetWriteBatch());
+ txn_write_batch_.reset();
+ if (s.ok()) {
+ return {Status::cOK};
+ }
+ return {Status::NotOK, s.ToString()};
+}
+
+std::shared_ptr<rocksdb::WriteBatchBase> Storage::GetWriteBatch() {
Review Comment:
I think the `Base` suffix seems to be redundant.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]