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 214 of file bdb.c.
216{
217 if (!store)
218 return -1;
219
220
222
223 DBT dkey = { 0 };
224 DBT databuf = { 0 };
225
226 dbt_init(&dkey, (
void *) key, klen);
228 databuf.flags = DB_DBT_USERMEM;
229 databuf.data = value;
230 databuf.size = vlen;
231 databuf.ulen = vlen;
232
233 return sdata->
db->put(sdata->
db, NULL, &dkey, &databuf, 0);
234}
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 259 of file lmdb.c.
261{
262 if (!store)
263 return -1;
264
265 MDB_val dkey = { 0 };
266 MDB_val databuf = { 0 };
267
268
270
271 dkey.mv_data = (void *) key;
272 dkey.mv_size = klen;
273 databuf.mv_data = value;
274 databuf.mv_size = vlen;
276 if (rc != MDB_SUCCESS)
277 {
279 return rc;
280 }
281 rc = mdb_put(sdata->
txn, sdata->
db, &dkey, &databuf, 0);
282 if (rc != MDB_SUCCESS)
283 {
285 mdb_txn_abort(sdata->
txn);
288 }
289 return rc;
290}
#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 153 of file rocksdb.c.
155{
156 if (!store)
157 return -1;
158
159
161
164 {
165 rocksdb_free(sdata->
err);
167 return -1;
168 }
169
170 return 0;
171}
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}