Class: LMDB::Environment

Inherits:
Object
  • Object
show all
Defined in:
ext/isomorfeus_hamster_ext/isomorfeus_hamster.c

Overview

The Environment is the root object for all LMDB operations.

An LMDB “environment” is a collection of one or more “databases” (key-value tables), along with transactions to modify those databases and cursors to iterate through them.

An environment – and its collection of databases – is normally stored in a directory. That directory will contain two files:

  • data.mdb: all the records in all the databases in the environment

  • lock.mdb: state of transactions that may be going on in the environment.

An environment can contain multiple databases. Each of the databases has a string name (“mydatabase”, “db.3.1982”). You use the database name to open the database within the environment.

Examples:

The normal pattern for using LMDB in Ruby

env = LMDB.new "databasedir"
db = env.database "databasename"
# ... do things to the database ...
env.close