NeoMutt  2024-04-16-36-g75b6fb
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 254 of file bdb.c.

255{
256 if (!ptr || !*ptr)
257 return;
258
259 // Decloak an opaque pointer
260 struct BdbStoreData *sdata = *ptr;
261
262 sdata->db->close(sdata->db, 0);
263 sdata->env->close(sdata->env, 0);
264 mutt_file_unlock(sdata->fd);
265 close(sdata->fd);
266 unlink(buf_string(&sdata->lockfile));
267
268 bdb_sdata_free((struct BdbStoreData **) ptr);
269}
static void bdb_sdata_free(struct BdbStoreData **ptr)
Free Bdb Store Data.
Definition: bdb.c:57
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:1246
Berkeley DB Store.
Definition: bdb.c:46
DB * db
Definition: bdb.c:48
DB_ENV * env
Definition: bdb.c:47
int fd
Definition: bdb.c:49
struct Buffer lockfile
Definition: bdb.c:50
+ 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 322 of file lmdb.c.

323{
324 if (!ptr || !*ptr)
325 return;
326
327 // Decloak an opaque pointer
328 struct LmdbStoreData *sdata = *ptr;
329
330 if (sdata->txn)
331 {
332 if (sdata->txn_mode == TXN_WRITE)
333 mdb_txn_commit(sdata->txn);
334 else
335 mdb_txn_abort(sdata->txn);
336
338 sdata->txn = NULL;
339 }
340
341 mdb_env_close(sdata->env);
342 lmdb_sdata_free((struct LmdbStoreData **) ptr);
343}
static void lmdb_sdata_free(struct LmdbStoreData **ptr)
Free Lmdb Store Data.
Definition: lmdb.c:76
@ TXN_WRITE
Write transaction in progress.
Definition: lmdb.c:58
@ TXN_UNINITIALIZED
Transaction is uninitialised.
Definition: lmdb.c:56
LMDB store.
Definition: lmdb.c:65
MDB_txn * txn
Definition: lmdb.c:67
MDB_env * env
Definition: lmdb.c:66
enum LmdbTxnMode txn_mode
Definition: lmdb.c:69
+ 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 195 of file rocksdb.c.

196{
197 if (!ptr || !*ptr)
198 return;
199
200 // Decloak an opaque pointer
201 struct RocksDbStoreData *sdata = *ptr;
202
203 /* close database and free resources */
204 rocksdb_close(sdata->db);
205 rocksdb_options_destroy(sdata->options);
206 rocksdb_readoptions_destroy(sdata->read_options);
207 rocksdb_writeoptions_destroy(sdata->write_options);
208
209 rocksdb_sdata_free((struct RocksDbStoreData **) ptr);
210}
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}