[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#7660) LMDB: Proposing a small addition to the API: mdb_txn_env



Salvador Ortiz <sog@msg.com.mx> writes:
> I want to avoid as much as possible the need to duplicate LMDB's state in perl,
> in particular dbi's flags, so I need a method to obtain the MDB_env from a
> MDB_txn, but the required API is missing.
> 
> In the same spirit of mdb_cursor_txn or mdb_cursor_dbi I propose adding
> mdb_txn_env.

Maybe there should be an mdb_txn_info() function instead:

typedef struct MDB_txninfo {
	int	mt_lib_version;	/* library version, set by liblmdb */
	MDB_env	*mt_env;
} MDB_txninfo;

#define mdb_txn_info(txn, ti) mdb_txn_xinfo(txn, ti, MDB_VERSION_FULL)
int mdb_txn_xinfo(MDB_txn *txn, MDB_txninfo *ti, int api_version);

The version parameter is so we can extend MDB_txninfo later, and
liblmdb will know how much of MDB_txninfo it can fill in.  The
caller can zero out the txninfo before the call, so he'll be
prepared if an older liblmdb does not support and set all fields.

-- 
Hallvard