amethyst / shred

Shared resource dispatcher
Apache License 2.0
236 stars 66 forks source link

Batch processing #144

Closed AndreaCatania closed 5 years ago

AndreaCatania commented 5 years ago

Batch dispatching

The Batch is a feature that will allow to control the dispatching of a group of systems. It can run these systems multiple times.

So is possible to register some systems under the Batch, and for this reason they are called Sub Systems. Despite this name they are just Systems nothing more, nothing less.

The Batch will control it's dispatching, it's setup, and it's dependencies.

To control the Batch execution exist a BatchController. It is a trait that a System must implement if he want to control the execution of the Batch. Then is possible to set it using one of the two: BatchBuilder::with_batch_controller or BatchBuilder::set_batch_controller.

The BatchBuilder is responsible for the creation of the Batch. It works similarly to the DispatcherBuilder, and indeed is possible to set the systems and the barriers. But despite the similarities, it at the end will create a Batch.

Note that depending on the dependencies of the Sub Systems, the Batch can run in parallel with other Systems. In addition the Sub Systems can run in parallel within the Batch.

So everything in line with the actual shred!


Here the test project that I've used to test the code shred_test.zip

AndreaCatania commented 5 years ago

@torkleyy Thanks a lot for the feedback. I did a new PR since it was easier for me rework from the scratch. https://github.com/slide-rs/shred/pull/147