MCPcopy Index your code
hub / github.com/kopia/kopia / forAllSourceManagersMatchingURLFilter

Function forAllSourceManagersMatchingURLFilter

internal/server/api_snapshots.go:172–194  ·  view source on GitHub ↗
(ctx context.Context, managers map[snapshot.SourceInfo]*sourceManager, c func(s *sourceManager, ctx context.Context) serverapi.SourceActionResponse, values url.Values)

Source from the content-addressed store, hash-verified

170}
171
172func forAllSourceManagersMatchingURLFilter(ctx context.Context, managers map[snapshot.SourceInfo]*sourceManager, c func(s *sourceManager, ctx context.Context) serverapi.SourceActionResponse, values url.Values) (any, *apiError) {
173 resp := &serverapi.MultipleSourceActionResponse{
174 Sources: map[string]serverapi.SourceActionResponse{},
175 }
176
177 for src, mgr := range managers {
178 if mgr.isRunningReadOnly() {
179 continue
180 }
181
182 if !sourceMatchesURLFilter(src, values) {
183 continue
184 }
185
186 resp.Sources[src.String()] = c(mgr, ctx)
187 }
188
189 if len(resp.Sources) == 0 {
190 return nil, notFoundError("no source matching the provided filters")
191 }
192
193 return resp, nil
194}
195
196func handleUpload(ctx context.Context, rc requestContext) (any, *apiError) {
197 return forAllSourceManagersMatchingURLFilter(ctx, rc.srv.snapshotAllSourceManagers(), (*sourceManager).upload, rc.req.URL.Query())

Callers 4

handleUploadFunction · 0.85
handleCancelFunction · 0.85
handlePauseFunction · 0.85
handleResumeFunction · 0.85

Calls 4

sourceMatchesURLFilterFunction · 0.85
notFoundErrorFunction · 0.85
isRunningReadOnlyMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected