MCPcopy
hub / github.com/flyteorg/flyte / handleSimpleType

Method handleSimpleType

flytecopilot/data/upload.go:41–57  ·  view source on GitHub ↗
(_ context.Context, t core.SimpleType, filePath string)

Source from the content-addressed store, hash-verified

39}
40
41func (u Uploader) handleSimpleType(_ context.Context, t core.SimpleType, filePath string) (*core.Literal, error) {
42 fpath, info, err := IsFileReadable(filePath, true)
43 if err != nil {
44 return nil, err
45 }
46 if info.IsDir() {
47 return nil, fmt.Errorf("expected file for type [%s], found dir at path [%s]", t.String(), filePath)
48 }
49 if info.Size() > maxPrimitiveSize {
50 return nil, fmt.Errorf("maximum allowed filesize is [%d], but found [%d]", maxPrimitiveSize, info.Size())
51 }
52 b, err := os.ReadFile(fpath)
53 if err != nil {
54 return nil, err
55 }
56 return coreutils.MakeLiteralForSimpleType(t, string(b))
57}
58
59func (u Uploader) handleBlobType(ctx context.Context, localPath string, toPath storage.DataReference) (*core.Literal, error) {
60 fpath, info, err := IsFileReadable(localPath, true)

Callers 1

RecursiveUploadMethod · 0.95

Calls 5

MakeLiteralForSimpleTypeFunction · 0.92
IsFileReadableFunction · 0.85
ErrorfMethod · 0.80
SizeMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected