transport-internal.hon commit Merge branch 'bp/fsmonitor-bufsize-fix' (beed7e2)
   1#ifndef TRANSPORT_INTERNAL_H
   2#define TRANSPORT_INTERNAL_H
   3
   4struct ref;
   5struct transport;
   6
   7struct transport_vtable {
   8        /**
   9         * Returns 0 if successful, positive if the option is not
  10         * recognized or is inapplicable, and negative if the option
  11         * is applicable but the value is invalid.
  12         **/
  13        int (*set_option)(struct transport *connection, const char *name,
  14                          const char *value);
  15        /**
  16         * Returns a list of the remote side's refs. In order to allow
  17         * the transport to try to share connections, for_push is a
  18         * hint as to whether the ultimate operation is a push or a fetch.
  19         *
  20         * If the transport is able to determine the remote hash for
  21         * the ref without a huge amount of effort, it should store it
  22         * in the ref's old_sha1 field; otherwise it should be all 0.
  23         **/
  24        struct ref *(*get_refs_list)(struct transport *transport, int for_push);
  25
  26        /**
  27         * Fetch the objects for the given refs. Note that this gets
  28         * an array, and should ignore the list structure.
  29         *
  30         * If the transport did not get hashes for refs in
  31         * get_refs_list(), it should set the old_sha1 fields in the
  32         * provided refs now.
  33         **/
  34        int (*fetch)(struct transport *transport, int refs_nr, struct ref **refs);
  35
  36        /**
  37         * Push the objects and refs. Send the necessary objects, and
  38         * then, for any refs where peer_ref is set and
  39         * peer_ref->new_oid is different from old_oid, tell the
  40         * remote side to update each ref in the list from old_oid to
  41         * peer_ref->new_oid.
  42         *
  43         * Where possible, set the status for each ref appropriately.
  44         *
  45         * The transport must modify new_sha1 in the ref to the new
  46         * value if the remote accepted the change. Note that this
  47         * could be a different value from peer_ref->new_oid if the
  48         * process involved generating new commits.
  49         **/
  50        int (*push_refs)(struct transport *transport, struct ref *refs, int flags);
  51        int (*connect)(struct transport *connection, const char *name,
  52                       const char *executable, int fd[2]);
  53
  54        /** get_refs_list(), fetch(), and push_refs() can keep
  55         * resources (such as a connection) reserved for further
  56         * use. disconnect() releases these resources.
  57         **/
  58        int (*disconnect)(struct transport *connection);
  59};
  60
  61#endif