s4-ldb: expose ltdb_err_map and ltdb_delete_noindex
[ira/wip.git] / source4 / lib / ldb / ldb_tdb / ldb_tdb.h
index 7ebf199f6f5c3a64a418ef81229d50cc809f272d..b3887a6c3471dbe82ebb9e11284e1a4ea47b3f93 100644 (file)
@@ -1,11 +1,5 @@
-#if (_SAMBA_BUILD_ == 3)
-#include "tdb/include/tdb.h"
-#else
-#include "replace.h"
-#include "system/wait.h"
+#include "ldb_includes.h"
 #include "tdb.h"
-#endif
-
 #include "ldb_module.h"
 
 /* this private structure is used by the ltdb backend in the
@@ -14,8 +8,6 @@ struct ltdb_private {
        TDB_CONTEXT *tdb;
        unsigned int connect_flags;
        
-       /* a double is used for portability and ease of string
-          handling. It has plenty of digits of precision */
        unsigned long long sequence_number;
 
        /* the low level tdb seqnum - used to avoid loading BASEINFO when
@@ -25,6 +17,8 @@ struct ltdb_private {
        struct ltdb_cache {
                struct ldb_message *indexlist;
                struct ldb_message *attributes;
+               bool one_level_indexes;
+               bool attribute_indexes;
 
                struct {
                        char *name;
@@ -36,17 +30,23 @@ struct ltdb_private {
 
        bool check_base;
        struct ltdb_idxptr *idxptr;
+       bool prepared_commit;
 };
 
 /*
   the async local context
   holds also internal search state during a full db search
 */
+struct ltdb_req_spy {
+       struct ltdb_context *ctx;
+};
+
 struct ltdb_context {
        struct ldb_module *module;
        struct ldb_request *req;
 
-       bool callback_failed;
+       bool request_terminated;
+       struct ltdb_req_spy *spy;
 
        /* search stuff */
        const struct ldb_parse_tree *tree;
@@ -60,7 +60,7 @@ struct ltdb_context {
 #define LTDB_INDEX      "@INDEX"
 #define LTDB_INDEXLIST  "@INDEXLIST"
 #define LTDB_IDX        "@IDX"
-#define LTDB_IDXPTR     "@IDXPTR"
+#define LTDB_IDXVERSION "@IDXVERSION"
 #define LTDB_IDXATTR    "@IDXATTR"
 #define LTDB_IDXONE     "@IDXONE"
 #define LTDB_BASEINFO   "@BASEINFO"
@@ -84,10 +84,14 @@ int ltdb_check_at_attributes_values(const struct ldb_val *value);
 
 struct ldb_parse_tree;
 
-int ltdb_search_indexed(struct ltdb_context *ctx);
-int ltdb_index_add(struct ldb_module *module, const struct ldb_message *msg);
-int ltdb_index_del(struct ldb_module *module, const struct ldb_message *msg);
-int ltdb_index_one(struct ldb_module *module, const struct ldb_message *msg, int add);
+int ltdb_search_indexed(struct ltdb_context *ctx, uint32_t *);
+int ltdb_index_add_new(struct ldb_module *module, const struct ldb_message *msg);
+int ltdb_index_delete(struct ldb_module *module, const struct ldb_message *msg);
+int ltdb_index_del_element(struct ldb_module *module, const char *dn, struct ldb_message_element *el);
+int ltdb_index_add_element(struct ldb_module *module, struct ldb_dn *dn, 
+                          struct ldb_message_element *el);
+int ltdb_index_del_value(struct ldb_module *module, const char *dn, 
+                        struct ldb_message_element *el, int v_idx);
 int ltdb_reindex(struct ldb_module *module);
 int ltdb_index_transaction_start(struct ldb_module *module);
 int ltdb_index_transaction_commit(struct ldb_module *module);
@@ -124,11 +128,9 @@ int ltdb_lock_read(struct ldb_module *module);
 int ltdb_unlock_read(struct ldb_module *module);
 struct TDB_DATA ltdb_key(struct ldb_module *module, struct ldb_dn *dn);
 int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flgs);
-int ltdb_delete_noindex(struct ldb_module *module, struct ldb_dn *dn);
 int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *msg);
-
-int ltdb_index_del_value(struct ldb_module *module, const char *dn, 
-                        struct ldb_message_element *el, int v_idx);
+int ltdb_delete_noindex(struct ldb_module *module, struct ldb_dn *dn);
+int ltdb_err_map(enum TDB_ERROR tdb_code);
 
 struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx,
                                   const char *path, int hash_size, int tdb_flags,