MCPcopy
hub / github.com/harness/harness / LfsInfo

Method LfsInfo

registry/app/api/controller/pkg/huggingface/lfs_info.go:30–74  ·  view source on GitHub ↗
(
	ctx context.Context, info hftype.ArtifactInfo, body io.ReadCloser, token string)

Source from the content-addressed store, hash-verified

28)
29
30func (c *controller) LfsInfo(
31 ctx context.Context, info hftype.ArtifactInfo, body io.ReadCloser, token string) *LfsInfoResponse {
32 f := func(registry registrytypes.Registry, a pkg.Artifact) response.Response {
33 info.RegIdentifier = registry.Name
34 info.RegistryID = registry.ID
35 hfRegistry, ok := a.(huggingface.Registry)
36 if !ok {
37 return &LfsInfoResponse{
38 BaseResponse{
39 fmt.Errorf("invalid registry type: expected huggingface.Registry"),
40 nil,
41 }, nil,
42 }
43 }
44 headers, lfsInfoResponse, err := hfRegistry.LfsInfo(ctx, info, body, token)
45 return &LfsInfoResponse{
46 BaseResponse{
47 err,
48 headers,
49 }, lfsInfoResponse,
50 }
51 }
52
53 result, err := base.ProxyWrapper(ctx, c.registryDao, f, info)
54
55 if err != nil {
56 return &LfsInfoResponse{
57 BaseResponse{
58 err,
59 nil,
60 }, nil,
61 }
62 }
63 lfsInfoResponse, ok := result.(*LfsInfoResponse)
64 if !ok {
65 return &LfsInfoResponse{
66 BaseResponse{
67 fmt.Errorf("invalid response type: expected LfsInfoResponse"),
68 nil,
69 }, nil,
70 }
71 }
72 return lfsInfoResponse
73
74}

Callers

nothing calls this directly

Calls 3

ProxyWrapperFunction · 0.92
LfsInfoMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected