LatestUpdateOperations returns the most recent UpdateOperation per updater.
(ctx context.Context, k driver.UpdateKind)
| 162 | |
| 163 | // LatestUpdateOperations returns the most recent UpdateOperation per updater. |
| 164 | func (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 | // |