Volksdata 1.0b7
RDF library
Loading...
Searching...
No Matches
store_interface.h File Reference

Common store back end interfaces. More...

#include "volksdata/buffer.h"
Include dependency graph for store_interface.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  VOLK_StoreInt
 Store interface. More...

Typedefs

typedef VOLK_rc(* store_setup_fn_t) (const char *id, bool clear)
 Prototype: create any environment necessary for the store to work.
typedef void *(* store_new_fn_t) (const char *id, size_t size)
 Prototype: create a new store.
typedef void(* store_free_fn_t) (void *store)
 Prototype: free store handle.
typedef size_t(* store_size_fn_t) (const void *store)
 Prototype: get store size.
typedef char *(* store_id_fn_t) (const void *store)
 Prototype: get the store ID.
typedef VOLK_rc(* store_txn_begin_fn_t) (void *store, int flags, void **txn)
 Begin a transaction.
typedef VOLK_rc(* store_txn_commit_fn_t) (void *txn)
 Commit a transaction.
typedef void(* store_txn_abort_fn_t) (void *txn)
 Abort a transaction.
typedef VOLK_rc(* store_update_ctx_fn_t) (void *store, const VOLK_Buffer *old_c, const VOLK_Buffer *new_c, void *udata)
 Update the context of triples in a context-aware store.
typedef void *(* store_add_init_fn_t) (void *store, const VOLK_Buffer *sc, void *udata)
 Initialize bulk triple load.
typedef VOLK_rc(* store_add_iter_fn_t) (void *it, const VOLK_BufferTriple *sspo)
 Add one triple into the store.
typedef void(* store_add_abort_fn_t) (void *it)
 Abort an add loop and free iterator.
typedef VOLK_rc(* store_add_done_fn_t) (void *it)
 Finalize an add loop and free iterator.
typedef VOLK_rc(* store_add_term_fn_t) (void *store, const VOLK_Buffer *sterm, void *udata)
 Add a single term to the store.
typedef void *(* store_lookup_fn_t) (void *store, const VOLK_Buffer *ss, const VOLK_Buffer *sp, const VOLK_Buffer *so, const VOLK_Buffer *sc, void *udata, size_t *ct)
 Prototype: look up triples by pattern matching.
typedef bool(* store_trp_exist_fn_t) (void *store, const VOLK_BufferTriple *sspo, const VOLK_Buffer *sc)
 Prototype: check for existence of a triple (T/F).
typedef VOLK_rc(* iter_next_fn_t) (void *it, VOLK_BufferTriple *sspo, VOLK_Buffer **ctx)
 Prototype: yield the matching triples and advance the iterator.
typedef void(* iter_free_fn_t) (void *it)
 Prototype: free an iterator allocated by a lookup.
typedef void *(* iter_txn_fn_t) (void *it)
 Prototype: get iterator active transaction handle.
typedef VOLK_rc(* store_remove_fn_t) (void *store, const VOLK_Buffer *ss, const VOLK_Buffer *sp, const VOLK_Buffer *so, const VOLK_Buffer *sc, void *udata, size_t *ct)
 Prototype: delete triples by pattern matching.
typedef VOLK_Buffer **(* store_ctx_list_fn_t) (void *store, void *txn)
 Prototype: Get index of all graph (context) URIs in a store.

Enumerations

enum  VOLK_StoreFeature {
  VOLK_STORE_PERM = 1<<0 , VOLK_STORE_CTX = 1<<1 , VOLK_STORE_IDX = 1<<2 , VOLK_STORE_TXN = 1<<3 ,
  VOLK_STORE_COW = 1<<4 , VOLK_STORE_EMBED = 1<<5
}
 Store feature flags. More...

Detailed Description

Common store back end interfaces.

Code using the store interface should include NOT this header, but rahter store.h.

This header is included by all back end implementations, which are in their turn included by store.h.

The basic interfaces for store and store iterator implementations are defined here. New store implementations should include this header and implement three basic elements:

  • A structure representing the store back end. This structure will be opaque to all downstream code and its layout is entirely up to the implementer.
  • A structure representing a store iterator state, also opaque.
  • The VOLK_StoreInt interface with all the functions defined in the interface necessary to interact with the store.

See the store_htable.{c,h} and store_mdb.{c,h} files for examples of fully functioning implementations.

The VOLK_StoreInt structure defines a store interface for raw buffer triples. Nothing in the store functions' signatures should hint at RDF triples—they should accept and produce exclusively raw byte buffers (VOLK_Buffer). A store interface may have any of the VOLK_STORE_* faeture flags which should be reflected in the way its members are implemented.

Definition in file store_interface.h.