]> git.sur5r.net Git - openldap/blobdiff - libraries/libmdb/mdb.h
Sorted dups basically completed, needs testing
[openldap] / libraries / libmdb / mdb.h
index c7841c434ce748cc34ce4bad69e324e22eed6427..8fb9b3a822ab666441e1750277cae61b7993c46a 100644 (file)
@@ -50,22 +50,31 @@ typedef struct MDB_val {
 typedef int  (MDB_cmp_func)(const MDB_val *a, const MDB_val *b);
 typedef void (MDB_rel_func)(void *ptr, void *oldptr);
 
-#define MDB_NOOVERWRITE         1
+#define MDB_NOOVERWRITE        1
+#define MDB_NODUPDATA  2
+#define MDB_DEL_DUP            3
 
 typedef enum MDB_cursor_op {           /* cursor operations */
-       MDB_SET,                                /* position at key, or fail */
-       MDB_SET_RANGE,                  /* position at given key */
        MDB_FIRST,
-       MDB_NEXT,
+       MDB_GET_BOTH,                   /* position at key/data */
+       MDB_GET_BOTH_RANGE,             /* position at key, nearest data */
        MDB_LAST,
+       MDB_NEXT,
+       MDB_NEXT_DUP,
+       MDB_NEXT_NODUP,
        MDB_PREV,
-       MDB_GET_BOTH,                   /* position at key/data */
-       MDB_GET_BOTH_RANGE              /* position at key, nearest data */
+       MDB_PREV_DUP,
+       MDB_PREV_NODUP,
+       MDB_SET,                                /* position at key, or fail */
+       MDB_SET_RANGE                   /* position at given key */
 } MDB_cursor_op;
 
 /* return codes */
-#define MDB_FAIL               -1
 #define MDB_SUCCESS     0
+#define MDB_FAIL               -1
+#define MDB_KEYEXIST   -2
+#define MDB_NOTFOUND   -3
+#define MDB_VERSION_MISMATCH   -4
 
 /* DB flags */
 #define MDB_REVERSEKEY 0x02            /* use reverse string keys */
@@ -115,12 +124,16 @@ int  mdb_set_relfunc(MDB_txn *txn, MDB_dbi dbi, MDB_rel_func *rel);
 int  mdb_get(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data);
 int  mdb_put(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data,
                            unsigned int flags);
-int  mdb_del(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data);
+int  mdb_del(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data,
+                           unsigned int flags);
 
 int  mdb_cursor_open(MDB_txn *txn, MDB_dbi dbi, MDB_cursor **cursor);
 void mdb_cursor_close(MDB_cursor *cursor);
 int  mdb_cursor_get(MDB_cursor *cursor, MDB_val *key, MDB_val *data,
                            MDB_cursor_op op);
+int  mdb_cursor_put(MDB_cursor *cursor, MDB_val *key, MDB_val *data,
+                           MDB_cursor_op op);
+int  mdb_cursor_del(MDB_cursor *cursor, unsigned int flags);
 
 int  mdb_cmp(MDB_txn *txn, MDB_dbi dbi, const MDB_val *a, const MDB_val *b);