Skip to content
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

Custom backends support #405

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Commits on Sep 27, 2019

  1. In http::sender::params, use http crate instead of reqwest

    The types in reqwest are re-exports of the types in http, so this should not break
    anything, and is needed to make reqwests an optional dependency.
    ColonelThirtyTwo committed Sep 27, 2019
    Configuration menu
    Copy the full SHA
    a962397 View commit details
    Browse the repository at this point in the history

Commits on Oct 3, 2019

  1. Refactor into common Pending type

    Almost every module in client::requests defines their own Pending struct,
    wrapping a Boxed future, using copy+pasted code. This patch implements a
    templated Pending type in the client::requests module, and uses it in submodules.
    
    The patch also sets up a type alias called Pending in each of the submodules,
    to retain backwards compatibility.
    ColonelThirtyTwo committed Oct 3, 2019
    Configuration menu
    Copy the full SHA
    fae77d4 View commit details
    Browse the repository at this point in the history

Commits on Oct 4, 2019

  1. Refactor node sniffing

    Move the implementations of NextParams for SniffedNodes into the sender's
    corresponding files, since they fit better there.
    
    Remove (a)sync_next, since it couples the SniffedNodes object too tightly to the
    senders. Instead, senders can call `next_or_start_refresh` on the SniffedNodes object
    to get the address or a new `Refresher` struct indicating that a refresh is needed.
    The sender can then send out the request for the node list, and when the sender gets the
    results, it can feed them to the Refresher, consuming it. This makes the SniffedNodes
    object flexible with how senders receive their results.
    ColonelThirtyTwo committed Oct 4, 2019
    Configuration menu
    Copy the full SHA
    3cc17ad View commit details
    Browse the repository at this point in the history

Commits on Nov 8, 2019

  1. Add RequestInner trait, and implement it on request types

    The trait specifies the Request and Response types of the request, and specifies
    a function to convert the request builder to the Request type.
    
    All of the request builder types already had an `into_request` function, so this
    trait just codifies that behavior.
    
    Note that the raw request does not implement this (yet) since it does not do a
    standard conversion.
    
    This patch doesn't have any uses of the trait yet, but future patches will make
    use of it.
    ColonelThirtyTwo committed Nov 8, 2019
    Configuration menu
    Copy the full SHA
    c2384f7 View commit details
    Browse the repository at this point in the history
  2. Generate IntoEndpoint for request types

    The request types can only be converted into one concrete type of Endpoint,
    but the existing From trait implementation can't convey that, making it impossible
    to write a bound for a type that can be converted into an endpoint with any body
    type.
    
    The new IntoEndpoint trait fixes this by making the body an associated type.
    The bound can be written as, for instance, `Req: for<'a> IntoEndpoint<'a>`
    ColonelThirtyTwo committed Nov 8, 2019
    Configuration menu
    Copy the full SHA
    dc6dcc0 View commit details
    Browse the repository at this point in the history
  3. Generic sending support

    This adds and changes things to allow external implementations of `Sender`
    to exist, and to have a unified send function for results (currently
    implemented alongside of the existing send functionality, but will replace it).
    
    This patch adds TypedSender<T>, a companion trait for Sender that also
    lets the client handle deserialization, instead of having every request
    type implement deserialization for the two available senders.
    ColonelThirtyTwo committed Nov 8, 2019
    Configuration menu
    Copy the full SHA
    a173049 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ec49293 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d94d864 View commit details
    Browse the repository at this point in the history
  6. Features for SyncSender and AsyncSender

    Client code can now choose whether to include the sync sender or
    async sender via Cargo's features system. By default both are included.
    
    Make public some crate-private types, a) to avoid unused warnings, and b)
    other crates will likely need them for custom sender implementations.
    
    Had to downgrade the url crate to be compatible with reqwest's version.
    ColonelThirtyTwo committed Nov 8, 2019
    Configuration menu
    Copy the full SHA
    c610228 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    59e5cbc View commit details
    Browse the repository at this point in the history
  8. Make HttpRequest fields public

    Custom backends need access to the fields
    ColonelThirtyTwo committed Nov 8, 2019
    Configuration menu
    Copy the full SHA
    063edc0 View commit details
    Browse the repository at this point in the history
  9. Create a public constructor for Client

    Allows custom backends to create a client
    ColonelThirtyTwo committed Nov 8, 2019
    Configuration menu
    Copy the full SHA
    68444ed View commit details
    Browse the repository at this point in the history
  10. Remove NextParams, moving functionality to Sender::next_params

    The trait requires implementing on types that this crate exports, like SniffedNodes<TSender>
    and its parent NodeAddresses<TSender>, but that's not possible to do in external crates, due
    to rust's orphan rules.
    
    The return type, once again, is heavily dependent on the sender, since SniffedNodes needs to
    do a potentially asynchronous http request. So just cut out the middle man and fold the code
    into the Sender trait.
    ColonelThirtyTwo committed Nov 8, 2019
    Configuration menu
    Copy the full SHA
    6250ac2 View commit details
    Browse the repository at this point in the history
  11. Make error::request public

    Backends in other crates will want to use that function.
    ColonelThirtyTwo committed Nov 8, 2019
    Configuration menu
    Copy the full SHA
    f0ddf2e View commit details
    Browse the repository at this point in the history
  12. Remove sender from SniffedNodes

    It's not needed anymore, now that the Sender itself is responsible for querying
    for nodes.
    ColonelThirtyTwo committed Nov 8, 2019
    Configuration menu
    Copy the full SHA
    354f265 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    72aa708 View commit details
    Browse the repository at this point in the history

Commits on Nov 15, 2019

  1. Configuration menu
    Copy the full SHA
    34cacea View commit details
    Browse the repository at this point in the history