From 5c4e61830242a3a25e332bf623adb2eb65037f2b Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 22 Mar 2026 23:34:38 +0000 Subject: receivepack/service: Clarify ownership and requirements --- receivepack/service/hook.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'receivepack/service/hook.go') diff --git a/receivepack/service/hook.go b/receivepack/service/hook.go index 748a00b9..b80d52d6 100644 --- a/receivepack/service/hook.go +++ b/receivepack/service/hook.go @@ -25,6 +25,10 @@ type UpdateDecision struct { Message string } +// HookRequest is the borrowed view passed to one Hook invocation. +// +// 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 @@ -34,4 +38,8 @@ type HookRequest struct { IO HookIO } +// Hook is an optional per-request validation hook. +// +// Hook borrows the data and stores in HookRequest only for the duration of the +// call. type Hook func(context.Context, HookRequest) ([]UpdateDecision, error) -- cgit v1.3.1-10-gc9f91