Documentation
¶
Overview ¶
Package prenegotiation provides request augmentation for Git fetch operations.
The prenegotiation component augments Git fetch requests with additional "have" lines from base packfiles, reducing upstream packfile sizes and improving cache efficiency. When a base packfile is available and the client supports packfile-uris with HTTPS, the Prenegotiator adds all commit OIDs from the base packfile to the request's haves.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AugmentResult ¶
type AugmentResult struct {
AugmentedBody []byte // Modified request with added haves
BasePackfile *packfile.BasePackfile // Metadata (nil if unavailable)
AddedHaves int // Count of haves added
}
AugmentResult contains the result of augmenting a fetch request.
type Prenegotiator ¶
type Prenegotiator struct {
// contains filtered or unexported fields
}
Prenegotiator augments Git fetch requests with additional haves from base packfiles. This reduces upstream packfile sizes by informing the server about commits already available in the base packfile.
func New ¶
func New(manager packfile.BasePackfileManager, logger *slog.Logger) *Prenegotiator
New creates a new Prenegotiator with the given base packfile manager.
func (*Prenegotiator) Augment ¶
func (p *Prenegotiator) Augment( ctx context.Context, repository string, fetchCmd *parser.FetchCommand, ) (*AugmentResult, error)
Augment augments a fetch request with additional haves from the base packfile.
PRECONDITION: Client supports packfile-uris HTTPS (caller must verify using FetchCommand.SupportsPackfileURIsHTTPS() before calling this method).
Returns nil if base packfile is unavailable or extraction is in progress. Otherwise returns AugmentResult with the augmented request body.