service

package
v0.1.159 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package service implements the protocol-independent receive-pack service.

A Service borrows the stores, roots, hooks, and I/O endpoints supplied in Options. Callers retain ownership of those dependencies and must keep them valid for each Execute call that uses them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	OldID objectid.ObjectID
	NewID objectid.ObjectID
	Name  string
}

Command is one protocol-independent requested ref update.

type CommandResult

type CommandResult struct {
	Name         string
	Error        string
	RefName      string
	OldID        *objectid.ObjectID
	NewID        *objectid.ObjectID
	ForcedUpdate bool
}

CommandResult is one per-command execution result.

type Hook

Hook is an optional per-request validation hook.

The returned decisions must have the same length as HookRequest.Updates.

type HookIO

type HookIO struct {
	Progress iowrap.WriteFlusher
	Error    iowrap.WriteFlusher
}

type HookRequest

type HookRequest struct {
	Refs               refstore.ReadingStore
	ExistingObjects    objectstore.Reader
	QuarantinedObjects objectstore.Reader
	CommitGraph        *commitgraphread.Reader
	Updates            []RefUpdate
	PushOptions        []string
	IO                 HookIO
}

HookRequest is the view passed to one Hook invocation.

Labels: Life-Call.

type Options

type Options struct {
	Algorithm                 objectid.Algorithm
	Refs                      refstore.ReadWriteStore
	ExistingObjects           objectstore.Reader
	CommitGraph               *commitgraphread.Reader
	ObjectsRoot               *os.Root
	Progress                  iowrap.WriteFlusher
	PromotedObjectPermissions *PromotedObjectPermissions
	Hook                      Hook
	HookIO                    HookIO
}

Options configures one protocol-independent receive-pack service.

Service borrows all configured dependencies.

Refs and ExistingObjects are required and must be non-nil. ObjectsRoot is required if Execute may need to ingest or promote a pack. Progress, Hook, and HookIO are optional; when provided they are also borrowed for the duration of Execute.

type PlannedUpdate

type PlannedUpdate struct {
	Name   string
	OldID  objectid.ObjectID
	NewID  objectid.ObjectID
	Delete bool
}

PlannedUpdate is one ref update that would be applied once ref writing exists.

type PromotedObjectPermissions

type PromotedObjectPermissions struct {
	DirMode  fs.FileMode
	FileMode fs.FileMode
}

type RefUpdate

type RefUpdate struct {
	Name  string
	OldID objectid.ObjectID
	NewID objectid.ObjectID
}

type Request

type Request struct {
	Commands     []Command
	PushOptions  []string
	Atomic       bool
	DeleteOnly   bool
	PackExpected bool
	Pack         io.Reader
}

Request is one protocol-independent receive-pack execution request.

If PackExpected is true, Pack must be non-nil and remain valid until Execute finishes consuming it.

type Result

type Result struct {
	UnpackError string
	Commands    []CommandResult
	Ingest      *ingest.Result
	Planned     []PlannedUpdate
	Applied     bool
}

Result is one receive-pack execution result.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service executes protocol-independent receive-pack requests.

func New

func New(opts Options) *Service

New creates one receive-pack service.

Labels: Deps-Borrowed, Life-Parent.

func (*Service) Execute

func (service *Service) Execute(ctx context.Context, req *Request) (*Result, error)

Execute validates one receive-pack request, optionally ingests its pack into quarantine, runs the optional hook, and applies allowed ref updates.

Labels: Deps-Borrowed.

type UpdateDecision

type UpdateDecision struct {
	Accept  bool
	Message string
}

Jump to

Keyboard shortcuts

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