MCPcopy Create free account
hub / github.com/quay/clair / LatestUpdateOperations

Method LatestUpdateOperations

httptransport/client/matcher.go:164–187  ·  view source on GitHub ↗

LatestUpdateOperations returns the most recent UpdateOperation per updater.

(ctx context.Context, k driver.UpdateKind)

Source from the content-addressed store, hash-verified

162
163// LatestUpdateOperations returns the most recent UpdateOperation per updater.
164func (c *HTTP) LatestUpdateOperations(ctx context.Context, k driver.UpdateKind) (map[string][]driver.UpdateOperation, error) {
165 u, err := c.addr.Parse(httptransport.UpdateOperationAPIPath)
166 if err != nil {
167 return nil, err
168 }
169 v := url.Values{}
170 v.Add("latest", "true")
171 v.Add("kind", string(k))
172 u.RawQuery = v.Encode()
173
174 req, err := httputil.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
175 if err != nil {
176 return nil, err
177 }
178
179 // check the cache validator and pass our ouCache to
180 // updateOperations
181 c.uoLatestCache.RLock()
182 if c.uoLatestCache.validator != "" {
183 req.Header.Set("if-none-match", c.uoLatestCache.validator)
184 }
185 c.uoLatestCache.RUnlock()
186 return c.updateOperations(ctx, req, c.uoLatestCache)
187}
188
189// updateOperations is a private method implementing the common bits for retrieving UpdateOperations
190//

Callers 1

TestDifferFunction · 0.95

Calls 5

updateOperationsMethod · 0.95
NewRequestWithContextFunction · 0.92
AddMethod · 0.80
StringMethod · 0.45
SetMethod · 0.45

Tested by 1

TestDifferFunction · 0.76