MCPcopy
hub / github.com/kopia/kopia / handleMountCreate

Function handleMountCreate

internal/server/api_mount.go:11–33  ·  view source on GitHub ↗
(ctx context.Context, rc requestContext)

Source from the content-addressed store, hash-verified

9)
10
11func handleMountCreate(ctx context.Context, rc requestContext) (any, *apiError) {
12 req := &serverapi.MountSnapshotRequest{}
13 if err := json.Unmarshal(rc.body, req); err != nil {
14 return nil, requestError(serverapi.ErrorMalformedRequest, "malformed request body")
15 }
16
17 oid, err := object.ParseID(req.Root)
18 if err != nil {
19 return nil, requestError(serverapi.ErrorMalformedRequest, "unable to parse OID")
20 }
21
22 c, err := rc.srv.getMountController(ctx, rc.rep, oid, true)
23 if err != nil {
24 return nil, internalServerError(err)
25 }
26
27 userLog(ctx).Debugf("mount for %v => %v", oid, c.MountPath())
28
29 return &serverapi.MountedSnapshot{
30 Path: c.MountPath(),
31 Root: oid,
32 }, nil
33}
34
35func handleMountGet(ctx context.Context, rc requestContext) (any, *apiError) {
36 oid, err := object.ParseID(rc.muxVar("rootObjectID"))

Callers

nothing calls this directly

Calls 5

ParseIDFunction · 0.92
requestErrorFunction · 0.85
internalServerErrorFunction · 0.85
getMountControllerMethod · 0.65
MountPathMethod · 0.65

Tested by

no test coverage detected