• S
    WriteBatchWithIndex: a wrapper of WriteBatch, with a searchable index · 28b5c760
    sdong 提交于
    Summary:
    Add WriteBatchWithIndex so that a user can query data out of a WriteBatch, to support MongoDB's read-its-own-write.
    
    WriteBatchWithIndex uses a skiplist to store the binary index. The index stores the offset of the entry in the write batch. When searching for a key, the key for the entry is read by read the entry from the write batch from the offset.
    
    Define a new iterator class for querying data out of WriteBatchWithIndex. A user can create an iterator of the write batch for one column family, seek to a key and keep calling Next() to see next entries.
    
    I will add more unit tests if people are OK about this API.
    
    Test Plan:
    make all check
    Add unit tests.
    
    Reviewers: yhchiang, igor, MarkCallaghan, ljin
    
    Reviewed By: ljin
    
    Subscribers: dhruba, leveldb, xjin
    
    Differential Revision: https://reviews.facebook.net/D21381
    28b5c760
write_batch_test.cc 12.3 KB