sq lib/ldb/ldb_mdb/ldb_mdb.[ch] include <lmdb.h>
[metze/samba/wip.git] / lib / ldb / ldb_mdb / ldb_mdb.h
1 /*
2    ldb database library using mdb back end - transaction operations
3
4    Copyright (C) Jakub Hrozek 2015
5    Copyright (C) Catalyst.Net Ltd 2017
6
7      ** NOTE! The following LGPL license applies to the ldb
8      ** library. This does NOT imply that all of Samba is released
9      ** under the LGPL
10
11    This library is free software; you can redistribute it and/or
12    modify it under the terms of the GNU Lesser General Public
13    License as published by the Free Software Foundation; either
14    version 3 of the License, or (at your option) any later version.
15
16    This library is distributed in the hope that it will be useful,
17    but WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19    Lesser General Public License for more details.
20
21    You should have received a copy of the GNU Lesser General Public
22    License along with this library; if not, see <http://www.gnu.org/licenses/>.
23 */
24
25 #ifndef _LDB_MDB_H_
26 #define _LDB_MDB_H_
27
28 #include "ldb_private.h"
29 #include <lmdb.h>
30
31 struct lmdb_private {
32         struct ldb_context *ldb;
33         MDB_env *env;
34
35         struct lmdb_trans *txlist;
36
37         struct ldb_mdb_metadata {
38                 struct ldb_message *attributes;
39                 unsigned seqnum;
40         } *meta;
41         int error;
42         MDB_txn *read_txn;
43
44 };
45
46 struct lmdb_trans {
47         struct lmdb_trans *next;
48         struct lmdb_trans *prev;
49
50         MDB_txn *tx;
51 };
52
53 int ldb_mdb_err_map(int lmdb_err);
54 int lmdb_connect(struct ldb_context *ldb, const char *url,
55                  unsigned int flags, const char *options[],
56                  struct ldb_module **_module);
57
58 #endif /* _LDB_MDB_H_ */