Move legacy_proto to protocol (#4296)

* Move legacy_proto to protocol

* Edition 2018ize legacy_proto

* Some basic documentation
This commit is contained in:
Pierre Krieger
2019-12-05 14:02:48 +01:00
committed by Gavin Wood
parent e126ca9b2c
commit 2231c06294
7 changed files with 13 additions and 6 deletions
-1
View File
@@ -170,7 +170,6 @@
mod behaviour;
mod chain;
mod legacy_proto;
mod debug_info;
mod discovery;
mod on_demand_layer;
+3 -1
View File
@@ -15,7 +15,7 @@
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use crate::{DiscoveryNetBehaviour, config::ProtocolId};
use crate::legacy_proto::{LegacyProto, LegacyProtoOut};
use legacy_proto::{LegacyProto, LegacyProtoOut};
use crate::utils::interval;
use bytes::BytesMut;
use futures::prelude::*;
@@ -55,7 +55,9 @@ use client_api::{FetchChecker, ChangesProof, StorageProof};
use crate::error;
use util::LruHashSet;
mod legacy_proto;
mod util;
pub mod consensus_gossip;
pub mod message;
pub mod event;
@@ -14,6 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
//! Implementation of libp2p's `NetworkBehaviour` trait that opens a single substream with the
//! remote and then allows any communication with them.
//!
//! The `Protocol` struct uses `LegacyProto` in order to open substreams with the rest of the
//! network, then performs the Substrate protocol handling on top.
pub use self::behaviour::{LegacyProto, LegacyProtoOut};
mod behaviour;
@@ -15,8 +15,8 @@
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use crate::{DiscoveryNetBehaviour, config::ProtocolId};
use crate::legacy_proto::handler::{CustomProtoHandlerProto, CustomProtoHandlerOut, CustomProtoHandlerIn};
use crate::legacy_proto::upgrade::RegisteredProtocol;
use crate::protocol::legacy_proto::handler::{CustomProtoHandlerProto, CustomProtoHandlerOut, CustomProtoHandlerIn};
use crate::protocol::legacy_proto::upgrade::RegisteredProtocol;
use bytes::BytesMut;
use fnv::FnvHashMap;
use futures::prelude::*;
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use crate::legacy_proto::upgrade::{RegisteredProtocol, RegisteredProtocolEvent, RegisteredProtocolSubstream};
use super::upgrade::{RegisteredProtocol, RegisteredProtocolEvent, RegisteredProtocolSubstream};
use bytes::BytesMut;
use futures::prelude::*;
use futures03::{compat::Compat, TryFutureExt as _};
@@ -26,7 +26,7 @@ use libp2p::{PeerId, Multiaddr, Transport};
use rand::seq::SliceRandom;
use std::{io, time::Duration, time::Instant};
use crate::message::Message;
use crate::legacy_proto::{LegacyProto, LegacyProtoOut};
use crate::protocol::legacy_proto::{LegacyProto, LegacyProtoOut};
use test_client::runtime::Block;
/// Builds two nodes that have each other as bootstrap nodes.