summaryrefslogtreecommitdiffstats
path: root/bundle-uri.h
diff options
context:
space:
mode:
authorDerrick Stolee <derrickstolee@github.com>2023-01-31 14:29:12 +0100
committerJunio C Hamano <gitster@pobox.com>2023-01-31 17:57:48 +0100
commitc93c3d2fa42bec64948441cb339d78e2044ff9a3 (patch)
tree8cf29470bf6343bcacfe862d7ba2ed31e7c16e1c /bundle-uri.h
parentt5558: add tests for creationToken heuristic (diff)
downloadgit-c93c3d2fa42bec64948441cb339d78e2044ff9a3.tar.xz
git-c93c3d2fa42bec64948441cb339d78e2044ff9a3.zip
bundle-uri: parse bundle.heuristic=creationToken
The bundle.heuristic value communicates that the bundle list is organized to make use of the bundle.<id>.creationToken values that may be provided in the bundle list. Those values will create a total order on the bundles, allowing the Git client to download them in a specific order and even remember previously-downloaded bundles by storing the maximum creation token value. Before implementing any logic that parses or uses the bundle.<id>.creationToken values, teach Git to parse the bundle.heuristic value from a bundle list. We can use 'test-tool bundle-uri' to print the heuristic value and verify that the parsing works correctly. As an extra precaution, create the internal 'heuristics' array to be a list of (enum, string) pairs so we can iterate through the array entries carefully, regardless of the enum values. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'bundle-uri.h')
-rw-r--r--bundle-uri.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/bundle-uri.h b/bundle-uri.h
index d5e89f1671..2e44a50a90 100644
--- a/bundle-uri.h
+++ b/bundle-uri.h
@@ -52,6 +52,14 @@ enum bundle_list_mode {
BUNDLE_MODE_ANY
};
+enum bundle_list_heuristic {
+ BUNDLE_HEURISTIC_NONE = 0,
+ BUNDLE_HEURISTIC_CREATIONTOKEN,
+
+ /* Must be last. */
+ BUNDLE_HEURISTIC__COUNT
+};
+
/**
* A bundle_list contains an unordered set of remote_bundle_info structs,
* as well as information about the bundle listing, such as version and
@@ -75,6 +83,12 @@ struct bundle_list {
* advertised by the bundle list at that location.
*/
char *baseURI;
+
+ /**
+ * A list can have a heuristic, which helps reduce the number of
+ * downloaded bundles.
+ */
+ enum bundle_list_heuristic heuristic;
};
void init_bundle_list(struct bundle_list *list);