( ctx context.Context, info hftype.ArtifactInfo, body io.ReadCloser, token string)
| 28 | ) |
| 29 | |
| 30 | func (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 | } |
nothing calls this directly
no test coverage detected