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
160VOLK_store_begin (VOLK_Store *store, VOLK_StoreFlags flags, void **txn);
161
162
177VOLK_store_commit (VOLK_Store *store, void *txn);
178
179
188void
189VOLK_store_abort (VOLK_Store *store, void *txn);
190
191
211 VOLK_Store *store, void *txn, const VOLK_Buffer *old_c,
212 const VOLK_Buffer *new_c);
213
214#define VOLK_store_update_ctx(store, ...) \
215 VOLK_store_update_txn (store, NULL, __VA_ARGS__)
216
217
237void *
239 VOLK_Store *store, void *txn, const VOLK_Buffer *sc);
240
242#define VOLK_store_add_init(store, ...) \
243 VOLK_store_add_init_txn (store, NULL, __VA_ARGS__)
244
245
263 VOLK_Store *store, void *it, const VOLK_BufferTriple *sspo);
264
265
275void
276VOLK_store_add_abort (VOLK_Store *store, void *it);
277
278
291VOLK_store_add_done (VOLK_Store *store, void *it);
292
293
304VOLK_store_add_term_txn (VOLK_Store *store, void *txn, VOLK_Buffer *sterm);
305
307#define VOLK_store_add_term(store, ...) \
308 VOLK_store_add_term_txn (store, NULL, __VA_ARGS__)
309
310
348void *
350 const VOLK_Store *store, void *txn,
351 const VOLK_Buffer *ss, const VOLK_Buffer *sp, const VOLK_Buffer *so,
352 const VOLK_Buffer *sc, size_t *ct);
353
355#define VOLK_store_lookup(store, ...) \
356 VOLK_store_lookup_txn (store, NULL, __VA_ARGS__)
357
358
398 VOLK_Store *store, void *it, VOLK_BufferTriple *sspo,
399 VOLK_Buffer **ctx);
400
401
408void
409VOLK_store_iter_free (VOLK_Store *store, void *it);
410
411
426void *
427VOLK_store_iter_txn (const VOLK_Store *store, void *it);
428
429
456 VOLK_Store *store, void *txn,
457 const VOLK_Buffer *ss, const VOLK_Buffer *sp, const VOLK_Buffer *so,
458 const VOLK_Buffer *sc, size_t *ct);
459
461#define VOLK_store_remove(store, ...) \
462 VOLK_store_remove_txn (store, NULL, __VA_ARGS__)
463
464
477VOLK_store_ctx_list_txn (VOLK_Store *store, void *txn);
478
480#define VOLK_store_ctx_list(store) \
481 VOLK_store_ctx_list_txn (store, NULL)
482
484
485#endif // VOLK_STORE_H
int VOLK_rc
Definition core.h:79
VOLK_StoreFlags
Store flags passed to various operations.
VOLK_StoreFeature
Store feature flags.
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_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: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