#ifndef BUNDLE_URI_H #define BUNDLE_URI_H #include "hashmap.h" #include "strbuf.h" struct packet_reader; struct repository; struct string_list; /** * The remote_bundle_info struct contains information for a single bundle * URI. This may be initialized simply by a given URI or might have * additional metadata associated with it if the bundle was advertised by * a bundle list. */ struct remote_bundle_info { … }; #define REMOTE_BUNDLE_INFO_INIT … enum bundle_list_mode { … }; enum bundle_list_heuristic { … }; /** * A bundle_list contains an unordered set of remote_bundle_info structs, * as well as information about the bundle listing, such as version and * mode. */ struct bundle_list { … }; void init_bundle_list(struct bundle_list *list); void clear_bundle_list(struct bundle_list *list); bundle_iterator; int for_all_bundles_in_list(struct bundle_list *list, bundle_iterator iter, void *data); struct FILE; void print_bundle_list(FILE *fp, struct bundle_list *list); /** * A bundle URI may point to a bundle list where the key=value * pairs are provided in config file format. This method is * exposed publicly for testing purposes. */ int bundle_uri_parse_config_format(const char *uri, const char *filename, struct bundle_list *list); /** * Fetch data from the given 'uri' and unbundle the bundle data found * based on that information. * * Returns non-zero if no bundle information is found at the given 'uri'. * * If the pointer 'has_heuristic' is non-NULL, then the value it points to * will be set to be non-zero if and only if the fetched list has a * heuristic value. Such a value indicates that the list was designed for * incremental fetches. */ int fetch_bundle_uri(struct repository *r, const char *uri, int *has_heuristic); /** * Given a bundle list that was already advertised (likely by the * bundle-uri protocol v2 verb) at the given uri, fetch and unbundle the * bundles according to the bundle strategy of that list. * * It is expected that the given 'list' is initialized, including its * 'baseURI' value. * * Returns non-zero if there was an error trying to download the list * or any of its advertised bundles. */ int fetch_bundle_list(struct repository *r, struct bundle_list *list); /** * API for serve.c. */ int bundle_uri_advertise(struct repository *r, struct strbuf *value); int bundle_uri_command(struct repository *r, struct packet_reader *request); /** * General API for {transport,connect}.c etc. */ /** * Parse a "key=value" packet line from the bundle-uri verb. * * Returns 0 on success and non-zero on error. */ int bundle_uri_parse_line(struct bundle_list *list, const char *line); #endif