MCPcopy Create free account
hub / github.com/SurgeDM/Surge / Enqueue

Method Enqueue

internal/processing/manager.go:196–214  ·  view source on GitHub ↗

Enqueue probes and reserves a stable destination before dispatching to the queue layer.

(ctx context.Context, req *DownloadRequest)

Source from the content-addressed store, hash-verified

194
195// Enqueue probes and reserves a stable destination before dispatching to the queue layer.
196func (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.
217func (mgr *LifecycleManager) EnqueueWithID(ctx context.Context, req *DownloadRequest, requestID string) (string, string, error) {

Calls 2

enqueueResolvedMethod · 0.95
DebugFunction · 0.92