]>
Commit | Line | Data |
---|---|---|
e967ca38 JT |
1 | #ifndef TRANSPORT_INTERNAL_H |
2 | #define TRANSPORT_INTERNAL_H | |
3 | ||
4 | struct ref; | |
5 | struct transport; | |
873cd28a | 6 | struct strvec; |
39835409 | 7 | struct transport_ls_refs_options; |
e967ca38 JT |
8 | |
9 | struct transport_vtable { | |
10 | /** | |
11 | * Returns 0 if successful, positive if the option is not | |
12 | * recognized or is inapplicable, and negative if the option | |
13 | * is applicable but the value is invalid. | |
14 | **/ | |
15 | int (*set_option)(struct transport *connection, const char *name, | |
16 | const char *value); | |
17 | /** | |
18 | * Returns a list of the remote side's refs. In order to allow | |
19 | * the transport to try to share connections, for_push is a | |
20 | * hint as to whether the ultimate operation is a push or a fetch. | |
21 | * | |
22 | * If the transport is able to determine the remote hash for | |
23 | * the ref without a huge amount of effort, it should store it | |
24 | * in the ref's old_sha1 field; otherwise it should be all 0. | |
25 | **/ | |
834cf34b | 26 | struct ref *(*get_refs_list)(struct transport *transport, int for_push, |
39835409 | 27 | struct transport_ls_refs_options *transport_options); |
e967ca38 | 28 | |
0cfde740 ÆAB |
29 | /** |
30 | * Populates the remote side's bundle-uri under protocol v2, | |
31 | * if the "bundle-uri" capability was advertised. Returns 0 if | |
32 | * OK, negative values on error. | |
33 | */ | |
34 | int (*get_bundle_uri)(struct transport *transport); | |
35 | ||
e967ca38 JT |
36 | /** |
37 | * Fetch the objects for the given refs. Note that this gets | |
38 | * an array, and should ignore the list structure. | |
39 | * | |
40 | * If the transport did not get hashes for refs in | |
41 | * get_refs_list(), it should set the old_sha1 fields in the | |
42 | * provided refs now. | |
43 | **/ | |
9b1cdd33 | 44 | int (*fetch_refs)(struct transport *transport, int refs_nr, struct ref **refs); |
e967ca38 JT |
45 | |
46 | /** | |
47 | * Push the objects and refs. Send the necessary objects, and | |
48 | * then, for any refs where peer_ref is set and | |
49 | * peer_ref->new_oid is different from old_oid, tell the | |
50 | * remote side to update each ref in the list from old_oid to | |
51 | * peer_ref->new_oid. | |
52 | * | |
53 | * Where possible, set the status for each ref appropriately. | |
54 | * | |
55 | * The transport must modify new_sha1 in the ref to the new | |
56 | * value if the remote accepted the change. Note that this | |
57 | * could be a different value from peer_ref->new_oid if the | |
58 | * process involved generating new commits. | |
59 | **/ | |
60 | int (*push_refs)(struct transport *transport, struct ref *refs, int flags); | |
61 | int (*connect)(struct transport *connection, const char *name, | |
62 | const char *executable, int fd[2]); | |
63 | ||
64 | /** get_refs_list(), fetch(), and push_refs() can keep | |
65 | * resources (such as a connection) reserved for further | |
66 | * use. disconnect() releases these resources. | |
67 | **/ | |
68 | int (*disconnect)(struct transport *connection); | |
69 | }; | |
70 | ||
71 | #endif |