---
name: "mdb"
section: "3"
platform: "linux"
package: "lmdb-doc"
version: "0.9.31-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mdb/3"
---

# mdb(3)

LMDB API - OpenLDAP Lightning Memory-Mapped Database Manager.

## NAME

mdb - LMDB API

 \- OpenLDAP Lightning Memory-Mapped Database Manager.

## SYNOPSIS

### Modules

**Version Macros**\
 **Environment Flags**\
 **Database Flags**\
 **Write Flags**\

### Data Structures

struct **MDB\_val**\
 Generic structure used for passing keys and data in and out of the database.

### Typedefs

typedef unsigned int **MDB\_dbi**\
 A handle for an individual database in the DB environment.  typedef int() **MDB\_cmp\_func**(const **MDB\_val** \*a, const **MDB\_val** \*b)\
 A callback function used to compare two keys in a database.  typedef void() **MDB\_rel\_func**(**MDB\_val** \*item, void \*oldptr, void \*newptr, void \*relctx)\
 A callback function used to relocate a position-dependent data item in a fixed-address database.

## Detailed Description

OpenLDAP Lightning Memory-Mapped Database Manager.

## Data Structure Documentation

## struct MDB\_val

Generic structure used for passing keys and data in and out of the database.

Values returned from the database are valid only until a subsequent update operation, or the end of the transaction. Do not modify or free them, they commonly point into the database itself.

Key sizes must be between 1 and **mdb\_env\_get\_maxkeysize()** inclusive. The same applies to data sizes in databases with the **MDB\_DUPSORT** flag. Other data items can in theory be from 0 to 0xffffffff bytes long.

**Data Fields**

size\_t **mv\_size**\
 void \* **mv\_data**\

## Typedef Documentation

### typedef void() MDB\_rel\_func(MDB\_val \*item, void \*oldptr, void \*newptr, void \*relctx)

A callback function used to relocate a position-dependent data item in a fixed-address database. The **newptr** gives the item's desired address in the memory map, and **oldptr** gives its previous address. The item's actual data resides at the address in **item**. This callback is expected to walk through the fields of the record in **item** and modify any values based at the **oldptr** address to be relative to the **newptr** address.

**Parameters**

*item* The item that is to be relocated. \
 *oldptr* The previous address. \
 *newptr* The new address to relocate to. \
 *relctx* An application-provided context, set by **mdb\_set\_relctx()**.

**Todo**

This feature is currently unimplemented.

## Author

Generated automatically by Doxygen for LMDB from the source code.
