Fetch a Value from the Store.
More...
|
static void * | store_bdb_fetch (StoreHandle *store, const char *key, size_t klen, size_t *vlen) |
| Fetch a Value from the Store - Implements StoreOps::fetch() -.
|
|
static void * | store_gdbm_fetch (StoreHandle *store, const char *key, size_t klen, size_t *vlen) |
| Fetch a Value from the Store - Implements StoreOps::fetch() -.
|
|
static void * | store_kyotocabinet_fetch (StoreHandle *store, const char *key, size_t klen, size_t *vlen) |
| Fetch a Value from the Store - Implements StoreOps::fetch() -.
|
|
static void * | store_lmdb_fetch (StoreHandle *store, const char *key, size_t klen, size_t *vlen) |
| Fetch a Value from the Store - Implements StoreOps::fetch() -.
|
|
static void * | store_qdbm_fetch (StoreHandle *store, const char *key, size_t klen, size_t *vlen) |
| Fetch a Value from the Store - Implements StoreOps::fetch() -.
|
|
static void * | store_rocksdb_fetch (StoreHandle *store, const char *key, size_t klen, size_t *vlen) |
| Fetch a Value from the Store - Implements StoreOps::fetch() -.
|
|
static void * | store_tokyocabinet_fetch (StoreHandle *store, const char *key, size_t klen, size_t *vlen) |
| Fetch a Value from the Store - Implements StoreOps::fetch() -.
|
|
static void * | store_tdb_fetch (StoreHandle *store, const char *key, size_t klen, size_t *vlen) |
| Fetch a Value from the Store - Implements StoreOps::fetch() -.
|
|
Fetch a Value from the Store.
- Parameters
-
[in] | store | Store retrieved via open() |
[in] | key | Key identifying the record |
[in] | klen | Length of the Key string |
[out] | vlen | Length of the Value |
- Return values
-
ptr | Success, Value associated with the Key |
NULL | Error, or Key not found |
◆ store_bdb_fetch()
static void * store_bdb_fetch |
( |
StoreHandle * |
store, |
|
|
const char * |
key, |
|
|
size_t |
klen, |
|
|
size_t * |
vlen |
|
) |
| |
|
static |
Fetch a Value from the Store - Implements StoreOps::fetch() -.
Definition at line 183 of file bdb.c.
184{
185 if (!store)
186 return NULL;
187
188
190
191 DBT dkey = { 0 };
192 DBT data = { 0 };
193
194 dbt_init(&dkey, (
void *) key, klen);
196 data.flags = DB_DBT_MALLOC;
197
198 sdata->
db->get(sdata->
db, NULL, &dkey, &data, 0);
199
200 *vlen = data.size;
201 return data.data;
202}
static void dbt_empty_init(DBT *dbt)
Initialise an empty BDB thing.
static void dbt_init(DBT *dbt, void *data, size_t len)
Initialise a BDB thing.
◆ store_gdbm_fetch()
static void * store_gdbm_fetch |
( |
StoreHandle * |
store, |
|
|
const char * |
key, |
|
|
size_t |
klen, |
|
|
size_t * |
vlen |
|
) |
| |
|
static |
Fetch a Value from the Store - Implements StoreOps::fetch() -.
Definition at line 64 of file gdbm.c.
65{
66 if (!store || (klen > INT_MAX))
67 return NULL;
68
69 datum dkey = { 0 };
70 datum data = { 0 };
71
72
73 GDBM_FILE db = store;
74
75 dkey.dptr = (char *) key;
76 dkey.dsize = klen;
77 data = gdbm_fetch(db, dkey);
78
79 *vlen = data.dsize;
80 return data.dptr;
81}
◆ store_kyotocabinet_fetch()
static void * store_kyotocabinet_fetch |
( |
StoreHandle * |
store, |
|
|
const char * |
key, |
|
|
size_t |
klen, |
|
|
size_t * |
vlen |
|
) |
| |
|
static |
Fetch a Value from the Store - Implements StoreOps::fetch() -.
Definition at line 71 of file kc.c.
73{
74 if (!store)
75 return NULL;
76
77
78 KCDB *db = store;
79 return kcdbget(db, key, klen, vlen);
80}
◆ store_lmdb_fetch()
static void * store_lmdb_fetch |
( |
StoreHandle * |
store, |
|
|
const char * |
key, |
|
|
size_t |
klen, |
|
|
size_t * |
vlen |
|
) |
| |
|
static |
Fetch a Value from the Store - Implements StoreOps::fetch() -.
Definition at line 212 of file lmdb.c.
213{
214 if (!store)
215 return NULL;
216
217 MDB_val dkey = { 0 };
218 MDB_val data = { 0 };
219
220
222
223 dkey.mv_data = (void *) key;
224 dkey.mv_size = klen;
225 data.mv_data = NULL;
226 data.mv_size = 0;
228 if (rc != MDB_SUCCESS)
229 {
232 return NULL;
233 }
234 rc = mdb_get(sdata->
txn, sdata->
db, &dkey, &data);
235 if (rc == MDB_NOTFOUND)
236 {
237 return NULL;
238 }
239 if (rc != MDB_SUCCESS)
240 {
242 return NULL;
243 }
244
245 *vlen = data.mv_size;
246 return data.mv_data;
247}
#define mutt_debug(LEVEL,...)
static int lmdb_get_read_txn(struct LmdbStoreData *sdata)
Get an LMDB read transaction.
@ LL_DEBUG2
Log at debug level 2.
◆ store_qdbm_fetch()
static void * store_qdbm_fetch |
( |
StoreHandle * |
store, |
|
|
const char * |
key, |
|
|
size_t |
klen, |
|
|
size_t * |
vlen |
|
) |
| |
|
static |
Fetch a Value from the Store - Implements StoreOps::fetch() -.
Definition at line 56 of file qdbm.c.
57{
58 if (!store)
59 return NULL;
60
61
62 VILLA *db = store;
63 int sp = 0;
64 void *rv = vlget(db, key, klen, &sp);
65 *vlen = sp;
66 return rv;
67}
◆ store_rocksdb_fetch()
static void * store_rocksdb_fetch |
( |
StoreHandle * |
store, |
|
|
const char * |
key, |
|
|
size_t |
klen, |
|
|
size_t * |
vlen |
|
) |
| |
|
static |
Fetch a Value from the Store - Implements StoreOps::fetch() -.
Definition at line 124 of file rocksdb.c.
125{
126 if (!store)
127 return NULL;
128
129
131
132 void *rv = rocksdb_get(sdata->
db, sdata->
read_options, key, klen, vlen, &sdata->
err);
134 {
135 rocksdb_free(sdata->
err);
137 return NULL;
138 }
139
140 return rv;
141}
rocksdb_readoptions_t * read_options
◆ store_tokyocabinet_fetch()
static void * store_tokyocabinet_fetch |
( |
StoreHandle * |
store, |
|
|
const char * |
key, |
|
|
size_t |
klen, |
|
|
size_t * |
vlen |
|
) |
| |
|
static |
Fetch a Value from the Store - Implements StoreOps::fetch() -.
Definition at line 66 of file tc.c.
68{
69 if (!store)
70 return NULL;
71
72
73 TCBDB *db = store;
74 int sp = 0;
75 void *rv = tcbdbget(db, key, klen, &sp);
76 *vlen = sp;
77 return rv;
78}
◆ store_tdb_fetch()
static void * store_tdb_fetch |
( |
StoreHandle * |
store, |
|
|
const char * |
key, |
|
|
size_t |
klen, |
|
|
size_t * |
vlen |
|
) |
| |
|
static |
Fetch a Value from the Store - Implements StoreOps::fetch() -.
Definition at line 64 of file tdb.c.
65{
66 if (!store)
67 return NULL;
68
69
70 TDB_CONTEXT *db = store;
71 TDB_DATA dkey;
72 TDB_DATA data;
73
74 dkey.dptr = (unsigned char *) key;
75 dkey.dsize = klen;
76 data = tdb_fetch(db, dkey);
77
78 *vlen = data.dsize;
79 return data.dptr;
80}