Skip to content

Commit 2edfb25

Browse files
docs: add more comments
1 parent a8caafd commit 2edfb25

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/smartrequeue/context.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ package smartrequeue
22

33
import "context"
44

5+
// contextKey is a type used as a key for storing and retrieving the Entry from the context.
56
type contextKey struct{}
67

8+
// NewContext creates a new context with the given Entry.
79
func NewContext(ctx context.Context, entry *Entry) context.Context {
810
return context.WithValue(ctx, contextKey{}, entry)
911
}
1012

13+
// FromContext retrieves the Entry from the context, if it exists.
1114
func FromContext(ctx context.Context) *Entry {
1215
s, ok := ctx.Value(contextKey{}).(*Entry)
1316
if !ok {

0 commit comments

Comments
 (0)