index: refactor snapshot iterator API
To make a memtx snapshot, we use the create_snapshot_iterator index method. The method creates a 'frozen' iterator over an index - changes done to the index after the iterator was created don't affect the iterator output. Also, the iterator is safe to use from any thread. This API works just fine for snapshots, but it's too limited to allow creation of user read views so we need to rework it. To make the existing snapshot infrastructure suitable for user read views, this commit replaces the create_snapshot_iterator method with create_read_view. The new method returns an index_read_view object, which has the API similar to the read-only API of an index. A read view object may only be created and destroyed in the tx thread, but it may be used in any thread. Currently, index_read_view has the only method - create_iterator, which takes iterator type and key and returns an index_read_view_iterator object. The iterator type and key arguments are ignored and we always assume the iterator type to be ITER_ALL (asserted), but later on we will fix this and also add a method to look up a tuple by key. Closes #7194 NO_DOC=refactoring NO_TEST=refactoring NO_CHANGELOG=refactoring
Showing
- src/box/index.cc 2 additions, 2 deletionssrc/box/index.cc
- src/box/index.h 82 additions, 28 deletionssrc/box/index.h
- src/box/memtx_bitset.cc 1 addition, 2 deletionssrc/box/memtx_bitset.cc
- src/box/memtx_engine.cc 39 additions, 18 deletionssrc/box/memtx_engine.cc
- src/box/memtx_hash.cc 76 additions, 52 deletionssrc/box/memtx_hash.cc
- src/box/memtx_rtree.cc 1 addition, 2 deletionssrc/box/memtx_rtree.cc
- src/box/memtx_space.c 1 addition, 9 deletionssrc/box/memtx_space.c
- src/box/memtx_tree.cc 85 additions, 47 deletionssrc/box/memtx_tree.cc
- src/box/sequence.c 58 additions, 17 deletionssrc/box/sequence.c
- src/box/sequence.h 8 additions, 8 deletionssrc/box/sequence.h
- src/box/session_settings.c 1 addition, 2 deletionssrc/box/session_settings.c
- src/box/sysview.c 1 addition, 2 deletionssrc/box/sysview.c
- src/box/vinyl.c 1 addition, 2 deletionssrc/box/vinyl.c
Loading
Please register or sign in to comment