aboutsummaryrefslogtreecommitdiff
path: root/receivepack/service/hook.go
diff options
context:
space:
mode:
Diffstat (limited to 'receivepack/service/hook.go')
-rw-r--r--receivepack/service/hook.go8
1 files changed, 8 insertions, 0 deletions
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)