[RocksDB] Expose count for WriteBatch

Summary: As title. Exposed a Count function that returns the number of updates in a batch. Could be handy for replication sequence number check.

Test Plan: make check;

Reviewers: emayanke, sheki, dhruba

CC: leveldb

Differential Revision: https://reviews.facebook.net/D11523
This commit is contained in:
Haobo Xu
2013-06-26 10:50:58 -07:00
parent 34ef873290
commit 71e0f695c1
3 changed files with 14 additions and 1 deletions

View File

@@ -45,6 +45,10 @@ void WriteBatch::Clear() {
rep_.resize(kHeader);
}
int WriteBatch::Count() const {
return WriteBatchInternal::Count(this);
}
Status WriteBatch::Iterate(Handler* handler) const {
Slice input(rep_);
if (input.size() < kHeader) {