MCPcopy Create free account
hub / github.com/krau/SaveAny-Bot / NewTaskElement

Function NewTaskElement

core/tasks/batchtfile/task.go:51–78  ·  view source on GitHub ↗
(
	stor storage.Storage,
	path string,
	file tfile.TGFile,
)

Source from the content-addressed store, hash-verified

49}
50
51func NewTaskElement(
52 stor storage.Storage,
53 path string,
54 file tfile.TGFile,
55) (*TaskElement, error) {
56 id := xid.New().String()
57 _, ok := stor.(storage.StorageCannotStream)
58 if !config.C().Stream || ok {
59 cachePath, err := filepath.Abs(filepath.Join(config.C().Temp.BasePath, fmt.Sprintf("%s_%s", id, file.Name())))
60 if err != nil {
61 return nil, fmt.Errorf("failed to get absolute path for cache: %w", err)
62 }
63 return &TaskElement{
64 ID: id,
65 Storage: stor,
66 Path: path,
67 File: file,
68 localPath: cachePath,
69 }, nil
70 }
71 return &TaskElement{
72 ID: id,
73 Storage: stor,
74 Path: path,
75 File: file,
76 stream: true,
77 }, nil
78}
79
80func NewBatchTGFileTask(
81 id string,

Callers 2

createTGFilesTaskMethod · 0.92

Calls 3

CFunction · 0.92
NameMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected