Volksdata 1.0b7
RDF library
Loading...
Searching...
No Matches
store_mdb.c File Reference
Include dependency graph for store_mdb.c:

Go to the source code of this file.

Data Structures

struct  MDBStore
struct  MDBIterator
 Triple iterator. More...

Macros

#define N_DB   10
#define DEFAULT_MAPSIZE   1<<31
#define ENV_DIR_MODE   0750
#define ENV_FILE_MODE   0640
#define DUPSORT_MASK   MDB_DUPSORT
#define DUPFIXED_MASK   MDB_DUPSORT | MDB_DUPFIXED
#define MAIN_TABLE
#define LOOKUP_TABLE
#define ENTRY(a, b, c)
#define ENTRY(a, b, c)
#define ENTRY(a, b, c)
#define ENTRY(a, b, c)
#define ENTRY(a, b, c)

Typedefs

typedef char DbLabel[8]
typedef struct mdbstore_iter_t MDBIterator
typedef void(* iter_op_fn_t) (MDBIterator *it)
 Iterator operation.

Enumerations

enum  StoreFlags { LSSTORE_OPEN = 1<<0 }
 Store state flags. More...
enum  IterFlags { ITER_OPEN_TXN = 1<<0 }
 Iterator state flags. More...
enum  StoreOp { OP_ADD , OP_REMOVE }
enum  DBIdx { LOOKUP_TABLE }

Functions

char * mdbstore_id (const void *h)
VOLK_Buffer ** mdbstore_ctx_list (void *h, void *th)

Variables

const VOLK_StoreInt mdbstore_int
 MDB store interface.

Macro Definition Documentation

◆ N_DB

#define N_DB   10

Number of DBs defined. See MAIN_TABLE and LOOKUP_TABLE defines below.

Definition at line 6 of file store_mdb.c.

◆ DEFAULT_MAPSIZE

#define DEFAULT_MAPSIZE   1<<31

Memory map size.

Definition at line 15 of file store_mdb.c.

◆ ENV_DIR_MODE

#define ENV_DIR_MODE   0750

Definition at line 20 of file store_mdb.c.

◆ ENV_FILE_MODE

#define ENV_FILE_MODE   0640

Definition at line 21 of file store_mdb.c.

◆ DUPSORT_MASK

#define DUPSORT_MASK   MDB_DUPSORT

Definition at line 102 of file store_mdb.c.

◆ DUPFIXED_MASK

#define DUPFIXED_MASK   MDB_DUPSORT | MDB_DUPFIXED

Definition at line 103 of file store_mdb.c.

◆ MAIN_TABLE

#define MAIN_TABLE
Value:
/* #ID pfx #DB label #Flags */ \
ENTRY( T_ST, "t:st", 0 ) /* Key to ser. term */ \
ENTRY( SPO_C, "spo:c", DUPFIXED_MASK ) /* Triple to context */ \
ENTRY( IDK_ID, "idk:id", 0 ) /* ID key to ID */ \
#define DUPFIXED_MASK
Definition store_mdb.c:103

Main DBs. These are the master information containers.

The number of entries must match the N_DB constant defined above.

Definition at line 110 of file store_mdb.c.

◆ LOOKUP_TABLE

#define LOOKUP_TABLE
Value:
/* #ID pfx #DB label #Flags */ \
ENTRY( S_PO, "s:po", DUPFIXED_MASK ) /* 1-bound lookup */ \
ENTRY( P_SO, "p:so", DUPFIXED_MASK ) /* 1-bound lookup */ \
ENTRY( O_SP, "o:sp", DUPFIXED_MASK ) /* 1-bound lookup */ \
ENTRY( PO_S, "po:s", DUPFIXED_MASK ) /* 2-bound lookup */ \
ENTRY( SO_P, "so:p", DUPFIXED_MASK ) /* 2-bound lookup */ \
ENTRY( SP_O, "sp:o", DUPFIXED_MASK ) /* 2-bound lookup */ \
ENTRY( C_SPO, "c:spo", DUPFIXED_MASK ) /* Context lookup */ \

Lookup DBs. These are indices and may be destroyed and rebuilt.

Definition at line 119 of file store_mdb.c.

◆ ENTRY [1/5]

#define ENTRY ( a,
b,
c )
Value:
static const DbLabel DB_##a = b;
char DbLabel[8]
Definition store_mdb.c:27

DB labels. They are prefixed with DB_

Definition at line 132 of file store_mdb.c.

◆ ENTRY [2/5]

#define ENTRY ( a,
b,
c )
Value:
IDX_##a,

DB labels. They are prefixed with DB_

Definition at line 132 of file store_mdb.c.

◆ ENTRY [3/5]

#define ENTRY ( a,
b,
c )
Value:
DB_##a,

DB labels. They are prefixed with DB_

Definition at line 132 of file store_mdb.c.

◆ ENTRY [4/5]

#define ENTRY ( a,
b,
c )
Value:
c,

DB labels. They are prefixed with DB_

Definition at line 132 of file store_mdb.c.

◆ ENTRY [5/5]

#define ENTRY ( a,
b,
c )
Value:
IDX_##a,

DB labels. They are prefixed with DB_

Definition at line 132 of file store_mdb.c.

Typedef Documentation

◆ DbLabel

typedef char DbLabel[8]

Definition at line 27 of file store_mdb.c.

◆ MDBIterator

typedef struct mdbstore_iter_t MDBIterator

Definition at line 28 of file store_mdb.c.

◆ iter_op_fn_t

typedef void(* iter_op_fn_t) (MDBIterator *it)

Iterator operation.

Function executed for each iteration of a MDBIterator. It assumes that a result triple has already been found and is ready to be composed and yielded.

Upon call, the rc value of the iterator structure is set to the MDB_* rc value for the next result. It is up to the caller to evaluate this value and decide whether to call the function again.

Definition at line 70 of file store_mdb.c.

Enumeration Type Documentation

◆ StoreFlags

enum StoreFlags

Store state flags.

Enumerator
LSSTORE_OPEN 

Env is open.

Definition at line 31 of file store_mdb.c.

◆ IterFlags

enum IterFlags

Iterator state flags.

Enumerator
ITER_OPEN_TXN 

A transaction is open.

                          The iterator has begun a new
                          transaction on initialization
                          which needs to be closed.  If
                          false, the iterator is using an
                          existing transaction which will
                          not be closed with
                          #mdbiter_free().

Definition at line 36 of file store_mdb.c.

◆ StoreOp

enum StoreOp
Enumerator
OP_ADD 
OP_REMOVE 

Definition at line 49 of file store_mdb.c.

◆ DBIdx

enum DBIdx
Enumerator
LOOKUP_TABLE 

Definition at line 143 of file store_mdb.c.

Function Documentation

◆ mdbstore_id()

char * mdbstore_id ( const void * h)

Definition at line 439 of file store_mdb.c.

◆ mdbstore_ctx_list()

VOLK_Buffer ** mdbstore_ctx_list ( void * h,
void * th )

Definition at line 1221 of file store_mdb.c.

Variable Documentation

◆ mdbstore_int

const VOLK_StoreInt mdbstore_int

MDB store interface.

Definition at line 1261 of file store_mdb.c.