Reimplement basic ops as cursor ops

This commit is contained in:
Howard Chu 2011-09-03 17:24:39 -07:00 committed by Howard Chu
parent 23790cf390
commit 0609aa45b3
4 changed files with 626 additions and 229 deletions

View File

@ -4,7 +4,7 @@ OPT = -O2 -g
CFLAGS = -pthread $(OPT) $(W) $(XCFLAGS)
LDLIBS =
PROGS = mdb_stat mtest mtest2 mtest3
PROGS = mdb_stat mtest mtest2 mtest3 mtest4 mtest5
all: libmdb.a libmdb.so $(PROGS)
clean:
@ -25,6 +25,7 @@ mtest: mtest.o libmdb.a
mtest2: mtest2.o libmdb.a
mtest3: mtest3.o libmdb.a
mtest4: mtest4.o libmdb.a
mtest5: mtest5.o libmdb.a
mdb.o: mdb.c mdb.h midl.h
$(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -c mdb.c

File diff suppressed because it is too large Load Diff

View File

@ -133,7 +133,7 @@ typedef int (MDB_cmp_func)(const MDB_val *a, const MDB_val *b);
*/
typedef void (MDB_rel_func)(void *newptr, void *oldptr, size_t size);
/** @defgroup mdb_env environment flags
/** @defgroup mdb_env Environment Flags
* @{
*/
/** mmap at a fixed address */
@ -144,7 +144,7 @@ typedef void (MDB_rel_func)(void *newptr, void *oldptr, size_t size);
#define MDB_RDONLY 0x20000
/** @} */
/** @defgroup mdb_open database flags
/** @defgroup mdb_open Database Flags
* @{
*/
/** use reverse string keys */
@ -161,15 +161,18 @@ typedef void (MDB_rel_func)(void *newptr, void *oldptr, size_t size);
#define MDB_CREATE 0x40000
/** @} */
/** @defgroup mdb_put mdb_put flags
/** @defgroup mdb_put Write Flags
* @{
*/
/** For mdb_put: don't write if the key already exists. */
/** For put: Don't write if the key already exists. */
#define MDB_NOOVERWRITE 0x10
/** For mdb_put: don't write if the key and data pair already exist.
* Only for #MDB_DUPSORT
/** Only for #MDB_DUPSORT<br>
* For put: don't write if the key and data pair already exist.<br>
* For mdb_cursor_del: remove all duplicate data items.
*/
#define MDB_NODUPDATA 0x20
/** For mdb_cursor_put: overwrite the current key/data pair */
#define MDB_CURRENT 0x40
/* @} */
/** Cursor operations */
@ -723,8 +726,6 @@ int mdb_del(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data);
/** Create a cursor handle.
* Cursors are associated with a specific transaction and database and
* may not span threads.
* @todo Cursors only support read operations. Support for cursor_put() and
* cursor_del() needs to be added.
* @param[in] txn A transaction handle returned by #mdb_txn_begin()
* @param[in] dbi A database handle returned by #mdb_open()
* @param[out] cursor Address where the new #MDB_cursor handle will be stored

View File

@ -29,12 +29,16 @@
/** @defgroup internal MDB Internals
* @{
*/
/** ULONG should be the largest integer type supported on a machine.
* It should be equal to the size of a pointer.
*/
#define ULONG unsigned long
/** @defgroup idls ID List Management
* @{
*/
/** An ID should be the largest integer type supported on a machine.
/** A generic ID number. These were entryIDs in back-bdb.
*/
#define ID unsigned long
typedef ULONG ID;
/** An IDL is an ID List, a sorted array of IDs. The first
* element of the array is a counter for how many actual