[py-lmdb] Re: create_env() and open_env()

  • From: "Dinesh Vadhia" <dineshvadhia@xxxxxxxxxxx>
  • To: <py-lmdb@xxxxxxxxxxxxx>
  • Date: Fri, 23 May 2014 06:42:41 -0700

Say, there are 2 programs:

module#1 - one-off module to initialize (or configure) an lmdb Env

module#2 - use Env and one or more db's

What is the flow now?

From: "David Wilson" <dw@xxxxxxxx>
Sent: Friday, May 23, 2014 5:24 AM
To: <py-lmdb@xxxxxxxxxxxxx>
Subject: [py-lmdb] Re: create_env() and open_env()

Aah, now I understand.

Yes, the flow is:

* mdb_env_create() allocates a MDB_env on the heap, but does nothing

* mdb_env_set_flags() controls options used for the MDB_env

* mdb_env_open() physically constructs the on-diks representation and
  populates the MDB_env with data from it.

* mdb_env_close() stops using the disk file and deallocates the MDB_env

lmdb.Environment.__init__() does a combination of mdb_env_create(),
mdb_env_set_flags(), and mdb_env_open().


Other related posts: