mark "pointless" data pointers in callbacks
[git.git] / fetch-negotiator.h
blobe348905a1f0008950c66aca1c7b1d69a1253cccf
1 #ifndef FETCH_NEGOTIATOR_H
2 #define FETCH_NEGOTIATOR_H
4 struct commit;
5 struct repository;
7 /*
8 * An object that supplies the information needed to negotiate the contents of
9 * the to-be-sent packfile during a fetch.
11 * To set up the negotiator, call fetch_negotiator_init(), then known_common()
12 * (0 or more times), then add_tip() (0 or more times).
14 * Then, when "have" lines are required, call next(). Call ack() to report what
15 * the server tells us.
17 * Once negotiation is done, call release(). The negotiator then cannot be used
18 * (unless reinitialized with fetch_negotiator_init()).
20 struct fetch_negotiator {
22 * Before negotiation starts, indicate that the server is known to have
23 * this commit.
25 void (*known_common)(struct fetch_negotiator *, struct commit *);
28 * Once this function is invoked, known_common() cannot be invoked any
29 * more.
31 * Indicate that this commit and all its ancestors are to be checked
32 * for commonality with the server.
34 void (*add_tip)(struct fetch_negotiator *, struct commit *);
37 * Once this function is invoked, known_common() and add_tip() cannot
38 * be invoked any more.
40 * Return the next commit that the client should send as a "have" line.
42 const struct object_id *(*next)(struct fetch_negotiator *);
45 * Inform the negotiator that the server has the given commit. This
46 * method must only be called on commits returned by next().
48 int (*ack)(struct fetch_negotiator *, struct commit *);
50 void (*release)(struct fetch_negotiator *);
52 /* internal use */
53 void *data;
57 * Initialize a negotiator based on the repository settings.
59 void fetch_negotiator_init(struct repository *r,
60 struct fetch_negotiator *negotiator);
63 * Initialize a noop negotiator.
65 void fetch_negotiator_init_noop(struct fetch_negotiator *negotiator);
67 #endif