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

protocols/kad: Derive Clone for KademliaEvent #2411

Merged
merged 5 commits into from
Dec 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions protocols/kad/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

- Migrate to Rust edition 2021 (see [PR 2339]).

- Derive `Clone` for `KademliaEvent` (see [PR 2411])

[PR 2339]: https://github.com/libp2p/rust-libp2p/pull/2339
[PR 2411]: https://github.com/libp2p/rust-libp2p/pull/2411

# 0.33.0 [2021-11-16]

Expand Down
10 changes: 5 additions & 5 deletions protocols/kad/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2382,7 +2382,7 @@ pub struct PeerRecord {
/// The events produced by the `Kademlia` behaviour.
///
/// See [`NetworkBehaviour::poll`].
#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum KademliaEvent {
/// An inbound request has been received and handled.
//
Expand Down Expand Up @@ -2453,7 +2453,7 @@ pub enum KademliaEvent {
}

/// Information about a received and handled inbound request.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum InboundRequest {
/// Request for the list of nodes whose IDs are the closest to `key`.
FindNode { num_closer_peers: usize },
Expand Down Expand Up @@ -2486,7 +2486,7 @@ pub enum InboundRequest {
}

/// The results of Kademlia queries.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum QueryResult {
/// The result of [`Kademlia::bootstrap`].
Bootstrap(BootstrapResult),
Expand Down Expand Up @@ -2583,7 +2583,7 @@ pub struct PutRecordOk {
}

/// The error result of [`Kademlia::put_record`].
#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum PutRecordError {
QuorumFailed {
key: record::Key,
Expand Down Expand Up @@ -2718,7 +2718,7 @@ pub struct AddProviderOk {
}

/// The possible errors when publishing a provider record.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum AddProviderError {
/// The query timed out.
Timeout { key: record::Key },
Expand Down
2 changes: 1 addition & 1 deletion protocols/kad/src/record/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use std::borrow::Cow;
pub type Result<T> = std::result::Result<T, Error>;

/// The possible errors of a `RecordStore` operation.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum Error {
/// The store is at capacity w.r.t. the total number of stored records.
MaxRecords,
Expand Down