MCPcopy Create free account
hub / github.com/rilldata/rill / GetFile

Method GetFile

runtime/server/repos.go:104–122  ·  view source on GitHub ↗

GetFile implements RuntimeService.

(ctx context.Context, req *runtimev1.GetFileRequest)

Source from the content-addressed store, hash-verified

102
103// GetFile implements RuntimeService.
104func (s *Server) GetFile(ctx context.Context, req *runtimev1.GetFileRequest) (*runtimev1.GetFileResponse, error) {
105 observability.AddRequestAttributes(ctx,
106 attribute.String("args.instance_id", req.InstanceId),
107 attribute.String("args.path", req.Path),
108 )
109
110 s.addInstanceRequestAttributes(ctx, req.InstanceId)
111
112 if !auth.GetClaims(ctx, req.InstanceId).Can(runtime.ReadRepo) {
113 return nil, ErrForbidden
114 }
115
116 blob, lastUpdated, err := s.runtime.GetFile(ctx, req.InstanceId, req.Path)
117 if err != nil {
118 return nil, err
119 }
120
121 return &runtimev1.GetFileResponse{Blob: blob, UpdatedOn: timestamppb.New(lastUpdated)}, nil
122}
123
124// PutFile implements RuntimeService.
125func (s *Server) PutFile(ctx context.Context, req *runtimev1.PutFileRequest) (*runtimev1.PutFileResponse, error) {

Callers

nothing calls this directly

Calls 6

AddRequestAttributesFunction · 0.92
GetClaimsFunction · 0.92
CanMethod · 0.80
StringMethod · 0.65
GetFileMethod · 0.65

Tested by

no test coverage detected