Volksdata 1.0b7
RDF library
Loading...
Searching...
No Matches
store.h
Go to the documentation of this file.
1
12
13#ifndef VOLK_STORE_H
14#define VOLK_STORE_H
15
16/*
17 * Add new back end headers here.
18 */
20#include "volksdata/store_mdb.h"
21
26
27/*
28 * Define backend types.
29 *
30 * Add new store implementations to this table.
31 */
32#define BACKEND_TBL \
33/* #enum suffix#store if */\
34 ENTRY( HTABLE, htstore_int ) \
35 ENTRY( MDB, mdbstore_int ) \
36
37
39typedef enum {
40#define ENTRY(a, b) \
41 VOLK_STORE_##a,
43#undef ENTRY
45
46
59typedef struct store_t {
61 char * id;
65
67 void * data;
69
70
73const VOLK_StoreInt *
75
76
83const char *
85
86
109 const VOLK_StoreType store_type, const char *store_id, size_t size,
110 bool clear);
111
112
117void
119
120
127size_t
128VOLK_store_size (const VOLK_Store *store);
129
130
133VOLK_store_features (const VOLK_Store *store);
134
135
137char *
138VOLK_store_id (const VOLK_Store *store);
139
140
161VOLK_store_begin (VOLK_Store *store, int flags, void **txn);
162
163
178VOLK_store_commit (VOLK_Store *store, void *txn);
179
180
189void
190VOLK_store_abort (VOLK_Store *store, void *txn);
191
192
212 VOLK_Store *store, void *txn, const VOLK_Buffer *old_c,
213 const VOLK_Buffer *new_c);
214
215#define VOLK_store_update_ctx(store, ...) \
216 VOLK_store_update_txn (store, NULL, __VA_ARGS__)
217
218
238void *
240 VOLK_Store *store, void *txn, const VOLK_Buffer *sc);
241
243#define VOLK_store_add_init(store, ...) \
244 VOLK_store_add_init_txn (store, NULL, __VA_ARGS__)
245
246
264 VOLK_Store *store, void *it, const VOLK_BufferTriple *sspo);
265
266
276void
277VOLK_store_add_abort (VOLK_Store *store, void *it);
278
279
292VOLK_store_add_done (VOLK_Store *store, void *it);
293
294
305VOLK_store_add_term_txn (VOLK_Store *store, void *txn, VOLK_Buffer *sterm);
306
308#define VOLK_store_add_term(store, ...) \
309 VOLK_store_add_term_txn (store, NULL, __VA_ARGS__)
310
311
349void *
351 const VOLK_Store *store, void *txn,
352 const VOLK_Buffer *ss, const VOLK_Buffer *sp, const VOLK_Buffer *so,
353 const VOLK_Buffer *sc, size_t *ct);
354
356#define VOLK_store_lookup(store, ...) \
357 VOLK_store_lookup_txn (store, NULL, __VA_ARGS__)
358
359
399 VOLK_Store *store, void *it, VOLK_BufferTriple *sspo,
400 VOLK_Buffer **ctx);
401
402
409void
410VOLK_store_iter_free (VOLK_Store *store, void *it);
411
412
427void *
428VOLK_store_iter_txn (const VOLK_Store *store, void *it);
429
430
457 VOLK_Store *store, void *txn,
458 const VOLK_Buffer *ss, const VOLK_Buffer *sp, const VOLK_Buffer *so,
459 const VOLK_Buffer *sc, size_t *ct);
460
462#define VOLK_store_remove(store, ...) \
463 VOLK_store_remove_txn (store, NULL, __VA_ARGS__)
464
465
478VOLK_store_ctx_list_txn (VOLK_Store *store, void *txn);
479
481#define VOLK_store_ctx_list(store) \
482 VOLK_store_ctx_list_txn (store, NULL)
483
485
486#endif // VOLK_STORE_H
int VOLK_rc
Definition core.h:79
VOLK_StoreFeature
Store feature flags.
VOLK_rc VOLK_store_begin(VOLK_Store *store, int flags, void **txn)
Begin a transaction.
Definition store.c:96
void * VOLK_store_add_init_txn(VOLK_Store *store, void *txn, const VOLK_Buffer *sc)
Initialize bulk triple load.
Definition store.c:137
VOLK_rc VOLK_store_add_done(VOLK_Store *store, void *it)
Finalize an add loop and free iterator.
Definition store.c:162
void VOLK_store_add_abort(VOLK_Store *store, void *it)
Abort an add loop and free iterator.
Definition store.c:150
const VOLK_StoreInt * VOLK_store_int(VOLK_StoreType type)
Return store interface for a specific type.
Definition store.c:6
VOLK_rc VOLK_store_add_iter(VOLK_Store *store, void *it, const VOLK_BufferTriple *sspo)
Add one triple into the store.
Definition store.c:144
VOLK_StoreFeature VOLK_store_features(const VOLK_Store *store)
Feature flags belonging to the store interface.
Definition store.c:86
VOLK_rc VOLK_store_add_term_txn(VOLK_Store *store, void *txn, VOLK_Buffer *sterm)
Add a single term to the store.
Definition store.c:167
void * VOLK_store_lookup_txn(const VOLK_Store *store, void *txn, const VOLK_Buffer *ss, const VOLK_Buffer *sp, const VOLK_Buffer *so, const VOLK_Buffer *sc, size_t *ct)
Look up triples by pattern matching.
Definition store.c:172
VOLK_rc VOLK_store_iter_next(VOLK_Store *store, void *it, VOLK_BufferTriple *sspo, VOLK_Buffer **ctx)
Yield the matching triples and advance the iterator.
Definition store.c:186
char * VOLK_store_id(const VOLK_Store *store)
Store identifier.
Definition store.c:91
VOLK_Buffer ** VOLK_store_ctx_list_txn(VOLK_Store *store, void *txn)
get index of all graph (context) URIs in a store.
Definition store.c:226
VOLK_StoreType
Store types. All prefixed with VOLK_STORE_.
Definition store.h:39
void VOLK_store_iter_free(VOLK_Store *store, void *it)
Free an iterator allocated by a lookup.
Definition store.c:201
const char * VOLK_store_type_label(VOLK_StoreType type)
Return the store type label.
Definition store.c:16
size_t VOLK_store_size(const VOLK_Store *store)
Store size in triples.
Definition store.c:81
VOLK_Store * VOLK_store_new(const VOLK_StoreType store_type, const char *store_id, size_t size, bool clear)
Create a new store.
Definition store.c:28
void * VOLK_store_iter_txn(const VOLK_Store *store, void *it)
Get iterator active transaction handle.
Definition store.c:206
VOLK_rc VOLK_store_commit(VOLK_Store *store, void *txn)
Commit a transaction.
Definition store.c:105
VOLK_rc VOLK_store_remove_txn(VOLK_Store *store, void *txn, const VOLK_Buffer *ss, const VOLK_Buffer *sp, const VOLK_Buffer *so, const VOLK_Buffer *sc, size_t *ct)
Delete triples by pattern matching.
Definition store.c:218
void VOLK_store_abort(VOLK_Store *store, void *txn)
Abort (roll back) a transaction.
Definition store.c:115
void VOLK_store_free(VOLK_Store *store)
Free a store created with VOLK_store_new().
Definition store.c:69
VOLK_rc VOLK_store_update_ctx_txn(VOLK_Store *store, void *txn, const VOLK_Buffer *old_c, const VOLK_Buffer *new_c)
Update the context of triples in a context-aware store.
Definition store.c:124
#define BACKEND_TBL
Definition store.h:32
Simple in-memory triple store back end based on hash tables.
LMDB graph store backend.
Triple of byte buffers.
Definition buffer.h:60
General-purpose data buffer.
Definition buffer.h:47
Store interface.
Store structure.
Definition store.h:59
void * data
Store back end data.
Definition store.h:67
char * id
Definition store.h:61
const VOLK_StoreInt * sif
Store interface.
Definition store.h:66
VOLK_StoreType type
Store type.
Definition store.h:60