db.h

Go to the documentation of this file.
00001 /*
00002  *  db.h
00003  *
00004  *  Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
00005  *  Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
00006  *  Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
00007  *
00008  *  This program is free software; you can redistribute it and/or modify
00009  *  it under the terms of the GNU General Public License as published by
00010  *  the Free Software Foundation; either version 2 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  This program is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *  GNU General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU General Public License
00019  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00020  */
00021 #ifndef _ALPM_DB_H
00022 #define _ALPM_DB_H
00023 
00024 #include "alpm.h"
00025 #include <limits.h>
00026 #include <time.h>
00027 
00028 /* Database entries */
00029 typedef enum _pmdbinfrq_t {
00030     INFRQ_BASE = 0x01,
00031     INFRQ_DESC = 0x02,
00032     INFRQ_DEPENDS = 0x04,
00033     INFRQ_FILES = 0x08,
00034     INFRQ_SCRIPTLET = 0x10,
00035     INFRQ_DELTAS = 0x20,
00036     /* ALL should be sum of all above */
00037     INFRQ_ALL = 0x3F
00038 } pmdbinfrq_t;
00039 
00040 /* Database */
00041 struct __pmdb_t {
00042     char *path;
00043     char treename[PATH_MAX];
00044     void *handle;
00045     alpm_list_t *pkgcache;
00046     alpm_list_t *grpcache;
00047     alpm_list_t *servers;
00048 };
00049 
00050 /* db.c, database general calls */
00051 pmdb_t *_alpm_db_new(const char *dbpath, const char *treename);
00052 void _alpm_db_free(pmdb_t *db);
00053 int _alpm_db_cmp(const void *db1, const void *db2);
00054 alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles);
00055 pmdb_t *_alpm_db_register_local(void);
00056 pmdb_t *_alpm_db_register_sync(const char *treename);
00057 
00058 /* Provision */
00059 int _alpm_prov_cmp(const void *provision, const void *needle);
00060 alpm_list_t *_alpm_db_whatprovides(pmdb_t *db, const char *package);
00061 
00062 /* be.c, backend specific calls */
00063 int _alpm_db_install(pmdb_t *db, const char *dbfile);
00064 int _alpm_db_open(pmdb_t *db);
00065 void _alpm_db_close(pmdb_t *db);
00066 void _alpm_db_rewind(pmdb_t *db);
00067 pmpkg_t *_alpm_db_scan(pmdb_t *db, const char *target);
00068 int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
00069 int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
00070 int _alpm_db_remove(pmdb_t *db, pmpkg_t *info);
00071 time_t _alpm_db_getlastupdate(const pmdb_t *db);
00072 int _alpm_db_setlastupdate(const pmdb_t *db, time_t time);
00073 
00074 #endif /* _ALPM_DB_H */
00075 
00076 /* vim: set ts=2 sw=2 noet: */

Generated on Mon Jan 14 23:53:40 2008 for libalpm by  doxygen 1.5.4