|
| 1 | +Packfile URIs |
| 2 | +============= |
| 3 | + |
| 4 | +This feature allows servers to serve part of their packfile response as URIs. |
| 5 | +This allows server designs that improve scalability in bandwidth and CPU usage |
| 6 | +(for example, by serving some data through a CDN), and (in the future) provides |
| 7 | +some measure of resumability to clients. |
| 8 | + |
| 9 | +This feature is available only in protocol version 2. |
| 10 | + |
| 11 | +Protocol |
| 12 | +-------- |
| 13 | + |
| 14 | +The server advertises `packfile-uris`. |
| 15 | + |
| 16 | +If the client then communicates which protocols (HTTPS, etc.) it supports with |
| 17 | +a `packfile-uris` argument, the server MAY send a `packfile-uris` section |
| 18 | +directly before the `packfile` section (right after `wanted-refs` if it is |
| 19 | +sent) containing URIs of any of the given protocols. The URIs point to |
| 20 | +packfiles that use only features that the client has declared that it supports |
| 21 | +(e.g. ofs-delta and thin-pack). See protocol-v2.txt for the documentation of |
| 22 | +this section. |
| 23 | + |
| 24 | +Clients then should understand that the returned packfile could be incomplete, |
| 25 | +and that it needs to download all the given URIs before the fetch or clone is |
| 26 | +complete. |
| 27 | + |
| 28 | +Server design |
| 29 | +------------- |
| 30 | + |
| 31 | +The server can be trivially made compatible with the proposed protocol by |
| 32 | +having it advertise `packfile-uris`, tolerating the client sending |
| 33 | +`packfile-uris`, and never sending any `packfile-uris` section. But we should |
| 34 | +include some sort of non-trivial implementation in the Minimum Viable Product, |
| 35 | +at least so that we can test the client. |
| 36 | + |
| 37 | +This is the implementation: a feature, marked experimental, that allows the |
| 38 | +server to be configured by one or more `uploadpack.blobPackfileUri=<sha1> |
| 39 | +<uri>` entries. Whenever the list of objects to be sent is assembled, a blob |
| 40 | +with the given sha1 can be replaced by the given URI. This allows, for example, |
| 41 | +servers to delegate serving of large blobs to CDNs. |
| 42 | + |
| 43 | +Client design |
| 44 | +------------- |
| 45 | + |
| 46 | +While fetching, the client needs to remember the list of URIs and cannot |
| 47 | +declare that the fetch is complete until all URIs have been downloaded as |
| 48 | +packfiles. |
| 49 | + |
| 50 | +The division of work (initial fetch + additional URIs) introduces convenient |
| 51 | +points for resumption of an interrupted clone - such resumption can be done |
| 52 | +after the Minimum Viable Product (see "Future work"). |
| 53 | + |
| 54 | +The client can inhibit this feature (i.e. refrain from sending the |
| 55 | +`packfile-uris` parameter) by passing --no-packfile-uris to `git fetch`. |
| 56 | + |
| 57 | +Future work |
| 58 | +----------- |
| 59 | + |
| 60 | +The protocol design allows some evolution of the server and client without any |
| 61 | +need for protocol changes, so only a small-scoped design is included here to |
| 62 | +form the MVP. For example, the following can be done: |
| 63 | + |
| 64 | + * On the server, a long-running process that takes in entire requests and |
| 65 | + outputs a list of URIs and the corresponding inclusion and exclusion sets of |
| 66 | + objects. This allows, e.g., signed URIs to be used and packfiles for common |
| 67 | + requests to be cached. |
| 68 | + * On the client, resumption of clone. If a clone is interrupted, information |
| 69 | + could be recorded in the repository's config and a "clone-resume" command |
| 70 | + can resume the clone in progress. (Resumption of subsequent fetches is more |
| 71 | + difficult because that must deal with the user wanting to use the repository |
| 72 | + even after the fetch was interrupted.) |
| 73 | + |
| 74 | +There are some possible features that will require a change in protocol: |
| 75 | + |
| 76 | + * Additional HTTP headers (e.g. authentication) |
| 77 | + * Byte range support |
| 78 | + * Different file formats referenced by URIs (e.g. raw object) |
0 commit comments