store_mdb.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. * Note that this store does not keep track of empty contexts. Hence, if an
  10. * empty graph is created under this store, nothing is effectively recorded
  11. * until some triples are added to the graph.
  12. *
  13. * The store must be first initialized once, to create the environment files
  14. * and folders as well as the internal databases, then it must be opened once
  15. * per session. Within that session multiple R/W operations can be performed
  16. * using transactions.
  17. *
  18. * This store supports transactions. Under the hood, LMDB supports nested RW
  19. * transactions, which are used here, but not exposed to the caller. Some
  20. * functions have a transaction handle parameter that may be NULL. In that
  21. * case, a new transaction is opened and closed within the scope of the
  22. * function (or, in cases such as #mdbstore_lookup(), within the life cycle of
  23. * the iterator); if not, the transaction handle may either be used as the
  24. * parent for a new transaction (which is closed as in the previous case), or
  25. * the function uses the same transaction (i.e. changes are only committed
  26. * after the parent transaction is committed).
  27. */
  28. #ifndef _LSUP_STORE_MDB_H
  29. #define _LSUP_STORE_MDB_H
  30. #include "lmdb.h"
  31. #include "lsup/buffer.h"
  32. #include "lsup/store_interface.h"
  33. // FIXME find a better cross-platform path.
  34. /// Default MDB store identifier and location.
  35. #define LSUP_MDB_STORE_URN "file://" TMPDIR "/mdb_store"
  36. /// MDB store interface.
  37. extern const LSUP_StoreInt mdbstore_int;
  38. #endif /* _LSUP_STORE_MDB_H */