Back to index

citadel  8.12
database.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1987-2012 by the citadel.org team
00003  *
00004  *  This program is open source software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License version 3.
00006  *
00007  *  This program is distributed in the hope that it will be useful,
00008  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00009  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010  *  GNU General Public License for more details.
00011  */
00012 
00013 #ifndef DATABASE_H
00014 #define DATABASE_H
00015 
00016 
00017 void open_databases (void);
00018 void close_databases (void);
00019 int cdb_store (int cdb, const void *key, int keylen, void *data, int datalen);
00020 int cdb_delete (int cdb, void *key, int keylen);
00021 struct cdbdata *cdb_fetch (int cdb, const void *key, int keylen);
00022 void cdb_free (struct cdbdata *cdb);
00023 void cdb_rewind (int cdb);
00024 struct cdbdata *cdb_next_item (int cdb);
00025 void cdb_close_cursor(int cdb);
00026 void cdb_begin_transaction(void);
00027 void cdb_end_transaction(void);
00028 void cdb_allocate_tsd(void);
00029 void cdb_free_tsd(void);
00030 void cdb_check_handles(void);
00031 void cdb_trunc(int cdb);
00032 void *checkpoint_thread(void *arg);
00033 void cdb_chmod_data(void);
00034 void cdb_checkpoint(void);
00035 void check_handles(void *arg);
00036 
00037 /*
00038  * Database records beginning with this magic number are assumed to
00039  * be compressed.  In the event that a database record actually begins with
00040  * this magic number, we *must* compress it whether we want to or not,
00041  * because the fetch function will try to uncompress it anyway.
00042  * 
00043  * (No need to #ifdef this stuff; it compiles ok even if zlib is not present
00044  * and doesn't declare anything so it won't bloat the code)
00045  */
00046 #define COMPRESS_MAGIC      0xc0ffeeee
00047 
00048 struct CtdlCompressHeader {
00049        int magic;
00050        size_t uncompressed_len;
00051        size_t compressed_len;
00052 };
00053 
00054 #endif /* DATABASE_H */
00055