summaryrefslogtreecommitdiff
path: root/src/apk_database.h
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2018-01-04 09:46:03 +0200
committerTimo Teräs <timo.teras@iki.fi>2018-01-04 10:56:09 +0200
commit8a28c6d0d4f81406c67e76b2bcdbe491aa734717 (patch)
tree148555889d66a69cdcd979ad77f1ba728b747f53 /src/apk_database.h
parent2da67940d50865d206f6a79165ce7b3de5a90de3 (diff)
downloadapk-tools-8a28c6d0d4f81406c67e76b2bcdbe491aa734717.tar.gz
apk-tools-8a28c6d0d4f81406c67e76b2bcdbe491aa734717.tar.bz2
apk-tools-8a28c6d0d4f81406c67e76b2bcdbe491aa734717.tar.xz
apk-tools-8a28c6d0d4f81406c67e76b2bcdbe491aa734717.zip
enable automatic update of indexes controlled by --cache-max-age
This modifies apk cache for indexes to be automatically refreshed periodically without explicit 'update' or '--update-cache' usage. The default is to do if-modified-since request if the local copy is older than 4 hours. This age can be changed with --cache-max-age. Using --update-cache will change this age to 60 seconds to make sure the cached copy is relatively new. The small age is in order to try to avoid downloading indexes second time when apk-tools is upgraded and apk re-execs after self-upgrade. Accordingly using explicitly 'apk update' will now enforce --force-refresh and request the very latest index by requesting any potential http proxy to do refresh too.
Diffstat (limited to 'src/apk_database.h')
-rw-r--r--src/apk_database.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/apk_database.h b/src/apk_database.h
index 20454d9..daf4ddc 100644
--- a/src/apk_database.h
+++ b/src/apk_database.h
@@ -122,6 +122,7 @@ struct apk_repository_list {
struct apk_db_options {
int lock_wait;
+ unsigned int cache_max_age;
unsigned long open_flags;
const char *root;
const char *arch;
@@ -150,8 +151,8 @@ struct apk_database {
char *cache_remount_dir, *root_proc_dir;
unsigned long cache_remount_flags;
apk_blob_t *arch;
- unsigned int local_repos, available_repos;
- int repo_update_errors;
+ unsigned int local_repos, available_repos, cache_max_age;
+ unsigned int repo_update_errors, repo_update_counter;
unsigned int pending_triggers;
int performing_self_upgrade : 1;
int permanent : 1;
@@ -246,7 +247,7 @@ unsigned int apk_db_get_pinning_mask_repos(struct apk_database *db, unsigned sho
int apk_db_cache_active(struct apk_database *db);
int apk_cache_download(struct apk_database *db, struct apk_repository *repo,
- struct apk_package *pkg, int verify,
+ struct apk_package *pkg, int verify, int autoupdate,
apk_progress_cb cb, void *cb_ctx);
typedef void (*apk_cache_item_cb)(struct apk_database *db,