aboutsummaryrefslogtreecommitdiff
path: root/src/util.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-07-21 17:34:53 +0200
committerAlex Auvolat <alex@adnab.me>2022-07-21 17:37:52 +0200
commitf35fa7d18d9e0f51bed311355ec1310b1d311ab3 (patch)
treeb42e093f1de42e3d537ef7d55daf9d89b98a10a9 /src/util.rs
parentcdff8ae1beab44a22d0eb0eb00c624e49971b6ca (diff)
downloadnetapp-f35fa7d18d9e0f51bed311355ec1310b1d311ab3.tar.gz
netapp-f35fa7d18d9e0f51bed311355ec1310b1d311ab3.zip
Move things around
Diffstat (limited to 'src/util.rs')
-rw-r--r--src/util.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/util.rs b/src/util.rs
index 186678d..6fbafe6 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -1,17 +1,15 @@
-use crate::endpoint::SerializeMessage;
-
use std::net::SocketAddr;
use std::net::ToSocketAddrs;
use std::pin::Pin;
-use futures::Stream;
-
use log::info;
-
use serde::Serialize;
+use futures::Stream;
use tokio::sync::watch;
+use crate::message::SerializeMessage;
+
/// A node's identifier, which is also its public cryptographic key
pub type NodeID = sodiumoxide::crypto::sign::ed25519::PublicKey;
/// A node's secret key
@@ -27,7 +25,7 @@ pub type NetworkKey = sodiumoxide::crypto::auth::Key;
///
/// Error code 255 means the stream was cut before its end. Other codes have no predefined
/// meaning, it's up to your application to define their semantic.
-pub type AssociatedStream = Pin<Box<dyn Stream<Item = Packet> + Send>>;
+pub type ByteStream = Pin<Box<dyn Stream<Item = Packet> + Send>>;
pub type Packet = Result<Vec<u8>, u8>;
@@ -38,7 +36,7 @@ pub type Packet = Result<Vec<u8>, u8>;
/// This is used internally by the netapp communication protocol.
pub fn rmp_to_vec_all_named<T>(
val: &T,
-) -> Result<(Vec<u8>, Option<AssociatedStream>), rmp_serde::encode::Error>
+) -> Result<(Vec<u8>, Option<ByteStream>), rmp_serde::encode::Error>
where
T: SerializeMessage + ?Sized,
{