NeoMutt  2024-04-25-85-g27bab4
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 255 of file bdb.c.

256{
257 if (!ptr || !*ptr)
258 return;
259
260 // Decloak an opaque pointer
261 struct BdbStoreData *sdata = *ptr;
262
263 sdata->db->close(sdata->db, 0);
264 sdata->env->close(sdata->env, 0);
265 mutt_file_unlock(sdata->fd);
266 close(sdata->fd);
267 unlink(buf_string(&sdata->lockfile));
268
269 bdb_sdata_free((struct BdbStoreData **) ptr);
270}
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 135 of file gdbm.c.

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

◆ store_kyotocabinet_close()

static void store_kyotocabinet_close ( StoreHandle **  ptr)
static

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

Definition at line 133 of file kc.c.

134{
135 if (!ptr || !*ptr)
136 return;
137
138 // Decloak an opaque pointer
139 KCDB *db = *ptr;
140 if (!kcdbclose(db))
141 {
142 int ecode = kcdbecode(db);
143 mutt_debug(LL_DEBUG2, "kcdbclose failed: %s (ecode %d)\n", kcdbemsg(db), ecode);
144 }
145 kcdbdel(db);
146 *ptr = NULL;
147}
#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 328 of file lmdb.c.

329{
330 if (!ptr || !*ptr)
331 return;
332
333 // Decloak an opaque pointer
334 struct LmdbStoreData *sdata = *ptr;
335
336 if (sdata->txn)
337 {
338 if (sdata->txn_mode == TXN_WRITE)
339 mdb_txn_commit(sdata->txn);
340 else
341 mdb_txn_abort(sdata->txn);
342
344 sdata->txn = NULL;
345 }
346
347 mdb_env_close(sdata->env);
348 lmdb_sdata_free((struct LmdbStoreData **) ptr);
349}
static void lmdb_sdata_free(struct LmdbStoreData **ptr)
Free Lmdb Store Data.
Definition: lmdb.c:77
@ TXN_WRITE
Write transaction in progress.
Definition: lmdb.c:59
@ TXN_UNINITIALIZED
Transaction is uninitialised.
Definition: lmdb.c:57
LMDB store.
Definition: lmdb.c:66
MDB_txn * txn
Definition: lmdb.c:68
MDB_env * env
Definition: lmdb.c:67
enum LmdbTxnMode txn_mode
Definition: lmdb.c:70
+ 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 198 of file rocksdb.c.

199{
200 if (!ptr || !*ptr)
201 return;
202
203 // Decloak an opaque pointer
204 struct RocksDbStoreData *sdata = *ptr;
205
206 /* close database and free resources */
207 rocksdb_close(sdata->db);
208 rocksdb_options_destroy(sdata->options);
209 rocksdb_readoptions_destroy(sdata->read_options);
210 rocksdb_writeoptions_destroy(sdata->write_options);
211
212 rocksdb_sdata_free((struct RocksDbStoreData **) ptr);
213}
static void rocksdb_sdata_free(struct RocksDbStoreData **ptr)
Free RocksDb Store Data.
Definition: rocksdb.c:53
RocksDB store.
Definition: rocksdb.c:41
rocksdb_options_t * options
Definition: rocksdb.c:43
rocksdb_t * db
Definition: rocksdb.c:42
rocksdb_readoptions_t * read_options
Definition: rocksdb.c:44
rocksdb_writeoptions_t * write_options
Definition: rocksdb.c:45
+ 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 127 of file tc.c.

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

◆ store_tdb_close()

static void store_tdb_close ( StoreHandle **  ptr)
static

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

Definition at line 132 of file tdb.c.

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