summaryrefslogtreecommitdiffstats
path: root/src/util/mkmap_lmdb.c
blob: ac8b2115b3a7938ec33b16dcd16ae81f674a6d79 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*++
/* NAME
/*	mkmap_lmdb 3
/* SUMMARY
/*	create or open database, LMDB style
/* SYNOPSIS
/*	#include <dict_lmdb.h>
/*
/*	MKMAP	*mkmap_lmdb_open(path)
/*	const char *path;
/*
/* DESCRIPTION
/*	This module implements support for creating LMDB databases.
/*
/*	mkmap_lmdb_open() takes a file name, appends the ".lmdb"
/*	suffix, and does whatever initialization is required
/*	before the OpenLDAP LMDB open routine is called.
/*
/*	All errors are fatal.
/* SEE ALSO
/*	dict_lmdb(3), LMDB dictionary interface.
/* LICENSE
/* .ad
/* .fi
/*	The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/*	Howard Chu
/*	Symas Corporation
/*
/*	Wietse Venema
/*	Google, Inc.
/*	111 8th Avenue
/*	New York, NY 10011, USA
/*--*/

/* System library. */

#include <sys_defs.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>

/* Utility library. */

#include <mymalloc.h>
#include <dict_lmdb.h>
#include <mkmap.h>

#ifdef HAS_LMDB
#ifdef PATH_LMDB_H
#include PATH_LMDB_H
#else
#include <lmdb.h>
#endif

/* mkmap_lmdb_open */

MKMAP  *mkmap_lmdb_open(const char *path)
{
    MKMAP  *mkmap = (MKMAP *) mymalloc(sizeof(*mkmap));

    /*
     * Fill in the generic members.
     */
    mkmap->open = dict_lmdb_open;
    mkmap->after_open = 0;
    mkmap->after_close = 0;

    /*
     * LMDB uses MVCC so it needs no special lock management here.
     */

    return (mkmap);
}

#endif