Notmuch database handling. More...
#include "config.h"#include <limits.h>#include <notmuch.h>#include <stdbool.h>#include <stdio.h>#include <sys/stat.h>#include <time.h>#include "private.h"#include "mutt/lib.h"#include "config/lib.h"#include "email/lib.h"#include "core/lib.h"#include "lib.h"#include "adata.h"#include "mdata.h"#include "mutt_logging.h"
Include dependency graph for db.c:Go to the source code of this file.
Functions | |
| const char * | nm_db_get_filename (struct Mailbox *m) |
| Get the filename of the Notmuch database. | |
| notmuch_database_t * | nm_db_do_open (const char *filename, bool writable, bool verbose) |
| Open a Notmuch database. | |
| notmuch_database_t * | nm_db_get (struct Mailbox *m, bool writable) |
| Get the Notmuch database. | |
| int | nm_db_release (struct Mailbox *m) |
| Close the Notmuch database. | |
| void | nm_db_free (notmuch_database_t *db) |
| Decoupled way to close a Notmuch database. | |
| int | nm_db_trans_begin (struct Mailbox *m) |
| Start a Notmuch database transaction. | |
| int | nm_db_trans_end (struct Mailbox *m) |
| End a database transaction. | |
| int | nm_db_get_mtime (struct Mailbox *m, time_t *mtime) |
| Get the database modification time. | |
| bool | nm_db_is_longrun (struct Mailbox *m) |
| Is Notmuch in the middle of a long-running transaction. | |
| void | nm_db_longrun_init (struct Mailbox *m, bool writable) |
| Start a long transaction. | |
| void | nm_db_longrun_done (struct Mailbox *m) |
| Finish a long transaction. | |
| void | nm_db_debug_check (struct Mailbox *m) |
| Check if the database is open. | |
Notmuch database handling.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file db.c.
| const char * nm_db_get_filename | ( | struct Mailbox * | m | ) |
Get the filename of the Notmuch database.
| m | Mailbox |
| ptr | Filename |
| NULL | No notmuch-specific database path configured |
Returns the database path from the mailbox URL or $nm_default_url. On libnotmuch >= 5.4, a NULL return allows notmuch to resolve the database path from its own configuration file or environment variables.
$nm_default_url global variable. If that variable changes, the result will be invalid. It must not be freed. Definition at line 63 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:| notmuch_database_t * nm_db_do_open | ( | const char * | filename, |
| bool | writable, | ||
| bool | verbose ) |
Open a Notmuch database.
| filename | Database filename |
| writable | Read/write? |
| verbose | Show errors on failure? |
| ptr | Notmuch database |
Definition at line 116 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:| notmuch_database_t * nm_db_get | ( | struct Mailbox * | m, |
| bool | writable ) |
Get the Notmuch database.
| m | Mailbox |
| writable | Read/write? |
| ptr | Notmuch database |
Definition at line 210 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int nm_db_release | ( | struct Mailbox * | m | ) |
Close the Notmuch database.
| m | Mailbox |
| 0 | Success |
| -1 | Failure |
Definition at line 245 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void nm_db_free | ( | notmuch_database_t * | db | ) |
| int nm_db_trans_begin | ( | struct Mailbox * | m | ) |
Start a Notmuch database transaction.
| m | Mailbox |
| <0 | error |
| 1 | new transaction started |
| 0 | already within transaction |
Definition at line 278 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int nm_db_trans_end | ( | struct Mailbox * | m | ) |
| int nm_db_get_mtime | ( | struct Mailbox * | m, |
| time_t * | mtime ) |
Get the database modification time.
| [in] | m | Mailbox |
| [out] | mtime | Save the modification time |
| 0 | Success (result in mtime) |
| -1 | Error |
Get the "mtime" (modification time) of the database file. This is the time of the last update.
Definition at line 327 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:| bool nm_db_is_longrun | ( | struct Mailbox * | m | ) |
Is Notmuch in the middle of a long-running transaction.
| m | Mailbox |
| true | Notmuch is in the middle of a long-running transaction |
Definition at line 364 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void nm_db_longrun_init | ( | struct Mailbox * | m, |
| bool | writable ) |
| void nm_db_longrun_done | ( | struct Mailbox * | m | ) |
| void nm_db_debug_check | ( | struct Mailbox * | m | ) |
Check if the database is open.
| m | Mailbox |
Definition at line 411 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function: