Skip to content

Conversation

@bltavares
Copy link
Member

This commit moves the API from a sync call into async functions using async_trait.

We would like to use async operations on hypercore, and it would be nice to have the underlying storage using async-io when possible.
As discussed on datrs/hypercore#97, we could change the API to use async functions on the 'ram' trait.

Async Trait methods are still unstable, but possible using the 'async-trait' crate through a macro.

This PR moves the API to use async-fns. Tests are passing.

Choose one: a 🙋 feature

Checklist

  • tests pass
  • tests and/or benchmarks are included
  • documentation is changed or added

Context

Semver Changes

major as this is a breaking change and we are above 1.0.0

This commit moves the API from a sync call into async functions using async_trait.

We would like to use async operations on hypercore, and it would be nice to have the underlying storage using async-io when possible.
As discussed on datrs/hypercore#97, we could change the API to use async functions on the 'ram' trait.

Async Trait methods are still unstable, but possible using the 'async-trait' crate through a macro.

This PR moves the API to use async-fns. Tests are passing.
@bltavares
Copy link
Member Author

@substack FYI this would impact eyros also. I would love some feedback.

Cargo.toml Outdated

[dependencies]
async-trait = "0.1.24"
futures = "0.3.4"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compile times are generally better if only including futures-io for the AsyncRead + AsyncWrite traits. Alternatively async-std provides a core flag iirc.

@bltavares bltavares merged commit 0e7ab51 into datrs:master Mar 3, 2020
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

Successfully merging this pull request may close these issues.

2 participants