Skip to content

Commit

Permalink
Merge branch 'master' into quic_quinn
Browse files Browse the repository at this point in the history
  • Loading branch information
kpp committed May 3, 2023
2 parents 2a1948c + 8acbabd commit 9158f48
Show file tree
Hide file tree
Showing 18 changed files with 38 additions and 649 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
fail-fast: false
matrix:
crate: ${{ fromJSON(needs.gather_published_crates.outputs.members) }}
env:
CRATE: ${{ matrix.crate }}
steps:
- name: Install Protoc
run: sudo apt-get install -y protobuf-compiler
Expand All @@ -44,39 +46,39 @@ jobs:
save-if: false

- name: Run all tests
run: cargo test --package ${{ matrix.crate }} --all-features
run: cargo test --package "$CRATE" --all-features

- name: Check if we compile without any features activated
run: cargo build --package ${{ matrix.crate }} --no-default-features
run: cargo build --package "$CRATE" --no-default-features

- run: cargo clean

- name: Check if crate has been released
id: check-released
run: |
RESPONSE_CODE=$(curl https://crates.io/api/v1/crates/${{ matrix.crate }} --silent --write-out "%{http_code}" --output /dev/null)
RESPONSE_CODE=$(curl https://crates.io/api/v1/crates/"$CRATE" --silent --write-out "%{http_code}" --output /dev/null)
echo "code=${RESPONSE_CODE}"
echo "code=${RESPONSE_CODE}" >> $GITHUB_OUTPUT
- uses: ./.github/actions/cargo-semver-checks
if: steps.check-released.outputs.code == 200 # Workaround until https://github.com/obi1kenobi/cargo-semver-check/issues/146 is shipped.
with:
crate: ${{ matrix.crate }}
crate: env.CRATE

- name: Enforce no dependency on meta crate
run: |
cargo metadata --format-version=1 --no-deps | \
jq -e -r '.packages[] | select(.name == "${{ matrix.crate }}") | .dependencies | all(.name != "libp2p")'
jq -e -r '.packages[] | select(.name == "'"$CRATE"'") | .dependencies | all(.name != "libp2p")'
- uses: taiki-e/cache-cargo-install-action@7dd0cff2732612ac642812bcec4ada5a279239ed # v1
with:
tool: tomlq

- name: Enforce version in `workspace.dependencies` matches latest version
if: matrix.crate != 'libp2p'
if: env.CRATE != 'libp2p'
run: |
PACKAGE_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -e -r '.packages[] | select(.name == "${{ matrix.crate }}") | .version')
SPECIFIED_VERSION=$(tomlq 'workspace.dependencies.${{ matrix.crate }}.version' --file ./Cargo.toml)
PACKAGE_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -e -r '.packages[] | select(.name == "'"$CRATE"'") | .version')
SPECIFIED_VERSION=$(tomlq "workspace.dependencies.$CRATE.version" --file ./Cargo.toml)
echo "Package version: $PACKAGE_VERSION";
echo "Specified version: $SPECIFIED_VERSION";
Expand Down
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
- Raise MSRV to 1.65.
See [PR 3715].

- Remove deprecated symbols related to upgrades.
See [PR 3867].

[PR 3715]: https://github.com/libp2p/rust-libp2p/pull/3715
[PR 3867]: https://github.com/libp2p/rust-libp2p/pull/3867

## 0.39.2

Expand Down
67 changes: 0 additions & 67 deletions core/src/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,13 @@ mod apply;
mod denied;
mod either;
mod error;
mod from_fn;
mod map;
mod optional;
mod pending;
mod ready;
mod select;
mod transfer;

use futures::future::Future;

#[allow(deprecated)]
pub use self::from_fn::{from_fn, FromFnUpgrade};
pub use self::{
apply::{apply, apply_inbound, apply_outbound, InboundUpgradeApply, OutboundUpgradeApply},
denied::DeniedUpgrade,
Expand All @@ -83,11 +78,7 @@ pub use self::{
transfer::{read_length_prefixed, read_varint, write_length_prefixed, write_varint},
};
pub use crate::Negotiated;
#[allow(deprecated)]
pub use map::{MapInboundUpgrade, MapInboundUpgradeErr, MapOutboundUpgrade, MapOutboundUpgradeErr};
pub use multistream_select::{NegotiatedComplete, NegotiationError, ProtocolError, Version};
#[allow(deprecated)]
pub use optional::OptionalUpgrade;

/// Types serving as protocol names.
///
Expand Down Expand Up @@ -164,35 +155,6 @@ pub trait InboundUpgrade<C>: UpgradeInfo {
fn upgrade_inbound(self, socket: C, info: Self::Info) -> Self::Future;
}

/// Extension trait for `InboundUpgrade`. Automatically implemented on all types that implement
/// `InboundUpgrade`.
#[deprecated(
note = "Will be removed without replacement because it is not used within rust-libp2p."
)]
#[allow(deprecated)]
pub trait InboundUpgradeExt<C>: InboundUpgrade<C> {
/// Returns a new object that wraps around `Self` and applies a closure to the `Output`.
fn map_inbound<F, T>(self, f: F) -> MapInboundUpgrade<Self, F>
where
Self: Sized,
F: FnOnce(Self::Output) -> T,
{
MapInboundUpgrade::new(self, f)
}

/// Returns a new object that wraps around `Self` and applies a closure to the `Error`.
fn map_inbound_err<F, T>(self, f: F) -> MapInboundUpgradeErr<Self, F>
where
Self: Sized,
F: FnOnce(Self::Error) -> T,
{
MapInboundUpgradeErr::new(self, f)
}
}

#[allow(deprecated)]
impl<C, U: InboundUpgrade<C>> InboundUpgradeExt<C> for U {}

/// Possible upgrade on an outbound connection or substream.
pub trait OutboundUpgrade<C>: UpgradeInfo {
/// Output after the upgrade has been successfully negotiated and the handshake performed.
Expand All @@ -208,32 +170,3 @@ pub trait OutboundUpgrade<C>: UpgradeInfo {
/// The `info` is the identifier of the protocol, as produced by `protocol_info`.
fn upgrade_outbound(self, socket: C, info: Self::Info) -> Self::Future;
}

/// Extention trait for `OutboundUpgrade`. Automatically implemented on all types that implement
/// `OutboundUpgrade`.
#[deprecated(
note = "Will be removed without replacement because it is not used within rust-libp2p."
)]
#[allow(deprecated)]
pub trait OutboundUpgradeExt<C>: OutboundUpgrade<C> {
/// Returns a new object that wraps around `Self` and applies a closure to the `Output`.
fn map_outbound<F, T>(self, f: F) -> MapOutboundUpgrade<Self, F>
where
Self: Sized,
F: FnOnce(Self::Output) -> T,
{
MapOutboundUpgrade::new(self, f)
}

/// Returns a new object that wraps around `Self` and applies a closure to the `Error`.
fn map_outbound_err<F, T>(self, f: F) -> MapOutboundUpgradeErr<Self, F>
where
Self: Sized,
F: FnOnce(Self::Error) -> T,
{
MapOutboundUpgradeErr::new(self, f)
}
}

#[allow(deprecated)]
impl<C, U: OutboundUpgrade<C>> OutboundUpgradeExt<C> for U {}

0 comments on commit 9158f48

Please sign in to comment.