Observe claimed prepared executions
This commit is contained in:
@@ -202,6 +202,21 @@ func FromContext(ctx context.Context) *Recorder {
|
||||
return recorder
|
||||
}
|
||||
|
||||
type claimSinkKey struct{}
|
||||
|
||||
// WithClaimSink lets the facade learn which invocation actually claimed a
|
||||
// prepared handle, so it can emit the terminal event after public mapping.
|
||||
func WithClaimSink(ctx context.Context, sink **Recorder) context.Context {
|
||||
return context.WithValue(ctx, claimSinkKey{}, sink)
|
||||
}
|
||||
|
||||
// RegisterClaim records an invocation after its prepared handle is claimed.
|
||||
func RegisterClaim(ctx context.Context, recorder *Recorder) {
|
||||
if sink, ok := ctx.Value(claimSinkKey{}).(**Recorder); ok && sink != nil {
|
||||
*sink = recorder
|
||||
}
|
||||
}
|
||||
|
||||
type usageField struct {
|
||||
value int
|
||||
known, complete bool
|
||||
|
||||
Reference in New Issue
Block a user