prenegotiation

package
v1.40.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 5 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL