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

Function newChildPolicyWrapper

balancer/rls/child_policy.go:74–86  ·  view source on GitHub ↗

newChildPolicyWrapper creates a child policy wrapper for the given target, and is initialized with one reference and starts off in CONNECTING state.

(target string)

Source from the content-addressed store, hash-verified

72// newChildPolicyWrapper creates a child policy wrapper for the given target,
73// and is initialized with one reference and starts off in CONNECTING state.
74func newChildPolicyWrapper(target string) *childPolicyWrapper {
75 c := &childPolicyWrapper{
76 target: target,
77 refCnt: 1,
78 state: unsafe.Pointer(&balancer.State{
79 ConnectivityState: connectivity.Connecting,
80 Picker: base.NewErrPicker(balancer.ErrNoSubConnAvailable),
81 }),
82 }
83 c.logger = internalgrpclog.NewPrefixLogger(logger, fmt.Sprintf("[rls-child-policy-wrapper %s %p] ", c.target, c))
84 c.logger.Infof("Created")
85 return c
86}
87
88// acquireRef increments the reference count on the child policy wrapper.
89func (c *childPolicyWrapper) acquireRef() {

Calls 2

NewErrPickerFunction · 0.92
InfofMethod · 0.65

Tested by

no test coverage detected