sysupdate: introduce "installdb" that keeps track of installed resources
Let's make sure we keep track of any file we drop into the system via a database in /var/. This database is implemented based on symlinks, i.e. reuses the fs as a simple database. Given the database most likely will have <= 10 entries only (as we store *patterns* of installed file paths in them, not the file paths themselves), this should be very efficient. For implementation details see comments at top of src/sysupdate/sysupdate-cleanup.c.
This commit is contained in:
@@ -4,6 +4,37 @@
|
||||
#include "specifier.h"
|
||||
#include "sysupdate-forward.h"
|
||||
|
||||
typedef struct Context {
|
||||
char *component;
|
||||
|
||||
Transfer **transfers;
|
||||
size_t n_transfers;
|
||||
|
||||
Transfer **disabled_transfers;
|
||||
size_t n_disabled_transfers;
|
||||
|
||||
Hashmap *features; /* Defined features, keyed by ID */
|
||||
|
||||
UpdateSet **update_sets;
|
||||
size_t n_update_sets;
|
||||
|
||||
UpdateSet *newest_installed, *candidate;
|
||||
|
||||
Hashmap *web_cache; /* Cache for downloaded resources, keyed by URL */
|
||||
|
||||
int installdb_fd;
|
||||
} Context;
|
||||
|
||||
Context* context_free(Context *c);
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(Context*, context_free);
|
||||
|
||||
typedef enum ReadDefinitionsFlags {
|
||||
READ_DEFINITIONS_REQUIRES_ENABLED_TRANSFERS = 1 << 0,
|
||||
READ_DEFINITIONS_REQUIRES_ANY_TRANSFERS = 1 << 1,
|
||||
} ReadDefinitionsFlags;
|
||||
|
||||
int context_make_offline(Context **ret, const char *node, const char *component, ReadDefinitionsFlags read_definitions_flags);
|
||||
|
||||
extern bool arg_sync;
|
||||
extern uint64_t arg_instances_max;
|
||||
extern char *arg_root;
|
||||
|
||||
Reference in New Issue
Block a user