12 * The remote_bundle_info struct contains information for a single bundle
13 * URI. This may be initialized simply by a given URI or might have
14 * additional metadata associated with it if the bundle was advertised by
17 struct remote_bundle_info
{
18 struct hashmap_entry ent
;
21 * The 'id' is a name given to the bundle for reference
22 * by other bundle infos.
27 * The 'uri' is the location of the remote bundle so
28 * it can be downloaded on-demand. This will be NULL
29 * if there was no table of contents.
34 * If the bundle has been downloaded, then 'file' is a
35 * filename storing its contents. Otherwise, 'file' is
41 * If the bundle has been unbundled successfully, then
42 * this boolean is true.
47 #define REMOTE_BUNDLE_INFO_INIT { 0 }
49 enum bundle_list_mode
{
56 * A bundle_list contains an unordered set of remote_bundle_info structs,
57 * as well as information about the bundle listing, such as version and
62 enum bundle_list_mode mode
;
63 struct hashmap bundles
;
66 * The baseURI of a bundle_list is the URI that provided the list.
68 * In the case of the 'bundle-uri' protocol v2 command, the base
69 * URI is the URI of the Git remote.
71 * Otherwise, the bundle list was downloaded over HTTP from some
72 * known URI. 'baseURI' is set to that value.
74 * The baseURI is used as the base for any relative URIs
75 * advertised by the bundle list at that location.
80 void init_bundle_list(struct bundle_list
*list
);
81 void clear_bundle_list(struct bundle_list
*list
);
83 typedef int (*bundle_iterator
)(struct remote_bundle_info
*bundle
,
86 int for_all_bundles_in_list(struct bundle_list
*list
,
91 void print_bundle_list(FILE *fp
, struct bundle_list
*list
);
94 * A bundle URI may point to a bundle list where the key=value
95 * pairs are provided in config file format. This method is
96 * exposed publicly for testing purposes.
98 int bundle_uri_parse_config_format(const char *uri
,
100 struct bundle_list
*list
);
103 * Fetch data from the given 'uri' and unbundle the bundle data found
104 * based on that information.
106 * Returns non-zero if no bundle information is found at the given 'uri'.
108 int fetch_bundle_uri(struct repository
*r
, const char *uri
);
111 * Given a bundle list that was already advertised (likely by the
112 * bundle-uri protocol v2 verb) at the given uri, fetch and unbundle the
113 * bundles according to the bundle strategy of that list.
115 * It is expected that the given 'list' is initialized, including its
118 * Returns non-zero if there was an error trying to download the list
119 * or any of its advertised bundles.
121 int fetch_bundle_list(struct repository
*r
,
122 struct bundle_list
*list
);
127 int bundle_uri_advertise(struct repository
*r
, struct strbuf
*value
);
128 int bundle_uri_command(struct repository
*r
, struct packet_reader
*request
);
131 * General API for {transport,connect}.c etc.
135 * Parse a "key=value" packet line from the bundle-uri verb.
137 * Returns 0 on success and non-zero on error.
139 int bundle_uri_parse_line(struct bundle_list
*list
,