interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / transport-internal.h

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