MCPcopy Index your code
hub / github.com/coder/coder / InitRequestWithCancel

Function InitRequestWithCancel

coderd/audit/request.go:407–422  ·  view source on GitHub ↗

InitRequestWithCancel returns a commit function with a boolean arg. If the arg is false, future calls to commit() will not create an audit log entry.

(w http.ResponseWriter, p *RequestParams)

Source from the content-addressed store, hash-verified

405// If the arg is false, future calls to commit() will not create an audit log
406// entry.
407func InitRequestWithCancel[T Auditable](w http.ResponseWriter, p *RequestParams) (*Request[T], func(commit bool)) {
408 req, commitF := InitRequest[T](w, p)
409 canceled := false
410 return req, func(commit bool) {
411 // Once 'commit=false' is called, block
412 // any future commit attempts.
413 if !commit {
414 canceled = true
415 return
416 }
417 // If it was ever canceled, block any commits
418 if !canceled {
419 commitF()
420 }
421 }
422}
423
424// InitRequest initializes an audit log for a request. It returns a function
425// that should be deferred, causing the audit log to be committed when the

Callers 2

scimPatchUserMethod · 0.92
scimPutUserMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected