aboutsummaryrefslogtreecommitdiff
path: root/receivepack/hook.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-22 23:51:01 +0000
committerGravatar Runxi Yu2026-03-22 23:51:01 +0000
commit13507b7704415332e2b00f5f4d291f3be8bd18fa (patch)
tree5c193e1ce520044af0d7db44d4b8febdbcd03582 /receivepack/hook.go
parentobjectstore/packed: Document refresh semantics (diff)
signatureNo signature
receivepack: Lifecycle/ownership docs v0.1.91
Diffstat (limited to 'receivepack/hook.go')
-rw-r--r--receivepack/hook.go6
1 files changed, 5 insertions, 1 deletions
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 {