MCPcopy
hub / github.com/cilium/cilium / useCurrent

Method useCurrent

pkg/envoy/xds/ack_test.go:119–137  ·  view source on GitHub ↗

useCurrent adds a completion to the WaitGroup if the current version of the cached resource has not been acked yet, allowing the caller to wait for the ACK.

(typeURL string, nodeIDs []string, wg *completion.WaitGroup)

Source from the content-addressed store, hash-verified

117// version of the cached resource has not been acked yet, allowing the
118// caller to wait for the ACK.
119func (m *AckingResourceMutatorWrapper) useCurrent(typeURL string, nodeIDs []string, wg *completion.WaitGroup) {
120 m.locker.Lock()
121 defer m.locker.Unlock()
122
123 if wg == nil {
124 return
125 }
126
127 if m.restoring {
128 // Do not wait for acks when restoring state
129 m.logger.Debug("useCurrent: Restoring, skipping wait for ACK",
130 logfields.XDSTypeURL, typeURL,
131 )
132 return
133 }
134
135 // Add a completion object for the current version so that the caller may wait for the N/ACK
136 m.addCurrentVersionCompletion(typeURL, nodeIDs, wg, nil)
137}
138
139func TestUpsertSingleNode(t *testing.T) {
140 logger := hivetest.Logger(t)

Calls 4

LockMethod · 0.65
UnlockMethod · 0.65
DebugMethod · 0.65

Tested by

no test coverage detected