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

refactor(dns): unify symbol naming #4505

Merged
merged 18 commits into from
Sep 24, 2023
Merged

refactor(dns): unify symbol naming #4505

merged 18 commits into from
Sep 24, 2023

Conversation

whtsht
Copy link
Contributor

@whtsht whtsht commented Sep 15, 2023

Description

Renamed the following

  • dns::GenDnsConfig -> dns::Config
  • dns::DnsConfig -> dns::async_std::Config
  • dns::TokioDnsConfig -> dns::tokio::Config

If async-std feature is enable, use dns::async_std::Config. When using tokio, import dns::tokio::Config . There is no need to use dns::Config directly.

Resolves #4486.
Related: #2217.

Links to any relevant issues

Tracking issue for renaming symbols across the repository #2217

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

@whtsht whtsht changed the title transports/dns: Unify symbol naming refactor(dns): Unify symbol naming Sep 15, 2023
@thomaseizinger
Copy link
Contributor

Thanks! To make this an easier transition for our users, we usually keep the old symbols but deprecate them and mention in the deprecation message, what they have been renamed to.

You can do that by creating a type-alias with the old name in place of the old symbol!

That would also make this a non-breaking change which means we can release it immediately and don't have to wait for the next breaking release.

Can you add those types please? :)

See https://github.com/libp2p/rust-libp2p/pull/3852/files#diff-8afb61a90391b0558bf7653cf3ddaba5dec55a51ddac2eeb1d499d9af84b6b7d for an example!

@thomaseizinger thomaseizinger changed the title refactor(dns): Unify symbol naming refactor(dns): unify symbol naming Sep 15, 2023
@thomaseizinger
Copy link
Contributor

That would also make this a non-breaking change

A good way to test this is to temporarily undo all changes in other crates in the workspace. They should still compile after that! :)

@whtsht
Copy link
Contributor Author

whtsht commented Sep 17, 2023

I made the following changes based on the reviews.

  • Rename DnsErr to Error
  • Add type alias such as type TokioDnsConfig<T> = Config<T> to make the change non-breaking.

I also temporarily reverted all changes to other crates in the workspace and checked to see if the test passed.

Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I've left a few more comments :)

transports/dns/src/lib.rs Outdated Show resolved Hide resolved
transports/dns/Cargo.toml Outdated Show resolved Hide resolved
transports/dns/CHANGELOG.md Outdated Show resolved Hide resolved
transports/dns/src/lib.rs Show resolved Hide resolved
transports/dns/src/lib.rs Outdated Show resolved Hide resolved
@whtsht
Copy link
Contributor Author

whtsht commented Sep 21, 2023

The version in this branch has been changed to 0.40.1. Also, the since attribute in the deprecated macro has been deleted. I postponed the documentation update.

Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the changes!

I am happy to delay the documentation update but it just occurred to me that we should actually name the main struct here Transport to be consistent with others.

libp2p-tcp for example has a Transport AND a Config so naming this one here Config would be a bit confusing. Sorry for not noticing this earlier.

transports/dns/src/lib.rs Show resolved Hide resolved
transports/dns/src/config/async_std.rs Outdated Show resolved Hide resolved
transports/dns/src/lib.rs Outdated Show resolved Hide resolved
transports/dns/src/lib.rs Outdated Show resolved Hide resolved
transports/dns/src/lib.rs Outdated Show resolved Hide resolved
transports/dns/src/lib.rs Outdated Show resolved Hide resolved
refactor(dns): rename `Config` to `Transport`

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

update
Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! This is ready modulo a few errors in the documentation :)

transports/dns/CHANGELOG.md Outdated Show resolved Hide resolved
transports/dns/src/lib.rs Outdated Show resolved Hide resolved
transports/dns/src/lib.rs Outdated Show resolved Hide resolved
@thomaseizinger
Copy link
Contributor

modulo a few errors in the documentation

See CI failures.

@thomaseizinger
Copy link
Contributor

Thanks for this work! :)

@mergify mergify bot merged commit 95890b5 into libp2p:master Sep 24, 2023
73 checks passed
@whtsht whtsht deleted the dns-rename branch September 24, 2023 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dns: rename to follow naming convention across repositry
2 participants