Commit 1779dbe
Add a subscription manager (#548)
* WIP: Add a subscription manager.
The idea is to use the `Subscriptions` struct from Substrate, which
is used to drive subscription futures to completion, and modify
it for "general" use.
* Allow IdProvider::Id and SubscriptionId to work together
Adds trait bounds that allow conversion between the two, removing
the need for generics in SubscriptionId.
* Update SubscriptionId tests
* Rustfmt
* Use `SubscriptionId` as the key for `active_subscriptions`
* Add subscription ID providers.
Adds two subscription ID providers which can be used
by the SubscriptionManager. One provides a simple numeric
ID, while the other provides a random string.
* Add some documentation
* Clean up comment and naming
* Change the NumericIdProvider to use `u64` IDs
Instead of providing a guarantee that we can convert between
`usize` and `u64` we make the assumptions that it's unlikely
that we're running on an architecture larger than 64-bits and
we use a `u64` directly.
* Add tests for IdProvider and SubscriptionManager
Note: There's one test that doesn't pass yet which has to do
with the `cancel()` function of the SubscriptionManager.
* Restore RandomStringIdProvider as the default provider
* Retain receiver.:
* Make test executor a lazy static
* Rustfmt
* Add a comment to test
* Remove `matches!` macro
Our Windows CI runner isn't up to date and thinks this
is still a nightly feature
Co-authored-by: Tomasz Drwięga <[email protected]>1 parent 0d31c50 commit 1779dbe
4 files changed
+464
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
0 commit comments