MCPcopy
hub / github.com/gofiber/fiber / SetWithContext

Method SetWithContext

ctx_test.go:5778–5798  ·  view source on GitHub ↗
(ctx context.Context, _ string, _ []byte, _ time.Duration)

Source from the content-addressed store, hash-verified

5776}
5777
5778func (s *mockContextAwareStorage) SetWithContext(ctx context.Context, _ string, _ []byte, _ time.Duration) error {
5779 s.t.Helper()
5780 if s.validateCtx == nil {
5781 s.helperFailure("validateCtx must be configured before SetWithContext")
5782 }
5783 s.validateCtx(ctx)
5784 if val := ctx.Value(s.key); val != s.expectedValue {
5785 s.helperFailure("storage observed unexpected context value: %v", val)
5786 }
5787 s.ctxMatched.Store(true)
5788 if s.cancel != nil {
5789 s.cancel()
5790 }
5791 select {
5792 case <-ctx.Done():
5793 s.cancelObserved.Store(true)
5794 case <-time.After(100 * time.Millisecond):
5795 s.helperFailure("storage did not observe context cancellation")
5796 }
5797 return nil
5798}
5799
5800func (s *mockContextAwareStorage) Set(string, []byte, time.Duration) error {
5801 s.helperFailure("unexpected call to Set")

Callers

nothing calls this directly

Calls 4

helperFailureMethod · 0.95
StoreMethod · 0.80
ValueMethod · 0.65
DoneMethod · 0.65

Tested by

no test coverage detected