A few final changes for the 3.0.6 release
[pacman.git] / lib / libalpm / db.h
blob26f1fdf42127c46551c0221ccae0a10d99f1ffad
1 /*
2 * db.h
3 *
4 * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
5 * Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
6 * Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
21 * USA.
23 #ifndef _ALPM_DB_H
24 #define _ALPM_DB_H
26 #include "alpm.h"
27 #include <limits.h>
29 /* Database entries */
30 typedef enum _pmdbinfrq_t {
31 INFRQ_BASE = 0x01,
32 INFRQ_DESC = 0x02,
33 INFRQ_DEPENDS = 0x04,
34 INFRQ_FILES = 0x08,
35 INFRQ_SCRIPTLET = 0x10,
36 /* ALL should be sum of all above */
37 INFRQ_ALL = 0x1F
38 } pmdbinfrq_t;
40 /* Database */
41 struct __pmdb_t {
42 char *path;
43 char treename[PATH_MAX];
44 void *handle;
45 alpm_list_t *pkgcache;
46 alpm_list_t *grpcache;
47 alpm_list_t *servers;
50 /* db.c, database general calls */
51 pmdb_t *_alpm_db_new(const char *root, const char *dbpath, const char *treename);
52 void _alpm_db_free(pmdb_t *db);
53 int _alpm_db_cmp(const void *db1, const void *db2);
54 alpm_list_t *_alpm_db_search(pmdb_t *db, alpm_list_t *needles);
55 pmdb_t *_alpm_db_register(const char *treename, alpm_cb_db_register callback);
57 /* be.c, backend specific calls */
58 int _alpm_db_install(pmdb_t *db, const char *dbfile);
59 int _alpm_db_open(pmdb_t *db);
60 void _alpm_db_close(pmdb_t *db);
61 void _alpm_db_rewind(pmdb_t *db);
62 pmpkg_t *_alpm_db_scan(pmdb_t *db, const char *target);
63 int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
64 int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
65 int _alpm_db_remove(pmdb_t *db, pmpkg_t *info);
66 int _alpm_db_getlastupdate(pmdb_t *db, char *ts);
67 int _alpm_db_setlastupdate(pmdb_t *db, char *ts);
69 #endif /* _ALPM_DB_H */
71 /* vim: set ts=2 sw=2 noet: */