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

Expose Connection<I> #329

Merged
merged 8 commits into from
Sep 21, 2021
Merged

Expose Connection<I> #329

merged 8 commits into from
Sep 21, 2021

Conversation

connec
Copy link
Contributor

@connec connec commented Sep 16, 2021

  • 366e0dc chore: don't deny warnings in source

    It's considered an anti-pattern to deny warnings in the source itself.
    It's better to configure this in the environment, which we already do
    for CI with -D warnings.

  • ce50e47 feat!: return Connection from Endpoint::connect_*

    This is a small step towards removing the ConnectionPool. The
    ConnectionPool is used for a number of things, one of which is
    enabling the Endpoint APIs that operate exclusively on SocketAddrs,
    rather than connection handles.

    This commit exposes the Connection<I> type, and updates the
    Endpoint::new, Endpoint::connect_to, and Endpoint::connect_to_any
    methods to return Connection<I> rather than SocketAddr. For now, the
    only public method on Connection<I> is remote_address, which callers
    can then use with the existing (unchanged) SocketAddr-based Endpoint
    APIs. Future commits will introduce additional Connection methods to
    replace these SocketAddr-based APIs.

    BREAKING CHANGE: Endpoint::new, Endpoint::connect_to, and
    Endpoint::connect_to_any now use Connection<I> instead of
    SocketAddr in their return type.

  • 4f0cf52 docs: expand and clarify Endpoint method documentation

    This mostly cleans up existing information about connection pooling and
    priority. Connection pooling info has been added to each method, to make
    sure the behaviour is clear in each case.

  • bc0b5c7 docs: fix a broken intra-doc link

  • 7d0b710 ci: upgrade wagoid/commitlint-github-action

    The new version has tighter defaults, which should prevent us from
    committing dodgy commit types like wip. The GITHUB_TOKEN has also
    been removed, since the repository is public and the action is read
    only.

  • 54d1040 refactor!: replace Endpoint addr/id getters

    Rather than Endpoint having getters for addr
    (get_socket_addr_by_id) and id (get_connection_id) there are now
    only getters for Connection, either by addr
    (get_connection_by_addr) or by id (get_connection_by_id).

    For now this mostly adds indirection for callers, who can call
    Connection::id or Connection::remote_address on the result to
    achieve the same outcome as before.

    BREAKING CHANGE: Endpoint::get_connection_id and
    Endpoint::get_socket_addr_by_id have been removed.
    Endpoint::get_connection_by_addr and Endpoint::get_connection_by_id
    can be used instead to get a Connection, from which the id or
    remote_address can be retrieved.

  • b3bdf3c ci: fix cargo-udeps action

    CARGO_HTTP_MULTIPLEXING has been disabled, which seems to have
    resolved our network woes, and -D warnings is removed from RUSTFLAGS
    for that job, since new nightlies may introduce additional lints that we
    wouldn't otherwise block. The SHA of the action has been pinned also, to
    ensure there are no surprise updates.

  • 7110a3f test: bump timeouts in ConnectionDeduplicator tests

    The timing-based tests for this module are flaky, but since
    ConnectionDeduplicator isn't long for this world we'll live with
    bumping the timeout for now.

Chris Connelly added 5 commits September 16, 2021 11:59
It's considered an anti-pattern to deny warnings in the source itself.
It's better to configure this in the environment, which we already do
for CI with `-D warnings`.
This is a small step towards removing the `ConnectionPool`. The
`ConnectionPool` is used for a number of things, one of which is
enabling the `Endpoint` APIs that operate exclusively on `SocketAddr`s,
rather than connection handles.

This commit exposes the `Connection<I>` type, and updates the
`Endpoint::new`, `Endpoint::connect_to`, and `Endpoint::connect_to_any`
methods to return `Connection<I>` rather than `SocketAddr`. For now, the
only public method on `Connection<I>` is `remote_address`, which callers
can then use with the existing (unchanged) `SocketAddr`-based `Endpoint`
APIs. Future commits will introduce additional `Connection` methods to
replace these `SocketAddr`-based APIs.

BREAKING CHANGE: `Endpoint::new`, `Endpoint::connect_to`, and
`Endpoint::connect_to_any` now use `Connection<I>` instead of
`SocketAddr` in their return type.
This mostly cleans up existing information about connection pooling and
priority. Connection pooling info has been added to each method, to make
sure the behaviour is clear in each case.
The new version has tighter defaults, which should prevent us from
committing dodgy commit types like `wip`. The `GITHUB_TOKEN` has also
been removed, since the repository is public and the action is read
only.
@connec connec marked this pull request as ready for review September 16, 2021 11:23
@connec connec requested a review from a team as a code owner September 16, 2021 11:23
@connec connec enabled auto-merge (rebase) September 16, 2021 13:12
Chris Connelly added 3 commits September 16, 2021 17:28
Rather than `Endpoint` having getters for `addr`
(`get_socket_addr_by_id`) and `id` (`get_connection_id`) there are now
only getters for `Connection`, either by `addr`
(`get_connection_by_addr`) or by `id` (`get_connection_by_id`).

For now this mostly adds indirection for callers, who can call
`Connection::id` or `Connection::remote_address` on the result to
achieve the same outcome as before.

BREAKING CHANGE: `Endpoint::get_connection_id` and
`Endpoint::get_socket_addr_by_id` have been removed.
`Endpoint::get_connection_by_addr` and `Endpoint::get_connection_by_id`
can be used instead to get a `Connection`, from which the `id` or
`remote_address` can be retrieved.
`CARGO_HTTP_MULTIPLEXING` has been disabled, which seems to have
resolved our network woes, and `-D warnings` is removed from `RUSTFLAGS`
for that job, since new nightlies may introduce additional lints that we
wouldn't otherwise block. The SHA of the action has been pinned also, to
ensure there are no surprise updates.
The timing-based tests for this module are flaky, but since
`ConnectionDeduplicator` isn't long for this world we'll live with
bumping the timeout for now.
@connec connec merged commit b8e84f3 into maidsafe:master Sep 21, 2021
@connec connec deleted the rip-connection-pool branch September 21, 2021 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants