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

Function handleSourcesList

internal/server/api_sources.go:18–39  ·  view source on GitHub ↗
(_ context.Context, rc requestContext)

Source from the content-addressed store, hash-verified

16)
17
18func handleSourcesList(_ context.Context, rc requestContext) (any, *apiError) {
19 _, multiUser := rc.rep.(repo.DirectRepository)
20
21 resp := &serverapi.SourcesResponse{
22 Sources: []*serverapi.SourceStatus{},
23 LocalHost: rc.rep.ClientOptions().Hostname,
24 LocalUsername: rc.rep.ClientOptions().Username,
25 MultiUser: multiUser,
26 }
27
28 for src, v := range rc.srv.snapshotAllSourceManagers() {
29 if sourceMatchesURLFilter(src, rc.req.URL.Query()) {
30 resp.Sources = append(resp.Sources, v.Status())
31 }
32 }
33
34 sort.Slice(resp.Sources, func(i, j int) bool {
35 return resp.Sources[i].Source.String() < resp.Sources[j].Source.String()
36 })
37
38 return resp, nil
39}
40
41func handleSourcesCreate(ctx context.Context, rc requestContext) (any, *apiError) {
42 var req serverapi.CreateSnapshotSourceRequest

Callers

nothing calls this directly

Calls 5

sourceMatchesURLFilterFunction · 0.85
StatusMethod · 0.80
ClientOptionsMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected