Remove lazy loading of deltas
[pacman-ng.git] / lib / libalpm / db.h
blob5352e9ee63f3d0fa74a12f5c9780c53091b89a31
1 /*
2 * db.h
4 * Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
5 * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
6 * Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
7 * Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef _ALPM_DB_H
23 #define _ALPM_DB_H
25 #include "alpm.h"
26 #include <limits.h>
27 #include <time.h>
29 /* libarchive */
30 #include <archive.h>
31 #include <archive_entry.h>
33 /* Database entries */
34 typedef enum _pmdbinfrq_t {
35 INFRQ_BASE = 1,
36 INFRQ_DESC = (1 << 1),
37 INFRQ_DEPENDS = (1 << 2),
38 INFRQ_FILES = (1 << 3),
39 INFRQ_SCRIPTLET = (1 << 4),
40 INFRQ_DSIZE = (1 << 5),
41 /* ALL should be info stored in the package or database */
42 INFRQ_ALL = 0x3F
43 } pmdbinfrq_t;
45 struct db_operations {
46 int (*populate) (pmdb_t *);
47 void (*unregister) (pmdb_t *);
50 /* Database */
51 struct __pmdb_t {
52 char *treename;
53 /* do not access directly, use _alpm_db_path(db) for lazy access */
54 char *_path;
55 int pkgcache_loaded;
56 int grpcache_loaded;
57 /* also indicates whether we are RO or RW */
58 int is_local;
59 alpm_list_t *pkgcache;
60 alpm_list_t *grpcache;
61 alpm_list_t *servers;
63 struct db_operations *ops;
67 /* db.c, database general calls */
68 void _alpm_db_free(pmdb_t *db);
69 const char *_alpm_db_path(pmdb_t *db);
70 int _alpm_db_cmp(const void *d1, const void *d2);
71 alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles);
72 pmdb_t *_alpm_db_register_local(void);
73 pmdb_t *_alpm_db_register_sync(const char *treename);
74 void _alpm_db_unregister(pmdb_t *db);
75 pmdb_t *_alpm_db_new(const char *treename, int is_local);
77 /* be_*.c, backend specific calls */
78 int _alpm_local_db_populate(pmdb_t *db);
79 int _alpm_local_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
80 int _alpm_local_db_prepare(pmdb_t *db, pmpkg_t *info);
81 int _alpm_local_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
82 int _alpm_local_db_remove(pmdb_t *db, pmpkg_t *info);
84 int _alpm_sync_db_populate(pmdb_t *db);
85 int _alpm_sync_db_read(pmdb_t *db, struct archive *archive, struct archive_entry *entry);
87 /* cache bullshit */
88 /* packages */
89 int _alpm_db_load_pkgcache(pmdb_t *db);
90 void _alpm_db_free_pkgcache(pmdb_t *db);
91 int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg);
92 int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg);
93 alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db);
94 int _alpm_db_ensure_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel);
95 pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target);
96 /* groups */
97 int _alpm_db_load_grpcache(pmdb_t *db);
98 void _alpm_db_free_grpcache(pmdb_t *db);
99 alpm_list_t *_alpm_db_get_grpcache(pmdb_t *db);
100 pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, const char *target);
102 #endif /* _ALPM_DB_H */
104 /* vim: set ts=2 sw=2 noet: */