static void test_read(LSMDB_env *const env) { LSMDB_txn *txn; chk( lsmdb_txn_begin(env, NULL, MDB_RDONLY, &txn) ); LSMDB_cursor *cursor; chk( lsmdb_cursor_open(txn, &cursor) ); for(int i = 0; i < WRITES; ++i) { MDB_val key, data; chk( lsmdb_cursor_next(cursor, &key, &data, +1) ); assert(KEY_SIZE == key.mv_size); chkkey(key.mv_data); assert(DATA_SIZE == data.mv_size); } lsmdb_txn_abort(txn); }
int db_cursor_next(DB_cursor *const cursor, DB_val *const key, DB_val *const data, int const dir) { return mdberr(lsmdb_cursor_next((LSMDB_cursor *)cursor, (MDB_val *)key, (MDB_val *)data, dir)); }