snivilised / lorax

🌟 reactive extensions for go (a pseudo rxgo version 3)
MIT License
4 stars 0 forks source link

change manifold function to receive the JobOutput #298

Closed plastikfan closed 2 months ago

plastikfan commented 2 months ago

This will allow the client to store a job output on the JobObject object.

func manifoldFuncResponse is implemented as:

    if job, ok := input.(Job[I]); ok {
        payload, e := mf(job.Input)

        if wi != nil {
            _ = respond(ctx, wi, &JobOutput[O]{
                ID:         job.ID,
                SequenceNo: job.SequenceNo,
                Payload:    payload,
                Error:      e,
            })
        }
    }

but we should create the JobOutput before invoking mf, then pass it in. The JobOutput should contain a Result field defined as an any, specifically for the use by the client.

plastikfan commented 2 months ago

Actually, this isn't required; I was getting confused by the requirement of traverse which will define the output as TraverseResult[O], where O is the client core type. TraverseResult will need the Result field defined as O, which the client can set.