MCPcopy
hub / github.com/microsoft/retina / executeFileDownload

Method executeFileDownload

cli/cmd/capture/download.go:341–352  ·  view source on GitHub ↗

executeFileDownload downloads the file content from the pod

(ctx context.Context, pod *corev1.Pod, downloadCmd *DownloadCmd)

Source from the content-addressed store, hash-verified

339
340// executeFileDownload downloads the file content from the pod
341func (ds *DownloadService) executeFileDownload(ctx context.Context, pod *corev1.Pod, downloadCmd *DownloadCmd) ([]byte, error) {
342 content, err := ds.createDownloadExec(ctx, pod, downloadCmd.FileReadCommand)
343 if err != nil {
344 return nil, errors.Join(ErrExecFileDownload, err)
345 }
346
347 if content == "" {
348 return nil, ErrEmptyDownloadOutput
349 }
350
351 return []byte(content), nil
352}
353
354// createDownloadPod creates a pod for downloading files from the host
355func (ds *DownloadService) createDownloadPod(ctx context.Context, nodeName, hostPath, captureName string, downloadCmd *DownloadCmd) (*corev1.Pod, error) {

Callers 1

DownloadFileContentMethod · 0.95

Calls 1

createDownloadExecMethod · 0.95

Tested by

no test coverage detected