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

Re: unique incrementing value with lmdb?



CJ Ess wrote:
What is the best way to implement a unique incrementing value (for use as a
key or value) with lmdb?

Is there a property if the transaction mechanism I could piggy-back off of to
atomically generate my number?

Or should I block writers above mdb_cursor_put, do my lmdb transaction, and
unblock?

You could probably use the txnid for this, but currently there is no API to return the txnid from a txn.

--
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/