Abitrary persistence for wallet #771
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
With the following approach we can accomplish two things at once:
To accomplish this we can differentiate between a native backend and a foreign backend. The foreign backend interacts with the FFI
ChangeSet
, whereas the native backend can just use the Rust changeset directly. Whenever a new backend is introduced in Rust, a new enum variant may simply be added to thePersistenceType
. To build a Sqlite backend, or a foreign backend, the user will use thePersister
structure.Abitrary persistence is allowed by implementing the
Persistence
trait. This was accomplished with no changes to #756.I hope 1. motivates this change thoroughly, as we expect BDK will add support for new backends in the future. I am also interested in the applications of 2., where a user might be able to do encrypted and/or cloud storage.
Notes to the reviewers
We use an enum to allow for Rust backends to use Rust changesets directly. Otherwise we may convert them to FFI types. I've thought through many approaches, and I am convinced this is the most robust.
Changelog notice
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committing