From 13507b7704415332e2b00f5f4d291f3be8bd18fa Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 22 Mar 2026 23:51:01 +0000 Subject: receivepack: Lifecycle/ownership docs --- receivepack/hook.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'receivepack/hook.go') diff --git a/receivepack/hook.go b/receivepack/hook.go index 5f98a538..fcf2cd37 100644 --- a/receivepack/hook.go +++ b/receivepack/hook.go @@ -30,6 +30,9 @@ type UpdateDecision struct { // HookRequest is the input presented to a receive-pack hook before quarantine // promotion and ref updates. +// +// Refs, ExistingObjects, and QuarantinedObjects are borrowed and are only +// valid for the duration of the hook call. type HookRequest struct { Refs refstore.ReadingStore ExistingObjects objectstore.Store @@ -43,7 +46,8 @@ 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. +// HookRequest.Updates. Hook borrows the data and stores in HookRequest only for +// the duration of the call. type Hook func(context.Context, HookRequest) ([]UpdateDecision, error) func translateHook(hook Hook) service.Hook { -- cgit v1.3.1-10-gc9f91