@@ -1,6 +1,7 @@
#include "cache.h"
#include "promisor-remote.h"
#include "config.h"
+#include "fetch-object.h"
static struct promisor_remote *promisors;
static struct promisor_remote **promisors_tail = &promisors;
@@ -88,3 +89,35 @@ int has_promisor_remote(void)
{
return !!find_promisor_remote(NULL);
}
+
+static int promisor_remote_get_direct(struct promisor_remote *o,
+ const struct object_id *oids,
+ int oid_nr)
+{
+ int res;
+ uint64_t start = getnanotime();
+
+ res = fetch_objects(o->remote_name, oids, oid_nr);
+
+ trace_performance_since(start, "promisor_remote_get_direct");
+
+ return res;
+}
+
+int promisors_get_direct(const struct object_id *oids, int oid_nr)
+{
+ struct promisor_remote *o;
+
+ trace_printf("trace: promisor_remote_get_direct: nr: %d", oid_nr);
+
+ promisor_remote_init();
+
+ for (o = promisors; o; o = o->next) {
+ if (promisor_remote_get_direct(o, oids, oid_nr) < 0)
+ continue;
+ return 0;
+ }
+
+ return -1;
+}
+
@@ -13,5 +13,6 @@ struct promisor_remote {
extern struct promisor_remote *promisor_remote_new(const char *remote_name);
extern struct promisor_remote *find_promisor_remote(const char *remote_name);
extern int has_promisor_remote(void);
+extern int promisors_get_direct(const struct object_id *oids, int oid_nr);
#endif /* PROMISOR_REMOTE_H */