-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update local
client to support middleware (Kudos Seun)
#589
Conversation
local
client to support metadata (Kudos Seun)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A PR description would be good.
This adds a new type parameter; isn't that a breaking change?
@@ -98,10 +102,11 @@ where | |||
} | |||
|
|||
/// Connects to a `Deref<Target = MetaIoHandler<Metadata + Default>`. | |||
pub fn connect<TClient, THandler, TMetadata>(handler: THandler) -> (TClient, impl Future<Item = (), Error = RpcError>) | |||
pub fn connect<TClient, THandler, TMetadata, TMiddleware>(handler: THandler) -> (TClient, impl Future<Item = (), Error = RpcError>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @dvdplm noticed it's a breaking change (so would require bumping to 16
), perhaps better to add a new set of methods like connect_with_middleware
or set the default type somehow?
Usage of middlewares is not super common, so I think it's better to keep the default connect
stuff simple.
local
client to support metadata (Kudos Seun)local
client to support middleware (Kudos Seun)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it reasonable to merge with master instead after the breaking changes? I think there is some unreleased stuff there (futures v0.3) IIRC.
any luck this can be merged and released today? |
@seunlanlege Please see #589 (comment) |
Weird I thought it could be released under 15.1? Either way, bumping to 16 feels extreme. Adding a new method, |
} | ||
|
||
/// Connects to a `Deref<Target = MetaIoHandler<Metadata + Default>`. | ||
pub fn connect<TClient, THandler, TMetadata>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hrm, this will connect without Middleware (Noop)
because of MetaIoHandler<TMetadata>
? It seems unintuitive to me but I understand that it wouldn't be backward compatible otherwise. Perhaps explain this with better documentation and remove it in v16
later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will connect with the NoopMiddleware
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yepp, that was what I meant with Middleware (Noop)
, but I was mostly referring to:
Connects to a
Deref<Target = MetaIoHandler<Metadata + Default>
It's not easy to understand that it's using the default associated type NoopMiddleware
at least not to me but I guess it could be deduced by the other with_*
methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repo is using cargo fmt
please use it and the CI will pass.
87d7550
to
ce1498a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR is now mixing versions 15.1.0
and 15.0.1
which causes the build to fail.
IMHO, we should bump minor
because it actually adds functionality in backward-compatible manner. If you don't agree please convince me :)
EDIT:
use ./_automate/bump_version.sh
to bump versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
* v15.0.1 * v15.0.1 => v15.1.0 * v15.0.1 => v15.1.0 * cargo fmt * fix tests * adds *_with_middleware methods * remove Unpin bound, add documentation, cargo fmt * 15.0.1 * bump to 15.1.0 Co-authored-by: Seun Lanlege <seunlanlege@gmail.com> Co-authored-by: Niklas <niklasadolfsson1@gmail.com>
#589) (#600) * Update `local` client to support middleware (Kudos Seun) (#589) * v15.0.1 * v15.0.1 => v15.1.0 * v15.0.1 => v15.1.0 * cargo fmt * fix tests * adds *_with_middleware methods * remove Unpin bound, add documentation, cargo fmt * 15.0.1 * bump to 15.1.0 Co-authored-by: Seun Lanlege <seunlanlege@gmail.com> Co-authored-by: Niklas <niklasadolfsson1@gmail.com> * cargo fmt --all Co-authored-by: Seun Lanlege <seunlanlege@gmail.com> Co-authored-by: Niklas <niklasadolfsson1@gmail.com>
Previously the
jsonrpc_core_client::transports::local::connect
consumed aDeref<Target=MetaIoHandler<TMetadata, NoopMiddleware>>
,This PR corrects that behaviour allowing the local transport support other
Middleware
implementations