Skip to content
This repository has been archived by the owner on Jan 23, 2022. It is now read-only.

Use internal client + expose macros #19

Open
kianenigma opened this issue Jul 8, 2020 · 0 comments
Open

Use internal client + expose macros #19

kianenigma opened this issue Jul 8, 2020 · 0 comments
Labels
P-sub-storage Relates to the sub-storage project.

Comments

@kianenigma
Copy link
Collaborator

The entire interface to sub-storage depends on client and at. alternatively, sub-storage could create its own internal client. The user would have to call into sub_storage::init_client(URI).await once and henceforth it would be used.

I am not yet sure if this is a correct api design as well, but it is indeed easier.

This would allow us to macro-ify the crate as well, such as:

let a: Type = sub_storage::value!("ModuleName", "StorageName").await;
let b: Type = sub_storage::map!("ModuleName", "StorageName", key).await;

// optionally
let b: Type = sub_storage::map_at!("ModuleName", "StorageName", key, hash).await;

Which is not really pretty now given that we have to pass in a client inwards as well.

@kianenigma kianenigma added the P-sub-storage Relates to the sub-storage project. label Jul 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P-sub-storage Relates to the sub-storage project.
Projects
None yet
Development

No branches or pull requests

1 participant