Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ruigil opened this issue Sep 6, 2021 · 1 comment
Open

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

ruigil opened this issue Sep 6, 2021 · 1 comment

Comments

@ruigil
Copy link

ruigil commented Sep 6, 2021

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 }
    }
}
@postspectacular
Copy link
Member

Hi @ruigil - that's an interesting thought experiment which will also require some experimentation from my side. Will get back to you in the next couple of days...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants