Mailing list header changes (fuck you Google)
[citadel.git] / citadel / database.h
1 /*
2  * Copyright (c) 1987-2017 by the citadel.org team
3  *
4  *  This program is open source software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License version 3.
6  *
7  *  This program is distributed in the hope that it will be useful,
8  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  *  GNU General Public License for more details.
11  */
12
13 #ifndef DATABASE_H
14 #define DATABASE_H
15
16
17 void open_databases (void);
18 void close_databases (void);
19 int cdb_store (int cdb, const void *key, int keylen, void *data, int datalen);
20 int cdb_delete (int cdb, void *key, int keylen);
21 struct cdbdata *cdb_fetch (int cdb, const void *key, int keylen);
22 void cdb_free (struct cdbdata *cdb);
23 void cdb_rewind (int cdb);
24 struct cdbdata *cdb_next_item (int cdb);
25 void cdb_close_cursor(int cdb);
26 void cdb_begin_transaction(void);
27 void cdb_end_transaction(void);
28 void cdb_allocate_tsd(void);
29 void cdb_free_tsd(void);
30 void cdb_check_handles(void);
31 void cdb_trunc(int cdb);
32 void *checkpoint_thread(void *arg);
33 void cdb_chmod_data(void);
34 void cdb_checkpoint(void);
35 void check_handles(void *arg);
36 void cdb_cull_logs(void);
37 void cdb_compact(void);
38
39
40 /*
41  * Database records beginning with this magic number are assumed to
42  * be compressed.  In the event that a database record actually begins with
43  * this magic number, we *must* compress it whether we want to or not,
44  * because the fetch function will try to uncompress it anyway.
45  * 
46  * (No need to #ifdef this stuff; it compiles ok even if zlib is not present
47  * and doesn't declare anything so it won't bloat the code)
48  */
49 #define COMPRESS_MAGIC  0xc0ffeeee
50
51 struct CtdlCompressHeader {
52         int magic;
53         size_t uncompressed_len;
54         size_t compressed_len;
55 };
56
57 int CheckIfAlreadySeen(StrBuf *guid);
58
59 #endif /* DATABASE_H */
60