MCPcopy Create free account
hub / github.com/apache/kvrocks / nextBatch

Method nextBatch

src/storage/iterator.cc:227–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225bool WALIterator::Valid() const { return (batch_iter_ && batch_iter_->Valid()) || (iter_ && iter_->Valid()); }
226
227void WALIterator::nextBatch() {
228 if (!iter_ || !iter_->Valid()) {
229 Reset();
230 return;
231 }
232
233 auto batch = iter_->GetBatch();
234 if (batch.sequence != next_batch_seq_ || !batch.writeBatchPtr) {
235 Reset();
236 return;
237 }
238
239 extractor_.Clear();
240
241 auto s = batch.writeBatchPtr->Iterate(&extractor_);
242 if (!s.ok()) {
243 Reset();
244 return;
245 }
246
247 next_batch_seq_ += batch.writeBatchPtr->Count();
248 batch_iter_ = std::make_unique<WALBatchExtractor::Iter>(extractor_.GetIter());
249}
250
251void WALIterator::Seek(rocksdb::SequenceNumber seq) {
252 if (slot_range_.IsValid() && !storage_->IsSlotIdEncoded()) {

Callers

nothing calls this directly

Calls 4

GetIterMethod · 0.80
ValidMethod · 0.45
ClearMethod · 0.45
CountMethod · 0.45

Tested by

no test coverage detected