Write a Value to the Store.
More...
|
static int | store_bdb_store (StoreHandle *store, const char *key, size_t klen, void *value, size_t vlen) |
| Write a Value to the Store - Implements StoreOps::store() -.
|
|
static int | store_gdbm_store (StoreHandle *store, const char *key, size_t klen, void *value, size_t vlen) |
| Write a Value to the Store - Implements StoreOps::store() -.
|
|
static int | store_kyotocabinet_store (StoreHandle *store, const char *key, size_t klen, void *value, size_t vlen) |
| Write a Value to the Store - Implements StoreOps::store() -.
|
|
static int | store_lmdb_store (StoreHandle *store, const char *key, size_t klen, void *value, size_t vlen) |
| Write a Value to the Store - Implements StoreOps::store() -.
|
|
static int | store_qdbm_store (StoreHandle *store, const char *key, size_t klen, void *value, size_t vlen) |
| Write a Value to the Store - Implements StoreOps::store() -.
|
|
static int | store_rocksdb_store (StoreHandle *store, const char *key, size_t klen, void *value, size_t vlen) |
| Write a Value to the Store - Implements StoreOps::store() -.
|
|
static int | store_tokyocabinet_store (StoreHandle *store, const char *key, size_t klen, void *value, size_t vlen) |
| Write a Value to the Store - Implements StoreOps::store() -.
|
|
static int | store_tdb_store (StoreHandle *store, const char *key, size_t klen, void *value, size_t vlen) |
| Write a Value to the Store - Implements StoreOps::store() -.
|
|
Write a Value to the Store.
- Parameters
-
[in] | store | Store retrieved via open() |
[in] | key | Key identifying the record |
[in] | klen | Length of the Key string |
[in] | value | Value to save |
[in] | vlen | Length of the Value |
- Return values
-
0 | Success |
num | Error, a backend-specific error code |
◆ store_bdb_store()
static int store_bdb_store |
( |
StoreHandle * |
store, |
|
|
const char * |
key, |
|
|
size_t |
klen, |
|
|
void * |
value, |
|
|
size_t |
vlen |
|
) |
| |
|
static |
Write a Value to the Store - Implements StoreOps::store() -.
Definition at line 213 of file bdb.c.
215{
216 if (!store)
217 return -1;
218
219
221
222 DBT dkey = { 0 };
223 DBT databuf = { 0 };
224
225 dbt_init(&dkey, (
void *) key, klen);
227 databuf.flags = DB_DBT_USERMEM;
228 databuf.data = value;
229 databuf.size = vlen;
230 databuf.ulen = vlen;
231
232 return sdata->
db->put(sdata->
db, NULL, &dkey, &databuf, 0);
233}
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_store()
static int store_gdbm_store |
( |
StoreHandle * |
store, |
|
|
const char * |
key, |
|
|
size_t |
klen, |
|
|
void * |
value, |
|
|
size_t |
vlen |
|
) |
| |
|
static |
Write a Value to the Store - Implements StoreOps::store() -.
Definition at line 92 of file gdbm.c.
94{
95 if (!store || (klen > INT_MAX) || (vlen > INT_MAX))
96 return -1;
97
98 datum dkey = { 0 };
99 datum databuf = { 0 };
100
101
102 GDBM_FILE db = store;
103
104 dkey.dptr = (char *) key;
105 dkey.dsize = klen;
106
107 databuf.dsize = vlen;
108 databuf.dptr = value;
109
110 return gdbm_store(db, dkey, databuf, GDBM_REPLACE);
111}
◆ store_kyotocabinet_store()
static int store_kyotocabinet_store |
( |
StoreHandle * |
store, |
|
|
const char * |
key, |
|
|
size_t |
klen, |
|
|
void * |
value, |
|
|
size_t |
vlen |
|
) |
| |
|
static |
Write a Value to the Store - Implements StoreOps::store() -.
Definition at line 96 of file kc.c.
98{
99 if (!store)
100 return -1;
101
102
103 KCDB *db = store;
104 if (!kcdbset(db, key, klen, value, vlen))
105 {
106 int ecode = kcdbecode(db);
107 return ecode ? ecode : -1;
108 }
109 return 0;
110}
◆ store_lmdb_store()
static int store_lmdb_store |
( |
StoreHandle * |
store, |
|
|
const char * |
key, |
|
|
size_t |
klen, |
|
|
void * |
value, |
|
|
size_t |
vlen |
|
) |
| |
|
static |
Write a Value to the Store - Implements StoreOps::store() -.
Definition at line 253 of file lmdb.c.
255{
256 if (!store)
257 return -1;
258
259 MDB_val dkey = { 0 };
260 MDB_val databuf = { 0 };
261
262
264
265 dkey.mv_data = (void *) key;
266 dkey.mv_size = klen;
267 databuf.mv_data = value;
268 databuf.mv_size = vlen;
270 if (rc != MDB_SUCCESS)
271 {
273 return rc;
274 }
275 rc = mdb_put(sdata->
txn, sdata->
db, &dkey, &databuf, 0);
276 if (rc != MDB_SUCCESS)
277 {
279 mdb_txn_abort(sdata->
txn);
282 }
283 return rc;
284}
#define mutt_debug(LEVEL,...)
static int lmdb_get_write_txn(struct LmdbStoreData *sdata)
Get an LMDB write transaction.
@ TXN_UNINITIALIZED
Transaction is uninitialised.
@ LL_DEBUG2
Log at debug level 2.
enum LmdbTxnMode txn_mode
◆ store_qdbm_store()
static int store_qdbm_store |
( |
StoreHandle * |
store, |
|
|
const char * |
key, |
|
|
size_t |
klen, |
|
|
void * |
value, |
|
|
size_t |
vlen |
|
) |
| |
|
static |
Write a Value to the Store - Implements StoreOps::store() -.
Definition at line 80 of file qdbm.c.
82{
83 if (!store)
84 return -1;
85
86
87 VILLA *db = store;
88
89
90 bool success = vlput(db, key, klen, value, vlen, VL_DOVER);
91 return success ? 0 : dpecode ? dpecode : -1;
92}
◆ store_rocksdb_store()
static int store_rocksdb_store |
( |
StoreHandle * |
store, |
|
|
const char * |
key, |
|
|
size_t |
klen, |
|
|
void * |
value, |
|
|
size_t |
vlen |
|
) |
| |
|
static |
Write a Value to the Store - Implements StoreOps::store() -.
Definition at line 150 of file rocksdb.c.
152{
153 if (!store)
154 return -1;
155
156
158
161 {
162 rocksdb_free(sdata->
err);
164 return -1;
165 }
166
167 return 0;
168}
rocksdb_writeoptions_t * write_options
◆ store_tokyocabinet_store()
static int store_tokyocabinet_store |
( |
StoreHandle * |
store, |
|
|
const char * |
key, |
|
|
size_t |
klen, |
|
|
void * |
value, |
|
|
size_t |
vlen |
|
) |
| |
|
static |
Write a Value to the Store - Implements StoreOps::store() -.
Definition at line 90 of file tc.c.
92{
93 if (!store)
94 return -1;
95
96
97 TCBDB *db = store;
98 if (!tcbdbput(db, key, klen, value, vlen))
99 {
100 int ecode = tcbdbecode(db);
101 return ecode ? ecode : -1;
102 }
103 return 0;
104}
◆ store_tdb_store()
static int store_tdb_store |
( |
StoreHandle * |
store, |
|
|
const char * |
key, |
|
|
size_t |
klen, |
|
|
void * |
value, |
|
|
size_t |
vlen |
|
) |
| |
|
static |
Write a Value to the Store - Implements StoreOps::store() -.
Definition at line 91 of file tdb.c.
93{
94 if (!store)
95 return -1;
96
97
98 TDB_CONTEXT *db = store;
99 TDB_DATA dkey;
100 TDB_DATA databuf;
101
102 dkey.dptr = (unsigned char *) key;
103 dkey.dsize = klen;
104
105 databuf.dsize = vlen;
106 databuf.dptr = value;
107
108 return tdb_store(db, dkey, databuf, TDB_INSERT);
109}