Enqueue probes and reserves a stable destination before dispatching to the queue layer.
(ctx context.Context, req *DownloadRequest)
| 194 | |
| 195 | // Enqueue probes and reserves a stable destination before dispatching to the queue layer. |
| 196 | func (mgr *LifecycleManager) Enqueue(ctx context.Context, req *DownloadRequest) (string, string, error) { |
| 197 | if mgr.addFunc == nil { |
| 198 | return "", "", types.ErrServiceUnavailable |
| 199 | } |
| 200 | |
| 201 | utils.Debug("Lifecycle: Enqueue %s (Filename: %s)", req.URL, req.Filename) |
| 202 | return mgr.enqueueResolved(ctx, req, func(finalPath, finalFilename string, probe *ProbeResult) (string, error) { |
| 203 | return mgr.addFunc( |
| 204 | req.URL, |
| 205 | finalPath, |
| 206 | finalFilename, |
| 207 | req.Mirrors, |
| 208 | req.Headers, |
| 209 | req.IsExplicitCategory, |
| 210 | probe.FileSize, |
| 211 | probe.SupportsRange, |
| 212 | ) |
| 213 | }) |
| 214 | } |
| 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) { |