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

Support for async/await syntax in Rust SDK #1732

Closed
yoshd opened this issue Aug 2, 2020 · 2 comments · Fixed by #1733
Closed

Support for async/await syntax in Rust SDK #1732

yoshd opened this issue Aug 2, 2020 · 2 comments · Fixed by #1733
Labels
area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc kind/feature New features for Agones
Milestone

Comments

@yoshd
Copy link
Contributor

yoshd commented Aug 2, 2020

Is your feature request related to a problem? Please describe.
In Rust 1.39.0 the async/await syntax is stable, I suggest also supporting the async/await syntax in the Agones Rust SDK.

Relates to:
#1300
#1201

Describe the solution you'd like

Propose the following functions:

let sdk = agones::Sdk::new()?;

sdk.ready_async().await?;
sdk.set_label_async("test-label", "test-value").await?;
sdk.set_annotation_async("test-annotation", "test value").await?;
let gameserver = sdk.get_gameserver_async().await?;
// Other functions are similar...

Bump up some crate versions that the Rust SDK depends on.
The futures crate should be updated to version 0.3 or higher to support async/await syntax.
Also, the grpcio crate should be updated to version 0.6 or higher.

Describe alternatives you've considered
It might be possible to use the tonic proposed in #1300. But if we don't break the current API of the Rust SDK, it's easy to use a newer version of grpcio.

Additional context
By updating the grpcio version, #1201 may also be solved.

@yoshd yoshd added the kind/feature New features for Agones label Aug 2, 2020
@yoshd yoshd changed the title Support for async/wait syntax in Rust SDK Support for async/await syntax in Rust SDK Aug 2, 2020
@markmandel
Copy link
Collaborator

Not necessarily against this idea, but curious what we are looking to gain by adding async functions?

Just figuring, it means we have to do blocking + async for every API surface for Rust going forward, and that will increase maintenance requirements. Just a thought.

Also - do we need to make sure it works for both Tokio, std-async and any other async engine -- or are we choosing one over another?

@yoshd
Copy link
Contributor Author

yoshd commented Aug 4, 2020

Not necessarily against this idea, but curious what we are looking to gain by adding async functions?

What I can easily think of is seamlessly implementing the Agones SDK for game server applications running on an asynchronous runtime.

Just figuring, it means we have to do blocking + async for every API surface for Rust going forward, and that will increase maintenance requirements. Just a thought.

You're right.
However, since the SDK is a simple gRPC wrapper at the moment, I don't think the maintenance cost is too high.
But if the number of functions increases in the future, maintenance requirements may increase...

Also - do we need to make sure it works for both Tokio, std-async and any other async engine -- or are we choosing one over another?

Ideally, I think it should work for both of the above.
However, if this uses tonic, it must use Tokio.
I think that grpc-rs has a core implementation of C++, so I don't think there are any restrictions on runtime, but I have not actually verified it.

@markmandel markmandel added this to the 1.8.0 milestone Aug 11, 2020
@markmandel markmandel added the area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc label Aug 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc kind/feature New features for Agones
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants