summaryrefslogtreecommitdiffstats
path: root/lib/ldb/ldb_mdb/ldb_mdb.h
blob: 8f21493927b535f380cbf9d9870fa0672492c480 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
   ldb database library using mdb back end - transaction operations

   Copyright (C) Jakub Hrozek 2015
   Copyright (C) Catalyst.Net Ltd 2017

     ** NOTE! The following LGPL license applies to the ldb
     ** library. This does NOT imply that all of Samba is released
     ** under the LGPL

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 3 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _LDB_MDB_H_
#define _LDB_MDB_H_

#include "ldb_private.h"
#include <lmdb.h>

struct lmdb_private {
	struct ldb_context *ldb;
	MDB_env *env;

	struct lmdb_trans *txlist;

	struct ldb_mdb_metadata {
		struct ldb_message *attributes;
		unsigned seqnum;
	} *meta;
	int error;
	MDB_txn *read_txn;

	pid_t pid;

};

struct lmdb_trans {
	struct lmdb_trans *next;
	struct lmdb_trans *prev;

	MDB_txn *tx;
};

int ldb_mdb_err_map(int lmdb_err);
int lmdb_connect(struct ldb_context *ldb, const char *url,
		 unsigned int flags, const char *options[],
		 struct ldb_module **_module);

#endif /* _LDB_MDB_H_ */