THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

59 lines
1.6 KiB

  1. #ifndef FETCH_NEGOTIATOR_H
  2. #define FETCH_NEGOTIATOR_H
  3. struct commit;
  4. /*
  5. * An object that supplies the information needed to negotiate the contents of
  6. * the to-be-sent packfile during a fetch.
  7. *
  8. * To set up the negotiator, call fetch_negotiator_init(), then known_common()
  9. * (0 or more times), then add_tip() (0 or more times).
  10. *
  11. * Then, when "have" lines are required, call next(). Call ack() to report what
  12. * the server tells us.
  13. *
  14. * Once negotiation is done, call release(). The negotiator then cannot be used
  15. * (unless reinitialized with fetch_negotiator_init()).
  16. */
  17. struct fetch_negotiator {
  18. /*
  19. * Before negotiation starts, indicate that the server is known to have
  20. * this commit.
  21. */
  22. void (*known_common)(struct fetch_negotiator *, struct commit *);
  23. /*
  24. * Once this function is invoked, known_common() cannot be invoked any
  25. * more.
  26. *
  27. * Indicate that this commit and all its ancestors are to be checked
  28. * for commonality with the server.
  29. */
  30. void (*add_tip)(struct fetch_negotiator *, struct commit *);
  31. /*
  32. * Once this function is invoked, known_common() and add_tip() cannot
  33. * be invoked any more.
  34. *
  35. * Return the next commit that the client should send as a "have" line.
  36. */
  37. const struct object_id *(*next)(struct fetch_negotiator *);
  38. /*
  39. * Inform the negotiator that the server has the given commit. This
  40. * method must only be called on commits returned by next().
  41. */
  42. int (*ack)(struct fetch_negotiator *, struct commit *);
  43. void (*release)(struct fetch_negotiator *);
  44. /* internal use */
  45. void *data;
  46. };
  47. void fetch_negotiator_init(struct fetch_negotiator *negotiator,
  48. const char *algorithm);
  49. #endif