AntelopeIO / appbase

Other
1 stars 6 forks source link

Separate `executor` concept from `application` to support complex task scheduling and execution #9

Closed greg7mdp closed 1 year ago

greg7mdp commented 1 year ago

For the parallelization of readonly transactions, we need to have more complex scheduling of tasks (for example separate queues for readonly and read/write transactions), and be able to update how tasks are scheduled depending on which type of transaction we want to process.

The previous architecture of appbase did not allow to customize the enqueuing and execution of tasks.

This PR introduce the notion of an executor class, which can be provided by an application in order to customize the enqueuing and processing of tasks. A default_executor class is also provided which implements the same functionality as existed before.

This PR does not change the default appbase functionality or interface. Nodeos still builds with this version of appbase without any change, and all the tests pass.

This work was made in collaboration with @linh2931. He will submit a further PR adding more tests reflecting how appbase will be used in nodeos for parallelizing readonly transactions.

greg7mdp commented 1 year ago

Please fix the error causing following failure:

That's weird, I'm using clang and I only get warnings for this error.

I'm not quite sure why we didn't have this issue before my latest changes, but it is a problem in tests/trx_generator/trx_generator.hpp which includes plugin.hpp instead of application.hpp like we do everywhere else.

When we update the leap repo to point to the new appbase, we can fix that at the same time. Actually we need to remove #include <appbase/plugin.hpp> from tests/trx_generator/trx_generator.hpp , it is not needed.

greg7mdp commented 1 year ago

Actually, because the file plugin.hpp is inconsistent on its own (it needs the application definition), I have removed it. There is an error when building leap, but it is easily resolved by removing #include <appbase/plugin.hpp> from tests/trx_generator/trx_generator.hpp , as it is not needed.

linh2931 commented 1 year ago

The clang version I am using is 15.