NeoMutt  2024-11-14-138-ge5ca67
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches

Close a Store connection. More...

+ Collaboration diagram for close():

Functions

static void store_bdb_close (StoreHandle **ptr)
 Close a Store connection - Implements StoreOps::close() -.
 
static void store_gdbm_close (StoreHandle **ptr)
 Close a Store connection - Implements StoreOps::close() -.
 
static void store_kyotocabinet_close (StoreHandle **ptr)
 Close a Store connection - Implements StoreOps::close() -.
 
static void store_lmdb_close (StoreHandle **ptr)
 Close a Store connection - Implements StoreOps::close() -.
 
static void store_qdbm_close (StoreHandle **ptr)
 Close a Store connection - Implements StoreOps::close() -.
 
static void store_rocksdb_close (StoreHandle **ptr)
 Close a Store connection - Implements StoreOps::close() -.
 
static void store_tokyocabinet_close (StoreHandle **ptr)
 Close a Store connection - Implements StoreOps::close() -.
 
static void store_tdb_close (StoreHandle **ptr)
 Close a Store connection - Implements StoreOps::close() -.
 

Detailed Description

Close a Store connection.

Parameters
[in,out]ptrStore retrieved via open()

Function Documentation

◆ store_bdb_close()

static void store_bdb_close ( StoreHandle **  ptr)
static

Close a Store connection - Implements StoreOps::close() -.

Definition at line 256 of file bdb.c.

257{
258 if (!ptr || !*ptr)
259 return;
260
261 // Decloak an opaque pointer
262 struct BdbStoreData *sdata = *ptr;
263
264 sdata->db->close(sdata->db, 0);
265 sdata->env->close(sdata->env, 0);
266 mutt_file_unlock(sdata->fd);
267 close(sdata->fd);
268 unlink(buf_string(&sdata->lockfile));
269
270 bdb_sdata_free((struct BdbStoreData **) ptr);
271}
static void bdb_sdata_free(struct BdbStoreData **ptr)
Free Bdb Store Data.
Definition: bdb.c:58
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:96
int mutt_file_unlock(int fd)
Unlock a file previously locked by mutt_file_lock()
Definition: file.c:1249
Berkeley DB Store.
Definition: bdb.c:47
DB * db
Definition: bdb.c:49
DB_ENV * env
Definition: bdb.c:48
int fd
Definition: bdb.c:50
struct Buffer lockfile
Definition: bdb.c:51
+ Here is the call graph for this function:

◆ store_gdbm_close()

static void store_gdbm_close ( StoreHandle **  ptr)
static

Close a Store connection - Implements StoreOps::close() -.

Definition at line 137 of file gdbm.c.

138{
139 if (!ptr || !*ptr)
140 return;
141
142 // Decloak an opaque pointer
143 GDBM_FILE db = *ptr;
144 gdbm_close(db);
145 *ptr = NULL;
146}

◆ store_kyotocabinet_close()

static void store_kyotocabinet_close ( StoreHandle **  ptr)
static

Close a Store connection - Implements StoreOps::close() -.

Definition at line 134 of file kc.c.

135{
136 if (!ptr || !*ptr)
137 return;
138
139 // Decloak an opaque pointer
140 KCDB *db = *ptr;
141 if (!kcdbclose(db))
142 {
143 int ecode = kcdbecode(db);
144 mutt_debug(LL_DEBUG2, "kcdbclose failed: %s (ecode %d)\n", kcdbemsg(db), ecode);
145 }
146 kcdbdel(db);
147 *ptr = NULL;
148}
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
@ LL_DEBUG2
Log at debug level 2.
Definition: logging2.h:44

◆ store_lmdb_close()

static void store_lmdb_close ( StoreHandle **  ptr)
static

Close a Store connection - Implements StoreOps::close() -.

Definition at line 329 of file lmdb.c.

330{
331 if (!ptr || !*ptr)
332 return;
333
334 // Decloak an opaque pointer
335 struct LmdbStoreData *sdata = *ptr;
336
337 if (sdata->txn)
338 {
339 if (sdata->txn_mode == TXN_WRITE)
340 mdb_txn_commit(sdata->txn);
341 else
342 mdb_txn_abort(sdata->txn);
343
345 sdata->txn = NULL;
346 }
347
348 mdb_env_close(sdata->env);
349 lmdb_sdata_free((struct LmdbStoreData **) ptr);
350}
static void lmdb_sdata_free(struct LmdbStoreData **ptr)
Free Lmdb Store Data.
Definition: lmdb.c:78
@ TXN_WRITE
Write transaction in progress.
Definition: lmdb.c:60
@ TXN_UNINITIALIZED
Transaction is uninitialised.
Definition: lmdb.c:58
LMDB store.
Definition: lmdb.c:67
MDB_txn * txn
Definition: lmdb.c:69
MDB_env * env
Definition: lmdb.c:68
enum LmdbTxnMode txn_mode
Definition: lmdb.c:71
+ Here is the call graph for this function:

◆ store_qdbm_close()

static void store_qdbm_close ( StoreHandle **  ptr)
static

Close a Store connection - Implements StoreOps::close() -.

Definition at line 113 of file qdbm.c.

114{
115 if (!ptr || !*ptr)
116 return;
117
118 // Decloak an opaque pointer
119 VILLA *db = *ptr;
120 vlclose(db);
121 *ptr = NULL;
122}

◆ store_rocksdb_close()

static void store_rocksdb_close ( StoreHandle **  ptr)
static

Close a Store connection - Implements StoreOps::close() -.

Definition at line 199 of file rocksdb.c.

200{
201 if (!ptr || !*ptr)
202 return;
203
204 // Decloak an opaque pointer
205 struct RocksDbStoreData *sdata = *ptr;
206
207 /* close database and free resources */
208 rocksdb_close(sdata->db);
209 rocksdb_options_destroy(sdata->options);
210 rocksdb_readoptions_destroy(sdata->read_options);
211 rocksdb_writeoptions_destroy(sdata->write_options);
212
213 rocksdb_sdata_free((struct RocksDbStoreData **) ptr);
214}
static void rocksdb_sdata_free(struct RocksDbStoreData **ptr)
Free RocksDb Store Data.
Definition: rocksdb.c:54
RocksDB store.
Definition: rocksdb.c:42
rocksdb_options_t * options
Definition: rocksdb.c:44
rocksdb_t * db
Definition: rocksdb.c:43
rocksdb_readoptions_t * read_options
Definition: rocksdb.c:45
rocksdb_writeoptions_t * write_options
Definition: rocksdb.c:46
+ Here is the call graph for this function:

◆ store_tokyocabinet_close()

static void store_tokyocabinet_close ( StoreHandle **  ptr)
static

Close a Store connection - Implements StoreOps::close() -.

Definition at line 128 of file tc.c.

129{
130 if (!ptr || !*ptr)
131 return;
132
133 // Decloak an opaque pointer
134 TCBDB *db = *ptr;
135 if (!tcbdbclose(db))
136 {
137 int ecode = tcbdbecode(db);
138 mutt_debug(LL_DEBUG2, "tcbdbclose failed: %s (ecode %d)\n", tcbdberrmsg(ecode), ecode);
139 }
140 tcbdbdel(db);
141 *ptr = NULL;
142}

◆ store_tdb_close()

static void store_tdb_close ( StoreHandle **  ptr)
static

Close a Store connection - Implements StoreOps::close() -.

Definition at line 134 of file tdb.c.

135{
136 if (!ptr || !*ptr)
137 return;
138
139 // Decloak an opaque pointer
140 TDB_CONTEXT *db = *ptr;
141 tdb_close(db);
142 *ptr = NULL;
143}