MCPcopy
hub / github.com/kopia/kopia / handlePrefetchContentsRequest

Function handlePrefetchContentsRequest

internal/server/grpc_session.go:442–464  ·  view source on GitHub ↗
(ctx context.Context, rep repo.Repository, authz auth.AuthorizationInfo, req *grpcapi.PrefetchContentsRequest)

Source from the content-addressed store, hash-verified

440}
441
442func handlePrefetchContentsRequest(ctx context.Context, rep repo.Repository, authz auth.AuthorizationInfo, req *grpcapi.PrefetchContentsRequest) *grpcapi.SessionResponse {
443 ctx, span := tracer.Start(ctx, "GRPCSession.PrefetchContents")
444 defer span.End()
445
446 if authz.ContentAccessLevel() < auth.AccessLevelRead {
447 return accessDeniedResponse()
448 }
449
450 contentIDs, err := content.IDsFromStrings(req.GetContentIds())
451 if err != nil {
452 return errorResponse(err)
453 }
454
455 cids := rep.PrefetchContents(ctx, contentIDs, req.GetHint())
456
457 return &grpcapi.SessionResponse{
458 Response: &grpcapi.SessionResponse_PrefetchContents{
459 PrefetchContents: &grpcapi.PrefetchContentsResponse{
460 ContentIds: content.IDsToStrings(cids),
461 },
462 },
463 }
464}
465
466func handleApplyRetentionPolicyRequest(ctx context.Context, rep repo.RepositoryWriter, authz auth.AuthorizationInfo, usernameAtHostname string, req *grpcapi.ApplyRetentionPolicyRequest) *grpcapi.SessionResponse {
467 ctx, span := tracer.Start(ctx, "GRPCSession.ApplyRetentionPolicy")

Callers 1

handleSessionRequestMethod · 0.85

Calls 9

IDsFromStringsFunction · 0.92
IDsToStringsFunction · 0.92
accessDeniedResponseFunction · 0.85
errorResponseFunction · 0.85
GetHintMethod · 0.80
StartMethod · 0.65
ContentAccessLevelMethod · 0.65
PrefetchContentsMethod · 0.65
GetContentIdsMethod · 0.45

Tested by

no test coverage detected