MCPcopy
hub / github.com/wavetermdev/waveterm / handleAppendJobFile

Function handleAppendJobFile

pkg/jobcontroller/jobcontroller.go:794–812  ·  view source on GitHub ↗
(ctx context.Context, jobId string, fileName string, data []byte)

Source from the content-addressed store, hash-verified

792}
793
794func handleAppendJobFile(ctx context.Context, jobId string, fileName string, data []byte) error {
795 err := doWFSAppend(ctx, waveobj.MakeORef(waveobj.OType_Job, jobId), fileName, data)
796 if err != nil {
797 return fmt.Errorf("error appending to job file: %w", err)
798 }
799
800 job, err := wstore.DBGet[*waveobj.Job](ctx, jobId)
801 if err != nil {
802 return fmt.Errorf("error getting job: %w", err)
803 }
804 if job != nil && job.AttachedBlockId != "" {
805 err = doWFSAppend(ctx, waveobj.MakeORef(waveobj.OType_Block, job.AttachedBlockId), fileName, data)
806 if err != nil {
807 return fmt.Errorf("error appending to block file: %w", err)
808 }
809 }
810
811 return nil
812}
813
814func runOutputLoop(ctx context.Context, jobId string, streamId string, reader *streamclient.Reader) {
815 defer reader.Close()

Callers 1

runOutputLoopFunction · 0.85

Calls 3

MakeORefFunction · 0.92
DBGetFunction · 0.92
doWFSAppendFunction · 0.85

Tested by

no test coverage detected