datrs / hypercore

Secure, distributed, append-only log
https://docs.rs/hypercore
Apache License 2.0
334 stars 37 forks source link

Change stack from `failure` to `std::error::Error` #101

Closed bltavares closed 4 years ago

bltavares commented 4 years ago

Feature Request

Summary

Nowadays hypercore is defined for storage where errors are failure::Error eg

This predates when Rust had std::error::Error trait, and could now be replaced with a Error + Send + Sync + 'static, such as anyhow, snafu or coreerror for a no_std crate.

This is also one less crate on the stack.

Motivation

This should help us move into no_std in the future, specially useful for WASM and embedded.

Guide-level explanation

We could replace failure with anyhow on random-access-disk and random-access-storage to use context during errors, which is also compatible with std::error::Error.

We can then define hypercore using the std Error trait, and broaden the types of Storages hypercore can use.

Reference-level explanation

Drawbacks

Rationale and alternatives

Unresolved Questions

bltavares commented 4 years ago

PRs with moves opened and linked to the issue.

bltavares commented 4 years ago

Landed on the beta versions