From 72883e3bcbc1ff2d46667fceb48c3c2c682cfe79 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 14 Sep 2009 22:44:51 -0500 Subject: Fully implement database lazy loading Commit 34e1413d75 attempted to implement lazy loading of package databases. Although it took care of my main complaint (creating the database directory if it didn't exist), it didn't allow sync repos to be registered before alpm_option_set_dbpath() had been called. With this patch, we no longer compute the individual repository DB paths until necessary, allowing full lazy loading to work as intended, and allowing us to drop the extra setlibpath() calls from the frontend. This allows the changes introduced in a2cd48960 (but later reverted) to be added back in again. Signed-off-by: Dan McGee --- lib/libalpm/db.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/libalpm/db.h') diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h index 950ace22..29816032 100644 --- a/lib/libalpm/db.h +++ b/lib/libalpm/db.h @@ -40,18 +40,20 @@ typedef enum _pmdbinfrq_t { /* Database */ struct __pmdb_t { - char *path; char *treename; + /* do not access directly, use _alpm_db_path(db) for lazy access */ + char *_path; unsigned short pkgcache_loaded; - alpm_list_t *pkgcache; unsigned short grpcache_loaded; + unsigned short is_local; + alpm_list_t *pkgcache; alpm_list_t *grpcache; alpm_list_t *servers; }; /* db.c, database general calls */ -pmdb_t *_alpm_db_new(const char *dbpath, const char *treename); void _alpm_db_free(pmdb_t *db); +const char *_alpm_db_path(pmdb_t *db); int _alpm_db_cmp(const void *d1, const void *d2); alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles); pmdb_t *_alpm_db_register_local(void); -- cgit v1.2.3-2-g168b