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 215 of file bdb.c.
217{
218 if (!store)
219 return -1;
220
221
223
224 DBT dkey = { 0 };
225 DBT databuf = { 0 };
226
227 dbt_init(&dkey, (
void *) key, klen);
229 databuf.flags = DB_DBT_USERMEM;
230 databuf.data = value;
231 databuf.size = vlen;
232 databuf.ulen = vlen;
233
234 return sdata->
db->put(sdata->
db, NULL, &dkey, &databuf, 0);
235}
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 94 of file gdbm.c.
96{
97 if (!store || (klen > INT_MAX) || (vlen > INT_MAX))
98 return -1;
99
100 datum dkey = { 0 };
101 datum databuf = { 0 };
102
103
104 GDBM_FILE db = store;
105
106 dkey.dptr = (char *) key;
107 dkey.dsize = klen;
108
109 databuf.dsize = vlen;
110 databuf.dptr = value;
111
112 return gdbm_store(db, dkey, databuf, GDBM_REPLACE);
113}
◆ 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 97 of file kc.c.
99{
100 if (!store)
101 return -1;
102
103
104 KCDB *db = store;
105 if (!kcdbset(db, key, klen, value, vlen))
106 {
107 int ecode = kcdbecode(db);
108 return ecode ? ecode : -1;
109 }
110 return 0;
111}
◆ 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 260 of file lmdb.c.
262{
263 if (!store)
264 return -1;
265
266 MDB_val dkey = { 0 };
267 MDB_val databuf = { 0 };
268
269
271
272 dkey.mv_data = (void *) key;
273 dkey.mv_size = klen;
274 databuf.mv_data = value;
275 databuf.mv_size = vlen;
277 if (rc != MDB_SUCCESS)
278 {
280 return rc;
281 }
282 rc = mdb_put(sdata->
txn, sdata->
db, &dkey, &databuf, 0);
283 if (rc != MDB_SUCCESS)
284 {
286 mdb_txn_abort(sdata->
txn);
289 }
290 return rc;
291}
#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 154 of file rocksdb.c.
156{
157 if (!store)
158 return -1;
159
160
162
165 {
166 rocksdb_free(sdata->
err);
168 return -1;
169 }
170
171 return 0;
172}
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 91 of file tc.c.
93{
94 if (!store)
95 return -1;
96
97
98 TCBDB *db = store;
99 if (!tcbdbput(db, key, klen, value, vlen))
100 {
101 int ecode = tcbdbecode(db);
102 return ecode ? ecode : -1;
103 }
104 return 0;
105}
◆ 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 93 of file tdb.c.
95{
96 if (!store)
97 return -1;
98
99
100 TDB_CONTEXT *db = store;
101 TDB_DATA dkey;
102 TDB_DATA databuf;
103
104 dkey.dptr = (unsigned char *) key;
105 dkey.dsize = klen;
106
107 databuf.dsize = vlen;
108 databuf.dptr = value;
109
110 return tdb_store(db, dkey, databuf, TDB_INSERT);
111}