-
Notifications
You must be signed in to change notification settings - Fork 40
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
unable to impl Sender due to constraint on elastic::client::private::Sealed #281
Comments
Hi @softprops thanks for reaching out! tl;dr We don't accommodate this yet, but I have an idea of how we could reasonably quickly. This is what the It looks like right now I haven't really got anything in the API that would make this possible, which is a shame. For cases like this where you just want a chance to inspect and tweak the raw request before it goes out I'd be on board with adding a function to the client that can be used to inspect and mutate it: let client = AsyncClientBuilder::new()
.pre_send_raw(|request| {
// `request` is `reqwest::async::Request` or `RequestBuilder` here
// sign the request and either return it or a totally new one
}) I'd held off on this because it leaks the underlying http library, overlaps with What do you think? |
That would be perfect. The ability to get a handle on the request before it's sent to compute a request signature is precisely what I need. |
I've got an implementation of this on the |
Hey @softprops wondering if you ever got aws request signing working using the Also its been awhile since this was initially opened. Is opening the Sender trait for implementation still the plan @KodrAus ? Fantastic crate btw. (shout out to softprops as well for all the rust + aws tools) |
Hi @MrArnoldPalmer 👋 Even though it's been a long time, the state of the world hasn't actually moved that far since then. I've only just managed to ship a prerelease build onto crates.io that includes the It looks like The trait SyncSender: Sender {
...
}
impl<T: SyncSender> Sender for T {}
trait AsyncSender: Sender {
...
}
// NOTE: This won't be coherent, but could work around it
impl<T: AsyncSender> Sender for T {} Then we basically remove |
@KodrAus awesome, looks like it will make this much easier. I'll keep an eye out for this. I got basic signing functionality working using |
Was hoping to use this in a WASM project by implementing a sender that uses JS functions but I guess that isn't happening. |
Might take a stab at this, because I really want to use this crate in my web app. My idea was to have the sender specify a type to wrap the results in; ex a plain |
So this will require a bit of a refactor around the Client, Sender, and SniffedNodes. Basically:
So it's not as simple as having one sync sender and one async sender with multiple implementations. The receiving mechanism has to be generic too. In particular the code for refreshing SniffedNodes needs to be pulled into the client's implementation, since it's the only thing that knows when a response is ready. |
Very nice looking crate!
I'm evaluating this as an option to use aws's hosted elastic search. aws requires all requests to be signed which seems most doable with this crate if I implement a Sender that signs requests before sending them. However it seems impl Sender requires implementing a trait that's not visible outside of this crate, elastic::client::private::Sealed.
Do you have another recommendation on how I could accomplish request signing?
The text was updated successfully, but these errors were encountered: