An abstract class for the cursor of the database while reading. More...
#include <db.h>
Public Member Functions | |
virtual void | Seek (const string &key)=0 |
Seek to a specific key (or if the key does not exist, seek to the immediate next). More... | |
virtual bool | SupportsSeek () |
virtual void | SeekToFirst ()=0 |
Seek to the first key in the database. | |
virtual void | Next ()=0 |
Go to the next location in the database. | |
virtual string | key ()=0 |
Returns the current key. | |
virtual string | value ()=0 |
Returns the current value. | |
virtual bool | Valid ()=0 |
Returns whether the current location is valid - for example, if we have reached the end of the database, return false. | |
DISABLE_COPY_AND_ASSIGN (Cursor) | |
|
pure virtual |
Seek to a specific key (or if the key does not exist, seek to the immediate next).
This is optional for dbs, and in default, SupportsSeek() returns false meaning that the db cursor does not support it.
Implemented in caffe2::db::ZmqDBCursor, caffe2::db::LMDBCursor, caffe2::db::MiniDBCursor, caffe2::db::LevelDBCursor, caffe2::db::RocksDBCursor, and caffe2::db::ProtoDBCursor.