~ubuntu-branches/ubuntu/trusty/postfix/trusty-updates

« back to all changes in this revision

Viewing changes to src/util/slmdb.h

  • Committer: Package Import Robot
  • Author(s): LaMont Jones, LaMont Jones, localization folks
  • Date: 2014-02-11 07:44:30 UTC
  • mfrom: (58.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20140211074430-kwkoxdz0fbajn0fj
Tags: 2.11.0-1
[LaMont Jones]

* New upstream release: 2.11.0

[localization folks]

* l10n: Updated German translations.  Closes: #734893 (Helge Kreutzmann)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _SLMDB_H_INCLUDED_
 
2
#define _SLMDB_H_INCLUDED_
 
3
 
 
4
/*++
 
5
/* NAME
 
6
/*      slmdb 3h
 
7
/* SUMMARY
 
8
/*      LMDB API wrapper
 
9
/* SYNOPSIS
 
10
/*      #include <slmdb.h>
 
11
/* DESCRIPTION
 
12
/* .nf
 
13
 
 
14
 /*
 
15
  * System library.
 
16
  */
 
17
#include <setjmp.h>
 
18
 
 
19
#ifdef PATH_LMDB_H
 
20
#include PATH_LMDB_H
 
21
#else
 
22
#include <lmdb.h>
 
23
#endif
 
24
 
 
25
 /*
 
26
  * External interface.
 
27
  */
 
28
#ifdef NO_SIGSETJMP
 
29
#define SLMDB_JMP_BUF jmp_buf
 
30
#else
 
31
#define SLMDB_JMP_BUF sigjmp_buf
 
32
#endif
 
33
 
 
34
 /*
 
35
  * All data structure members are private.
 
36
  */
 
37
typedef struct {
 
38
    size_t  curr_limit;                 /* database soft size limit */
 
39
    int     size_incr;                  /* database expansion factor */
 
40
    size_t  hard_limit;                 /* database hard size limit */
 
41
    int     open_flags;                 /* open() flags */
 
42
    int     lmdb_flags;                 /* LMDB-specific flags */
 
43
    int     slmdb_flags;                /* bulk-mode flag */
 
44
    MDB_env *env;                       /* database environment */
 
45
    MDB_dbi dbi;                        /* database instance */
 
46
    MDB_txn *txn;                       /* bulk transaction */
 
47
    int     db_fd;                      /* database file handle */
 
48
    MDB_cursor *cursor;                 /* iterator */
 
49
    MDB_val saved_key;                  /* saved cursor key buffer */
 
50
    size_t  saved_key_size;             /* saved cursor key buffer size */
 
51
    void    (*longjmp_fn) (void *, int);/* exception handling */
 
52
    void    (*notify_fn) (void *, int,...);     /* workaround notification */
 
53
    void    (*assert_fn) (void *, const char *);        /* assert notification */
 
54
    void   *cb_context;                 /* call-back context */
 
55
    int     api_retry_count;            /* slmdb(3) API call retry count */
 
56
    int     bulk_retry_count;           /* bulk_mode retry count */
 
57
    int     api_retry_limit;            /* slmdb(3) API call retry limit */
 
58
    int     bulk_retry_limit;           /* bulk_mode retry limit */
 
59
} SLMDB;
 
60
 
 
61
#define SLMDB_FLAG_BULK         (1 << 0)
 
62
 
 
63
extern int slmdb_init(SLMDB *, size_t, int, size_t);
 
64
extern int slmdb_open(SLMDB *, const char *, int, int, int);
 
65
extern int slmdb_get(SLMDB *, MDB_val *, MDB_val *);
 
66
extern int slmdb_put(SLMDB *, MDB_val *, MDB_val *, int);
 
67
extern int slmdb_del(SLMDB *, MDB_val *);
 
68
extern int slmdb_cursor_get(SLMDB *, MDB_val *, MDB_val *, MDB_cursor_op);
 
69
extern int slmdb_control(SLMDB *, int,...);
 
70
extern int slmdb_close(SLMDB *);
 
71
 
 
72
#define slmdb_fd(slmdb)                 ((slmdb)->db_fd)
 
73
#define slmdb_curr_limit(slmdb)         ((slmdb)->curr_limit)
 
74
 
 
75
#define SLMDB_CTL_END           0
 
76
#define SLMDB_CTL_LONGJMP_FN    1       /* exception handling */
 
77
#define SLMDB_CTL_NOTIFY_FN     2       /* debug logging function */
 
78
#define SLMDB_CTL_CB_CONTEXT    3       /* call-back context */
 
79
#define SLMDB_CTL_HARD_LIMIT    4       /* hard database size limit */
 
80
#define SLMDB_CTL_API_RETRY_LIMIT       5       /* per slmdb(3) API call */
 
81
#define SLMDB_CTL_BULK_RETRY_LIMIT      6       /* per bulk update */
 
82
#define SLMDB_CTL_ASSERT_FN     7       /* report assertion failure */
 
83
 
 
84
typedef void (*SLMDB_NOTIFY_FN) (void *, int,...);
 
85
typedef void (*SLMDB_LONGJMP_FN) (void *, int);
 
86
typedef void (*SLMDB_ASSERT_FN) (void *, const char *);
 
87
 
 
88
/* LICENSE
 
89
/* .ad
 
90
/* .fi
 
91
/*      The Secure Mailer license must be distributed with this software.
 
92
/* AUTHOR(S)
 
93
/*      Howard Chu
 
94
/*      Symas Corporation
 
95
/*--*/
 
96
 
 
97
#endif