Volksdata 1.0b10
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;
66
68 void * data;
70
71
74const VOLK_StoreInt *
76
77
84const char *
86
87
110 const VOLK_StoreType store_type, const char *store_id, size_t size,
111 bool clear);
112
113
118void
120
121
128size_t
129VOLK_store_size (const VOLK_Store *store);
130
131
134VOLK_store_features (const VOLK_Store *store);
135
136
138char *
139VOLK_store_id (const VOLK_Store *store);
140
141
161VOLK_store_begin (VOLK_Store *store, VOLK_StoreFlags 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
239void *
241 VOLK_Store *store, void *txn, const VOLK_Buffer *sc);
242
244#define VOLK_store_add_init(store, ...) \
245 VOLK_store_add_init_txn (store, NULL, __VA_ARGS__)
246
247
265 VOLK_Store *store, void *it, const VOLK_BufferTriple *sspo);
266
267
277void
278VOLK_store_add_abort (VOLK_Store *store, void *it);
279
280
293VOLK_store_add_done (VOLK_Store *store, void *it);
294
295
306VOLK_store_add_term_txn (VOLK_Store *store, void *txn, VOLK_Buffer *sterm);
307
309#define VOLK_store_add_term(store, ...) \
310 VOLK_store_add_term_txn (store, NULL, __VA_ARGS__)
311
312
350void *
352 const VOLK_Store *store, void *txn,
353 const VOLK_Buffer *ss, const VOLK_Buffer *sp, const VOLK_Buffer *so,
354 const VOLK_Buffer *sc, size_t *ct);
355
357#define VOLK_store_lookup(store, ...) \
358 VOLK_store_lookup_txn (store, NULL, __VA_ARGS__)
359
360
402 VOLK_Store *store, void *it, VOLK_BufferTriple *sspo,
403 VOLK_Buffer **ctx);
404
405
412void
413VOLK_store_iter_free (VOLK_Store *store, void *it);
414
415
430void *
431VOLK_store_iter_txn (const VOLK_Store *store, void *it);
432
433
460 VOLK_Store *store, void *txn,
461 const VOLK_Buffer *ss, const VOLK_Buffer *sp, const VOLK_Buffer *so,
462 const VOLK_Buffer *sc, size_t *ct);
463
465#define VOLK_store_remove(store, ...) \
466 VOLK_store_remove_txn (store, NULL, __VA_ARGS__)
467
468
481VOLK_store_ctx_list_txn (VOLK_Store *store, void *txn);
482
484#define VOLK_store_ctx_list(store) \
485 VOLK_store_ctx_list_txn (store, NULL)
486
488
489#endif // VOLK_STORE_H
int VOLK_rc
Return code.
Definition core.h:91
void * VOLK_store_add_init_txn(VOLK_Store *store, void *txn, const VOLK_Buffer *sc)
Initialize bulk triple load.
Definition store.c:136
VOLK_rc VOLK_store_add_done(VOLK_Store *store, void *it)
Finalize an add loop and free iterator.
Definition store.c:160
void VOLK_store_add_abort(VOLK_Store *store, void *it)
Abort an add loop and free iterator.
Definition store.c:148
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:142
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:165
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:170
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:184
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:224
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:199
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:204
VOLK_rc VOLK_store_begin(VOLK_Store *store, VOLK_StoreFlags flags, void **txn)
Begin a transaction.
Definition store.c:96
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:216
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
VOLK_StoreFlags
Store flags passed to various operations.
VOLK_StoreFeature
Store feature flags.
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
Opaque back end data.
Definition store.h:68
char * id
Definition store.h:61
const VOLK_StoreInt * sif
Store interface.
Definition store.h:67
VOLK_StoreType type
Store type.
Definition store.h:60