1/*++
2/* NAME
3/*	mkmap_lmdb 3
4/* SUMMARY
5/*	create or open database, LMDB style
6/* SYNOPSIS
7/*	#include <mkmap.h>
8/*
9/*	MKMAP	*mkmap_lmdb_open(path)
10/*	const char *path;
11/*
12/* DESCRIPTION
13/*	This module implements support for creating LMDB databases.
14/*
15/*	mkmap_lmdb_open() takes a file name, appends the ".lmdb"
16/*	suffix, and does whatever initialization is required
17/*	before the OpenLDAP LMDB open routine is called.
18/*
19/*	All errors are fatal.
20/* SEE ALSO
21/*	dict_lmdb(3), LMDB dictionary interface.
22/* LICENSE
23/* .ad
24/* .fi
25/*	The Secure Mailer license must be distributed with this software.
26/* AUTHOR(S)
27/*	Howard Chu
28/*	Symas Corporation
29/*--*/
30
31/* System library. */
32
33#include <sys_defs.h>
34#include <sys/stat.h>
35#include <unistd.h>
36#include <errno.h>
37
38/* Utility library. */
39
40#include <msg.h>
41#include <mymalloc.h>
42#include <stringops.h>
43#include <dict.h>
44#include <dict_lmdb.h>
45#include <myflock.h>
46#include <warn_stat.h>
47
48#ifdef HAS_LMDB
49#ifdef PATH_LMDB_H
50#include PATH_LMDB_H
51#else
52#include <lmdb.h>
53#endif
54
55/* Global library. */
56
57#include <mail_conf.h>
58#include <mail_params.h>
59
60/* Application-specific. */
61
62#include "mkmap.h"
63
64/* mkmap_lmdb_open */
65
66MKMAP  *mkmap_lmdb_open(const char *path)
67{
68    MKMAP  *mkmap = (MKMAP *) mymalloc(sizeof(*mkmap));
69
70    /*
71     * Fill in the generic members.
72     */
73    mkmap->open = dict_lmdb_open;
74    mkmap->after_open = 0;
75    mkmap->after_close = 0;
76
77    /*
78     * LMDB uses MVCC so it needs no special lock management here.
79     */
80
81    return (mkmap);
82}
83
84#endif
85