123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- /** @file store.htable.h
- *
- * @brief Simple in-memory triple store back end based on hash tables.
- *
- * This is the simplest choice to do in-memory manipulation of RDF graphs and
- * it has some limitations: most notably, it only supports triples without
- * context (one graph per store) and it is not indexed. This means that it is
- * optimized for fast writes and sequential lookups (iteration). Lookups on
- * arbitrary terms are supported but require iterating over all the triples.
- * This implementation is most convenient for graphs where retrieval is done
- * via iteration.
- *
- * Also, as it may be obvious, this store is not persistent.
- *
- * For faster random lookups and persistence, the MDB backend is preferred. If
- * persistence is not required (e.g. ingesting and manipulating a very large
- * graph and outputting some results on a file) an ad-hoc MDB store located in
- * RAM disk can be used, which is much faster.
- */
- #ifndef _LSUP_STORE_HTABLE_H
- #define _LSUP_STORE_HTABLE_H
- #include "triple.h"
- typedef struct ht_store_t LSUP_HTStore;
- typedef struct ht_iterator_t LSUP_HTIterator;
- LSUP_HTStore *
- LSUP_htstore_new (void);
- /** @brief Boolean operation on hash table triples.
- *
- * The resulting store is compacted to the minimum size necessary to hold all
- * results.
- *
- * @param[in] op Operation type. See #LSUP_bool_op
- *
- * @param[in] s1 First store.
- *
- * @param[in] s2 Second store.
- *
- * @return New store resulting from the operation. It must be freed with
- * #LSUP_htstore_free after use.
- */
- LSUP_HTStore *
- LSUP_htstore_bool_op(
- const LSUP_bool_op op, const LSUP_HTStore *s1, const LSUP_HTStore *s2);
- /** @brief Free a hash table store.
- */
- void
- LSUP_htstore_free (LSUP_HTStore *ht);
- /** @brief Copy contents of a store to another store.
- *
- * The destination is not initialized, so copy is cumulative with the existing
- * content.
- *
- * @param[in] Store to copy to. It must be already initialized via
- * #LSUP_htstore_new(), #LSUP_HTstore_copy(), etc.
- *
- * @param[in] src Store to copy from.
- */
- LSUP_rc
- LSUP_htstore_copy_contents (LSUP_HTStore *dest, const LSUP_HTStore *src);
- LSUP_HTIterator *
- LSUP_htstore_add_init (LSUP_HTStore *store);
- /** @brief Add triples to the store.
- *
- * @param[in] store Store handle.
- *
- * @param[in] sspo Triples to add, serialized into buffer triples.
- */
- LSUP_rc
- LSUP_htstore_add_iter (LSUP_HTIterator *it, const LSUP_SerTriple *sspo);
- void
- LSUP_htstore_add_done (LSUP_HTIterator *it);
- LSUP_rc
- LSUP_htstore_remove(
- LSUP_HTStore *store, const LSUP_SerTriple *sspo, size_t *ct);
- LSUP_HTIterator *
- LSUP_htstore_lookup(
- LSUP_HTStore *store, const LSUP_SerTriple *sspo);
- size_t
- LSUP_htstore_size (LSUP_HTStore *ht);
- void
- LSUP_htiter_free (LSUP_HTIterator *it);
- size_t
- LSUP_htiter_cur (LSUP_HTIterator *it);
- LSUP_rc
- LSUP_htiter_next (LSUP_HTIterator *it, LSUP_SerTriple *sspo);
- #endif // _LSUP_STORE_HTABLE_H
|