MCPcopy
hub / github.com/grpc/grpc-go / Replace

Method Replace

internal/xds/clients/internal/testutils/channel.go:52–60  ·  view source on GitHub ↗

Replace clears the value on the underlying channel, and sends the new value. It's expected to be used with a size-1 channel, to only keep the most up-to-date item. This method is inherently racy when invoked concurrently from multiple goroutines.

(value any)

Source from the content-addressed store, hash-verified

50// up-to-date item. This method is inherently racy when invoked concurrently
51// from multiple goroutines.
52func (c *Channel) Replace(value any) {
53 for {
54 select {
55 case c.C <- value:
56 return
57 case <-c.C:
58 }
59 }
60}
61
62// SendContext sends value on the underlying channel, or returns an error if
63// the context expires.

Callers 15

TestClientNew_SingleMethod · 0.95
AmbientErrorMethod · 0.45
ResourceErrorMethod · 0.45
ResourceErrorMethod · 0.45
AmbientErrorMethod · 0.45
ResourceErrorMethod · 0.45
AmbientErrorMethod · 0.45
ResourceErrorMethod · 0.45
AmbientErrorMethod · 0.45

Calls

no outgoing calls

Tested by 15

TestClientNew_SingleMethod · 0.76
AmbientErrorMethod · 0.36
ResourceErrorMethod · 0.36
ResourceErrorMethod · 0.36
AmbientErrorMethod · 0.36
ResourceErrorMethod · 0.36
AmbientErrorMethod · 0.36
ResourceErrorMethod · 0.36
AmbientErrorMethod · 0.36