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

Make #[scenario] macro work on n-arity functions #1

Open
byronwasti opened this issue Feb 26, 2024 · 0 comments
Open

Make #[scenario] macro work on n-arity functions #1

byronwasti opened this issue Feb 26, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@byronwasti
Copy link
Collaborator

byronwasti commented Feb 26, 2024

Right now, the #[scenario] macro only works on functions which take no arguments and return no values.

#[scenario]
async fn scenario_a() {
}

Allowing the user to use a function which takes in arguments is useful for a variety of reasons, with the most important being adding context to the scenario. The tricky part of this is that (1) Scenarios are run in parallel on one machine, and (2) Scenarios can be sent between machines. This likely limits the arguments allowed for a scenario to be (a) references/Copy and (b) serializable. Having arguments which are Clone is a possibility (and just cloning on every invocation), though I worry it will lead to a performance trap which is easy to fall into.

For context, I've been looking at how WebServers do n-arity handlers (eg. How axum handlers work), however as far as I can tell they require a boxed future which isn't ideal. Another option I've been considering is expanding the #[scenario] macro to essentially provide a "wrapper" function around the user-supplied scenario which would take some Argument object and expand it into the user's arguments.

Essentially, there are two intertwined sets of requirements: (1) How to handle the type-system tricks for being generic over any n-arity function, (2) How to handle the cloning/referencing and serialization/deserialization of the arguments for running a function in parallel + sending data across servers.

@byronwasti byronwasti added the enhancement New feature or request label Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant