Signed-off-by: Christian Couder <[email protected]>
---
external-odb.c | 17 +++++++++++++++++
external-odb.h | 1 +
odb-helper.c | 16 ++++++++++++++++
odb-helper.h | 2 ++
4 files changed, 36 insertions(+)
diff --git a/external-odb.c b/external-odb.c
index ae6bc017fe..8be92277d2 100644
--- a/external-odb.c
+++ b/external-odb.c
@@ -182,3 +182,20 @@ int external_odb_get_direct(const unsigned char *sha1)
return -1;
}
+
+int external_odb_get_many_direct(const struct oid_array *to_get)
+{
+ struct odb_helper *o;
+
+ external_odb_init();
+
+ for (o = helpers; o; o = o->next) {
+ if (!(o->supported_capabilities & ODB_HELPER_CAP_GET_DIRECT))
+ continue;
+ if (odb_helper_get_many_direct(o, to_get) < 0)
+ continue;
+ return 0;
+ }
+
+ return -1;
+}
diff --git a/external-odb.h b/external-odb.h
index c5ac071995..a4eda95b09 100644
--- a/external-odb.h
+++ b/external-odb.h
@@ -17,5 +17,6 @@ extern const char *external_odb_root(void);
extern int external_odb_has_object(const unsigned char *sha1);
extern int external_odb_get_object(const unsigned char *sha1);
extern int external_odb_get_direct(const unsigned char *sha1);
+extern int external_odb_get_many_direct(const struct oid_array *to_get);
#endif /* EXTERNAL_ODB_H */
diff --git a/odb-helper.c b/odb-helper.c
index a99f4a1299..7e5eab94cf 100644
--- a/odb-helper.c
+++ b/odb-helper.c
@@ -345,3 +345,19 @@ int odb_helper_get_direct(struct odb_helper *o,
return res;
}
+
+int odb_helper_get_many_direct(struct odb_helper *o,
+ const struct oid_array *to_get)
+{
+ int res = 0;
+ uint64_t start;
+
+ start = getnanotime();
+
+ if (o->type == ODB_HELPER_GIT_REMOTE)
+ fetch_objects(o->dealer, to_get);
+
+ trace_performance_since(start, "odb_helper_get_many_direct");
+
+ return res;
+}
diff --git a/odb-helper.h b/odb-helper.h
index 7720684744..2c529af6af 100644
--- a/odb-helper.h
+++ b/odb-helper.h
@@ -39,5 +39,7 @@ extern int odb_helper_get_object(struct odb_helper *o,
int fd);
extern int odb_helper_get_direct(struct odb_helper *o,
const unsigned char *sha1);
+extern int odb_helper_get_many_direct(struct odb_helper *o,
+ const struct oid_array *to_get);
#endif /* ODB_HELPER_H */
--
2.17.0.rc0.37.g8f476fabe9