Skip to content

[rstream-graph] optional streams on stream sync ? #311

@ruigil

Description

@ruigil

I've been playing with rstream-graph, and I've come across what I think is a valid use case that is not supported in stream sync.

After the first sync, stream sync triggers the function when ANY of the input streams produces a value or ALL of them produces a value. My use case requires that I can define a subset of the inputs that can trigger the function.

In the following node, I want to trigger the renderFrame function once for every previous node execution, but the mouse stream triggers the function leading to overdrawing issues, and I can't use the flag reset=true of stream sync, because the input texture is only produced once.

{
    fn: renderFrame,
    ins:{
        buffer: { stream: "/previous/node" },
        texture: { path: "/data/created/once" },
        mouse: { stream: () => gestures }
    }
}

I need to be able to specify a subset of the inputs that will NOT trigger the function after the first sync while keeping the latest value, (in this case ['texture','mouse'] ), also with the reset flag applied only to the remaining inputs.

Do you think this is a valid use case, or rstream-graph is meant to be used in "pure" dataflows only, with functions without side-effects? If you think this is valid, what would be the best way to implement this feature?

I tried to change StreamSync and the PartitionSync transducer to accept a new parameter of optional stream ids, but I imagine it could be specified as a flag in the input itself, i.e.

{
    fn: renderFrame,
    ins:{
        buffer: { stream: "/previous/node" },
        texture: { path: "/data/created/once" , optional: true },
        mouse: { stream: () => gestures , optional: true }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions