forked from mtusi2026/mtusi2026lab6
Prepare verified laboratory 6 implementation and evidence
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package model
|
||||
|
||||
import "context"
|
||||
|
||||
type traceKey struct{}
|
||||
type TraceCarrier struct{ Traceparent, Tracestate string }
|
||||
|
||||
func WithTrace(ctx context.Context, parent, state string) context.Context {
|
||||
return context.WithValue(ctx, traceKey{}, TraceCarrier{parent, state})
|
||||
}
|
||||
func TraceFrom(ctx context.Context) TraceCarrier {
|
||||
v, _ := ctx.Value(traceKey{}).(TraceCarrier)
|
||||
return v
|
||||
}
|
||||
Reference in New Issue
Block a user