Volksdata 1.0b7
RDF library
Loading...
Searching...
No Matches
Store interface module
Collaboration diagram for Store interface module:

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

Typedef Documentation

◆ store_setup_fn_t

typedef VOLK_rc(* store_setup_fn_t) (const char *id, bool clear)

Prototype: create any environment necessary for the store to work.

VOLK_store_new() calls this function before creating the store handle.

This function should be idempotent on separate calls to the same id, unless the clear option is set to true.

Parameters
[in,out]idIdentifier to use for the store. This should be a URI that uniquely identifies a back end for the implementation using it, e.g. a SQL connection string, file path for an embedded store, the URL of a REST API endpoint, etc. It may also be NULL, in which case it will be set to the default identifier set by the implementation. It can be retrieved from an existing store via store_id_fn_t() .
[in]clearWhether to remove an existing environment with the same ID.

Definition at line 108 of file store_interface.h.

◆ store_new_fn_t

typedef void *(* store_new_fn_t) (const char *id, size_t size)

Prototype: create a new store.

Parameters
[in]idIdentifier for the new store. How this is interpreted, and whether it is even used, depends on the implementation, which should provide documentation on how to pass and interpret this parameter.
[in]sizeInitial size for the store. It may be 0. Only meaningful for stores that may preallocate memory, such as HTStore.
Returns
New store handle or NULL in case of failure.

Definition at line 122 of file store_interface.h.

◆ store_free_fn_t

typedef void(* store_free_fn_t) (void *store)

Prototype: free store handle.

Parameters
[in]storeStore handle.

Definition at line 130 of file store_interface.h.

◆ store_size_fn_t

typedef size_t(* store_size_fn_t) (const void *store)

Prototype: get store size.

Parameters
[in]storeThe store to calculate size of.
Returns
Number of stored SPO triples (across all contexts if supported).

Definition at line 139 of file store_interface.h.

◆ store_id_fn_t

typedef char *(* store_id_fn_t) (const void *store)

Prototype: get the store ID.

Parameters
[in]storeStore handle.
Returns
store ID string. This is a copy and should be freed after use.

Definition at line 148 of file store_interface.h.

◆ store_txn_begin_fn_t

typedef VOLK_rc(* store_txn_begin_fn_t) (void *store, int flags, void **txn)

Begin a transaction.

Only for VOLK_STORE_TXN stores.

The transaction handle is managed by the store implementation and can be any data type.

Parameters
[in]storeStore handle.
[in]flagsTransaction flags. These vary with each implementation.
[out]txnWill point to the new open transaction on success, or to undefined content on failure.
Returns
VOLK_OK if the transaction started successfully, <0 on error.

Definition at line 178 of file store_interface.h.

◆ store_txn_commit_fn_t

typedef VOLK_rc(* store_txn_commit_fn_t) (void *txn)

Commit a transaction.

Only for VOLK_STORE_TXN stores.

Parameters
[in]txnTransaction handle initialized by store_txn_begin_fn_t().
Returns
VOLK_OK if the transaction was committed successfully, <0 on error.

Definition at line 189 of file store_interface.h.

◆ store_txn_abort_fn_t

typedef void(* store_txn_abort_fn_t) (void *txn)

Abort a transaction.

Only for VOLK_STORE_TXN stores.

Parameters
[in]txnTransaction handle initialized by store_txn_begin_fn_t().

Definition at line 198 of file store_interface.h.

◆ store_update_ctx_fn_t

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.

Only defined in stores with the VOLK_STORE_CTX feature.

See also
VOLK_store_update_ctx_txn()

Definition at line 207 of file store_interface.h.

◆ store_add_init_fn_t

typedef void *(* store_add_init_fn_t) (void *store, const VOLK_Buffer *sc, void *udata)

Initialize bulk triple load.

See also
VOLK_store_add_init_txn()

Definition at line 216 of file store_interface.h.

◆ store_add_iter_fn_t

typedef VOLK_rc(* store_add_iter_fn_t) (void *it, const VOLK_BufferTriple *sspo)

Add one triple into the store.

See also
VOLK_store_add_iter().

Definition at line 224 of file store_interface.h.

◆ store_add_abort_fn_t

typedef void(* store_add_abort_fn_t) (void *it)

Abort an add loop and free iterator.

Only available for stores with the VOLK_STORE_TXN feature.

See also
VOLK_store_add_abort().

Definition at line 234 of file store_interface.h.

◆ store_add_done_fn_t

typedef VOLK_rc(* store_add_done_fn_t) (void *it)

Finalize an add loop and free iterator.

See also
VOLK_store_add_done().

Definition at line 241 of file store_interface.h.

◆ store_add_term_fn_t

typedef VOLK_rc(* store_add_term_fn_t) (void *store, const VOLK_Buffer *sterm, void *udata)

Add a single term to the store.

See also
VOLK_store_add_term_txn().

Definition at line 248 of file store_interface.h.

◆ store_lookup_fn_t

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.

See also
VOLK_store_lookup_txn().

Definition at line 260 of file store_interface.h.

◆ store_trp_exist_fn_t

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).

Note
Unused interface function.
Parameters
[in]storeStore to be queried.
[in]sspoTriple to look up. All members must not be NULL.
[in]scOptional context to look into. It may be NULL. It is disregarded by stores without the VOLK_STORE_CTX feature.
Returns
Whether the triple exist in the store (/context).

Definition at line 279 of file store_interface.h.

◆ iter_next_fn_t

typedef VOLK_rc(* iter_next_fn_t) (void *it, VOLK_BufferTriple *sspo, VOLK_Buffer **ctx)

Prototype: yield the matching triples and advance the iterator.

See also
VOLK_store_iter_next().

Definition at line 287 of file store_interface.h.

◆ iter_free_fn_t

typedef void(* iter_free_fn_t) (void *it)

Prototype: free an iterator allocated by a lookup.

See also
VOLK_store_iter_free().

Definition at line 295 of file store_interface.h.

◆ iter_txn_fn_t

typedef void *(* iter_txn_fn_t) (void *it)

Prototype: get iterator active transaction handle.

See also
VOLK_store_iter_txn().

Definition at line 302 of file store_interface.h.

◆ store_remove_fn_t

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.

See also
VOLK_store_remove_txn().

Definition at line 309 of file store_interface.h.

◆ store_ctx_list_fn_t

typedef VOLK_Buffer **(* store_ctx_list_fn_t) (void *store, void *txn)

Prototype: Get index of all graph (context) URIs in a store.

See also
VOLK_store_ctx_list_txn()

Definition at line 319 of file store_interface.h.

Enumeration Type Documentation

◆ VOLK_StoreFeature

Store feature flags.

Enumerator
VOLK_STORE_PERM 

Store is on a permanent support.

                          @note need only be set by an
                          implementation based on whether the data
                          may be cleared after the after a graph
                          that uses it is freed. It is the
                          client's responsibility to guarantee
                          permanence beyond the lifespan of the
                          program.

                          A store featuring VOLK_STORE_PERM
                          MUST guarantee that the data remain
                          available on storage for the user to
                          further handle them. 
VOLK_STORE_CTX 

Store supports contexts (quads).

                          @note Only stores with this feature MAY
                          be used with multiple graphs and MUST
                          be freed explicitly. 
VOLK_STORE_IDX 

Store is fully SPO(C)-indexed.

VOLK_STORE_TXN 

Supports transaction handling.

VOLK_STORE_COW 

Copy on write.

See also
VOLK_store_iter_next()
VOLK_STORE_EMBED 

Embedded store.

                          Stores with this feature are exclusive
                          to one graph and are freed with it.
                          Therefore, something like
                          `VOLK_Graph *g1 = VOLK_graph_new
                        < (VOLK_store_new (VOLK_STORE_HTABLE,
                        < ...), NULL);
                        < VOLK_Graph *g2 = VOLK_graph_new
                        < (g1->store, NULL);` MUST be avoided. 

Definition at line 47 of file store_interface.h.