NeoMutt  2024-10-02-37-gfa9146
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
delete_record()

Delete a record from the Store. More...

+ Collaboration diagram for delete_record():

Functions

static int store_bdb_delete_record (StoreHandle *store, const char *key, size_t klen)
 Delete a record from the Store - Implements StoreOps::delete_record() -.
 
static int store_gdbm_delete_record (StoreHandle *store, const char *key, size_t klen)
 Delete a record from the Store - Implements StoreOps::delete_record() -.
 
static int store_kyotocabinet_delete_record (StoreHandle *store, const char *key, size_t klen)
 Delete a record from the Store - Implements StoreOps::delete_record() -.
 
static int store_lmdb_delete_record (StoreHandle *store, const char *key, size_t klen)
 Delete a record from the Store - Implements StoreOps::delete_record() -.
 
static int store_qdbm_delete_record (StoreHandle *store, const char *key, size_t klen)
 Delete a record from the Store - Implements StoreOps::delete_record() -.
 
static int store_rocksdb_delete_record (StoreHandle *store, const char *key, size_t klen)
 Delete a record from the Store - Implements StoreOps::delete_record() -.
 
static int store_tokyocabinet_delete_record (StoreHandle *store, const char *key, size_t klen)
 Delete a record from the Store - Implements StoreOps::delete_record() -.
 
static int store_tdb_delete_record (StoreHandle *store, const char *key, size_t klen)
 Delete a record from the Store - Implements StoreOps::delete_record() -.
 

Detailed Description

Delete a record from the Store.

Parameters
[in]storeStore retrieved via open()
[in]keyKey identifying the record
[in]klenLength of the Key string
Return values
0Success
numError, a backend-specific error code

Function Documentation

◆ store_bdb_delete_record()

static int store_bdb_delete_record ( StoreHandle store,
const char *  key,
size_t  klen 
)
static

Delete a record from the Store - Implements StoreOps::delete_record() -.

Definition at line 240 of file bdb.c.

241{
242 if (!store)
243 return -1;
244
245 // Decloak an opaque pointer
246 struct BdbStoreData *sdata = store;
247
248 DBT dkey = { 0 };
249 dbt_init(&dkey, (void *) key, klen);
250 return sdata->db->del(sdata->db, NULL, &dkey, 0);
251}
static void dbt_init(DBT *dbt, void *data, size_t len)
Initialise a BDB thing.
Definition: bdb.c:88
Berkeley DB Store.
Definition: bdb.c:47
DB * db
Definition: bdb.c:49
+ Here is the call graph for this function:

◆ store_gdbm_delete_record()

static int store_gdbm_delete_record ( StoreHandle store,
const char *  key,
size_t  klen 
)
static

Delete a record from the Store - Implements StoreOps::delete_record() -.

Definition at line 118 of file gdbm.c.

119{
120 if (!store || (klen > INT_MAX))
121 return -1;
122
123 datum dkey = { 0 };
124
125 // Decloak an opaque pointer
126 GDBM_FILE db = store;
127
128 dkey.dptr = (char *) key;
129 dkey.dsize = klen;
130
131 return gdbm_delete(db, dkey);
132}

◆ store_kyotocabinet_delete_record()

static int store_kyotocabinet_delete_record ( StoreHandle store,
const char *  key,
size_t  klen 
)
static

Delete a record from the Store - Implements StoreOps::delete_record() -.

Definition at line 116 of file kc.c.

117{
118 if (!store)
119 return -1;
120
121 // Decloak an opaque pointer
122 KCDB *db = store;
123 if (!kcdbremove(db, key, klen))
124 {
125 int ecode = kcdbecode(db);
126 return ecode ? ecode : -1;
127 }
128 return 0;
129}

◆ store_lmdb_delete_record()

static int store_lmdb_delete_record ( StoreHandle store,
const char *  key,
size_t  klen 
)
static

Delete a record from the Store - Implements StoreOps::delete_record() -.

Definition at line 296 of file lmdb.c.

297{
298 if (!store)
299 return -1;
300
301 MDB_val dkey = { 0 };
302
303 // Decloak an opaque pointer
304 struct LmdbStoreData *sdata = store;
305
306 dkey.mv_data = (void *) key;
307 dkey.mv_size = klen;
308 int rc = lmdb_get_write_txn(sdata);
309 if (rc != MDB_SUCCESS)
310 {
311 mutt_debug(LL_DEBUG2, "lmdb_get_write_txn: %s\n", mdb_strerror(rc));
312 return rc;
313 }
314 rc = mdb_del(sdata->txn, sdata->db, &dkey, NULL);
315 if ((rc != MDB_SUCCESS) && (rc != MDB_NOTFOUND))
316 {
317 mutt_debug(LL_DEBUG2, "mdb_del: %s\n", mdb_strerror(rc));
318 mdb_txn_abort(sdata->txn);
320 sdata->txn = NULL;
321 }
322
323 return rc;
324}
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
static int lmdb_get_write_txn(struct LmdbStoreData *sdata)
Get an LMDB write transaction.
Definition: lmdb.c:127
@ TXN_UNINITIALIZED
Transaction is uninitialised.
Definition: lmdb.c:58
@ LL_DEBUG2
Log at debug level 2.
Definition: logging2.h:44
LMDB store.
Definition: lmdb.c:67
MDB_txn * txn
Definition: lmdb.c:69
MDB_dbi db
Definition: lmdb.c:70
enum LmdbTxnMode txn_mode
Definition: lmdb.c:71
+ Here is the call graph for this function:

◆ store_qdbm_delete_record()

static int store_qdbm_delete_record ( StoreHandle store,
const char *  key,
size_t  klen 
)
static

Delete a record from the Store - Implements StoreOps::delete_record() -.

Definition at line 97 of file qdbm.c.

98{
99 if (!store)
100 return -1;
101
102 // Decloak an opaque pointer
103 VILLA *db = store;
104 /* Not sure if dpecode is reset on success, so better to explicitly return 0
105 * on success */
106 bool success = vlout(db, key, klen);
107 return success ? 0 : dpecode ? dpecode : -1;
108}

◆ store_rocksdb_delete_record()

static int store_rocksdb_delete_record ( StoreHandle store,
const char *  key,
size_t  klen 
)
static

Delete a record from the Store - Implements StoreOps::delete_record() -.

Definition at line 177 of file rocksdb.c.

178{
179 if (!store)
180 return -1;
181
182 // Decloak an opaque pointer
183 struct RocksDbStoreData *sdata = store;
184
185 rocksdb_delete(sdata->db, sdata->write_options, key, klen, &sdata->err);
186 if (sdata->err)
187 {
188 rocksdb_free(sdata->err);
189 sdata->err = NULL;
190 return -1;
191 }
192
193 return 0;
194}
RocksDB store.
Definition: rocksdb.c:42
rocksdb_t * db
Definition: rocksdb.c:43
rocksdb_writeoptions_t * write_options
Definition: rocksdb.c:46
char * err
Definition: rocksdb.c:47

◆ store_tokyocabinet_delete_record()

static int store_tokyocabinet_delete_record ( StoreHandle store,
const char *  key,
size_t  klen 
)
static

Delete a record from the Store - Implements StoreOps::delete_record() -.

Definition at line 110 of file tc.c.

111{
112 if (!store)
113 return -1;
114
115 // Decloak an opaque pointer
116 TCBDB *db = store;
117 if (!tcbdbout(db, key, klen))
118 {
119 int ecode = tcbdbecode(db);
120 return ecode ? ecode : -1;
121 }
122 return 0;
123}

◆ store_tdb_delete_record()

static int store_tdb_delete_record ( StoreHandle store,
const char *  key,
size_t  klen 
)
static

Delete a record from the Store - Implements StoreOps::delete_record() -.

Definition at line 116 of file tdb.c.

117{
118 if (!store)
119 return -1;
120
121 // Decloak an opaque pointer
122 TDB_CONTEXT *db = store;
123 TDB_DATA dkey;
124
125 dkey.dptr = (unsigned char *) key;
126 dkey.dsize = klen;
127
128 return tdb_delete(db, dkey);
129}