EnqueueWithID does the same lifecycle work as Enqueue while preserving a caller-owned id.
(ctx context.Context, req *DownloadRequest, requestID string)
| 215 | |
| 216 | // EnqueueWithID does the same lifecycle work as Enqueue while preserving a caller-owned id. |
| 217 | func (mgr *LifecycleManager) EnqueueWithID(ctx context.Context, req *DownloadRequest, requestID string) (string, string, error) { |
| 218 | if mgr.addWithIDFunc == nil { |
| 219 | return "", "", types.ErrServiceUnavailable |
| 220 | } |
| 221 | |
| 222 | utils.Debug("Lifecycle: EnqueueWithID %s (%s)", req.URL, requestID) |
| 223 | return mgr.enqueueResolved(ctx, req, func(finalPath, finalFilename string, probe *ProbeResult) (string, error) { |
| 224 | return mgr.addWithIDFunc( |
| 225 | req.URL, |
| 226 | finalPath, |
| 227 | finalFilename, |
| 228 | req.Mirrors, |
| 229 | req.Headers, |
| 230 | requestID, |
| 231 | probe.FileSize, |
| 232 | probe.SupportsRange, |
| 233 | ) |
| 234 | }) |
| 235 | } |
| 236 | |
| 237 | // enqueueResolved prepares the final path and working file before handing the |
| 238 | // download to the engine, so workers and lifecycle events agree on one stable destination. |