From e75510d130915c212566865ab070c4294c804eb9 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 28 Mar 2026 18:16:05 +0000 Subject: network/receivepack: Update docs --- network/receivepack/hook.go | 6 ++---- network/receivepack/receivepack.go | 3 +-- network/receivepack/service/execute.go | 2 ++ network/receivepack/service/hook.go | 8 +++----- network/receivepack/service/service.go | 5 +---- 5 files changed, 9 insertions(+), 15 deletions(-) (limited to 'network') diff --git a/network/receivepack/hook.go b/network/receivepack/hook.go index a9f36a9e..96027769 100644 --- a/network/receivepack/hook.go +++ b/network/receivepack/hook.go @@ -32,8 +32,7 @@ type UpdateDecision struct { // HookRequest is the input presented to a receive-pack hook before quarantine // promotion and ref updates. // -// Refs, ExistingObjects, QuarantinedObjects, and CommitGraph are borrowed and -// are only valid for the duration of the hook call. +// Labels: Life-Call. type HookRequest struct { Refs refstore.ReadingStore ExistingObjects objectstore.ReadingStore @@ -48,8 +47,7 @@ type HookRequest struct { // // The hook runs after pack ingestion into quarantine and before quarantine // promotion or ref updates. The returned decisions must have the same length as -// HookRequest.Updates. Hook borrows the data and stores in HookRequest only for -// the duration of the call. +// HookRequest.Updates. type Hook func(context.Context, HookRequest) ([]UpdateDecision, error) func translateHook(hook Hook) service.Hook { diff --git a/network/receivepack/receivepack.go b/network/receivepack/receivepack.go index b6190770..1052848e 100644 --- a/network/receivepack/receivepack.go +++ b/network/receivepack/receivepack.go @@ -20,8 +20,7 @@ import ( // ReceivePack serves one receive-pack session over r/w. // -// ReceivePack borrows r, w, and all dependencies reachable through opts for -// the duration of the call. It does not close any of them. +// Labels: Deps-Borrowed. func ReceivePack( ctx context.Context, w pktline.WriteFlusher, diff --git a/network/receivepack/service/execute.go b/network/receivepack/service/execute.go index 9f373e0d..5b00dba5 100644 --- a/network/receivepack/service/execute.go +++ b/network/receivepack/service/execute.go @@ -9,6 +9,8 @@ import ( // Execute validates one receive-pack request, optionally ingests its pack into // quarantine, runs the optional hook, and applies allowed ref updates. +// +// Labels: Deps-Borrowed. func (service *Service) Execute(ctx context.Context, req *Request) (*Result, error) { result := &Result{ Commands: make([]CommandResult, 0, len(req.Commands)), diff --git a/network/receivepack/service/hook.go b/network/receivepack/service/hook.go index e3afa375..66ff0929 100644 --- a/network/receivepack/service/hook.go +++ b/network/receivepack/service/hook.go @@ -26,10 +26,9 @@ type UpdateDecision struct { Message string } -// HookRequest is the borrowed view passed to one Hook invocation. +// HookRequest is the view passed to one Hook invocation. // -// Refs, ExistingObjects, QuarantinedObjects, and CommitGraph are borrowed and -// are only valid for the duration of the hook call. +// Labels: Life-Call. type HookRequest struct { Refs refstore.ReadingStore ExistingObjects objectstore.ReadingStore @@ -42,6 +41,5 @@ type HookRequest struct { // Hook is an optional per-request validation hook. // -// Hook borrows the data and stores in HookRequest only for the duration of the -// call. +// The returned decisions must have the same length as HookRequest.Updates. type Hook func(context.Context, HookRequest) ([]UpdateDecision, error) diff --git a/network/receivepack/service/service.go b/network/receivepack/service/service.go index a57fd354..0538cf73 100644 --- a/network/receivepack/service/service.go +++ b/network/receivepack/service/service.go @@ -1,16 +1,13 @@ package service // Service executes protocol-independent receive-pack requests. -// -// Service borrows all dependencies supplied in Options. type Service struct { opts Options } // New creates one receive-pack service. // -// The returned service borrows opts and does not take ownership of any stores, -// roots, hooks, or I/O endpoints reachable through it. +// Labels: Deps-Borrowed. func New(opts Options) *Service { return &Service{opts: opts} } -- cgit v1.3.1-10-gc9f91