store_mdb.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /** @file store_mdb.h
  2. *
  3. * @brief LMDB graph store backend.
  4. *
  5. * This module stores triples in a LMDB embedded store, organized
  6. * into named graphs. The store is optimized and indexed for fast lookup of any
  7. * number of bound terms.
  8. *
  9. * The store must be first initialized once, to create the environment files
  10. * and folders as well as the internal databases, then it must be opened once
  11. * per session. Within that session multiple R/W operations can be performed
  12. * using transactions.
  13. *
  14. * This store supports transactions. Under the hood, LMDB supports nested RW
  15. * transactions, which are used here, but not exposed to the caller. Some
  16. * functions have a transaction handle parameter that may be NULL. In that
  17. * case, a new transaction is opened and closed within the scope of the
  18. * function (or, in cases such as #mdbstore_lookup(), within the life cycle of
  19. * the iterator); if not, the transaction handle may either be used as the
  20. * parent for a new transaction (which is closed as in the previous case), or
  21. * the function uses the same transaction (i.e. changes are only committed
  22. * after the parent transaction is committed).
  23. */
  24. #ifndef _LSUP_STORE_MDB_H
  25. #define _LSUP_STORE_MDB_H
  26. #include "lmdb.h"
  27. #include "buffer.h"
  28. #include "store_interface.h"
  29. // FIXME find a better cross-platform path.
  30. /// Default MDB store identifier and location.
  31. #define LSUP_MDB_STORE_URN "file://" TMPDIR "/mdb_store"
  32. /// MDB store interface.
  33. extern const LSUP_StoreInt mdbstore_int;
  34. #endif /* _LSUP_STORE_MDB_H */