Skip to content

Commit 5927545

Browse files
committed
Pulled out message types to swimos_messages.
1 parent 1bde9d3 commit 5927545

File tree

36 files changed

+254
-224
lines changed

36 files changed

+254
-224
lines changed

api/swimos_api/src/error/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,8 @@ pub enum DownlinkFailureReason {
8383
UnresolvableLocal(RelativeAddress<Text>),
8484
#[error("Connection to the remote host failed: {0}")]
8585
ConnectionFailed(Arc<std::io::Error>),
86-
#[error("Failed to negotiate a TLS connection: {error}")]
87-
TlsConnectionFailed {
88-
error: Arc<dyn std::error::Error + Send + Sync>,
89-
recoverable: bool,
90-
},
86+
#[error("Failed to negotiate a TLS connection: {message}")]
87+
TlsConnectionFailed { message: String, recoverable: bool },
9188
#[error("Could not negotiate a websocket connection: {0}")]
9289
WebsocketNegotiationFailed(String),
9390
#[error("The remote client stopped while the downlink was starting.")]

client/fixture/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ edition = "2021"
66
[dependencies]
77
swimos_runtime = { path = "../../runtime/swimos_runtime" }
88
swimos_remote = { path = "../../runtime/swimos_remote" }
9+
swimos_messages = { path = "../../runtime/swimos_messages" }
910
swimos_api = { path = "../../api/swimos_api" }
1011
ratchet = { features = ["deflate", "split"], workspace = true }
1112
swimos_recon = { path = "../../api/formats/swimos_recon" }

client/fixture/src/lib.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ use std::net::SocketAddr;
1414
use std::ops::DerefMut;
1515
use std::sync::Arc;
1616
use swimos_form::Form;
17+
use swimos_messages::remote_protocol::FindNode;
1718
use swimos_model::{Text, Value};
1819
use swimos_recon::parser::parse_recognize;
1920
use swimos_recon::print_recon;
2021
use swimos_remote::dns::{BoxDnsResolver, DnsResolver};
2122
use swimos_remote::net::{
22-
ClientConnections, ConnResult, ConnectionError, IoResult, Listener, ListenerError, Scheme,
23+
ClientConnections, ConnResult, ConnectionError, Listener, ListenerError, Scheme,
2324
};
2425
use swimos_remote::websocket::{RatchetError, WebsocketClient, WebsocketServer, WsOpenFuture};
25-
use swimos_remote::FindNode;
2626
use tokio::io::{AsyncRead, AsyncWrite, DuplexStream};
2727
use tokio::sync::mpsc;
2828
use tokio::sync::Mutex;
@@ -87,7 +87,11 @@ impl ClientConnections for MockClientConnections {
8787
Box::new(self.clone())
8888
}
8989

90-
fn lookup(&self, host: String, port: u16) -> BoxFuture<'static, IoResult<Vec<SocketAddr>>> {
90+
fn lookup(
91+
&self,
92+
host: String,
93+
port: u16,
94+
) -> BoxFuture<'static, std::io::Result<Vec<SocketAddr>>> {
9195
self.resolve(host, port).boxed()
9296
}
9397
}

client/runtime/src/models.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use fnv::FnvHashMap;
1616
use std::fmt::{Display, Formatter};
1717
use std::future::Future;
1818
use swimos_api::{address::RelativeAddress, agent::DownlinkKind};
19+
use swimos_messages::remote_protocol::AttachClient;
1920
use swimos_model::Text;
20-
use swimos_remote::AttachClient;
2121
use swimos_runtime::downlink::failure::{
2222
AlwaysAbortStrategy, AlwaysIgnoreStrategy, ReportStrategy,
2323
};

client/runtime/src/pending.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ use std::pin::Pin;
2424
use std::task::{Context, Poll};
2525
use swimos_api::address::RelativeAddress;
2626
use swimos_client_api::DownlinkConfig;
27+
use swimos_messages::remote_protocol::AttachClient;
2728
use swimos_model::Text;
28-
use swimos_remote::{net::Scheme, AttachClient};
29+
use swimos_remote::net::Scheme;
2930
use swimos_runtime::downlink::{DownlinkOptions, DownlinkRuntimeConfig};
3031
use tokio::sync::mpsc;
3132

client/runtime/src/runtime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use std::fmt::{Debug, Formatter};
2424
use std::net::SocketAddr;
2525
use std::num::NonZeroUsize;
2626
use std::sync::Arc;
27+
use swimos_messages::remote_protocol::AttachClient;
2728
use swimos_remote::{
2829
net::{Scheme, SchemeHostPort},
2930
websocket::WebsocketClient,
@@ -41,7 +42,6 @@ use swimos_api::{address::Address, agent::DownlinkKind, error::DownlinkFailureRe
4142
use swimos_client_api::{Downlink, DownlinkConfig};
4243
use swimos_model::Text;
4344
use swimos_remote::net::ClientConnections;
44-
use swimos_remote::AttachClient;
4545
use swimos_runtime::downlink::{AttachAction, DownlinkOptions, DownlinkRuntimeConfig};
4646
use swimos_utilities::byte_channel::{byte_channel, ByteReader, ByteWriter};
4747
use swimos_utilities::trigger;

client/runtime/src/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use ratchet::{
2727
Message, NegotiatedExtension, NoExt, NoExtProvider, Role, WebSocket, WebSocketConfig,
2828
};
2929
use swimos_agent_protocol::MapMessage;
30+
use swimos_messages::remote_protocol::AttachClient;
3031
use swimos_remote::net::{Scheme, SchemeHostPort};
3132
use tokio::io::{duplex, AsyncWriteExt};
3233
use tokio::spawn;
@@ -55,7 +56,6 @@ use swimos_form::Form;
5556
use swimos_messages::protocol::{RawRequestMessageEncoder, RequestMessage};
5657
use swimos_model::Text;
5758
use swimos_remote::websocket::RatchetError;
58-
use swimos_remote::AttachClient;
5959
use swimos_runtime::downlink::{DownlinkOptions, DownlinkRuntimeConfig};
6060
use swimos_utilities::byte_channel::{byte_channel, ByteReader, ByteWriter};
6161
use swimos_utilities::trigger::{promise, trigger};

client/runtime/src/transport.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ use std::io;
2424
use std::net::SocketAddr;
2525
use std::num::NonZeroUsize;
2626
use std::time::Duration;
27+
use swimos_messages::remote_protocol::AttachClient;
2728
use swimos_remote::net::{ClientConnections, Scheme, SchemeHostPort};
2829
use swimos_remote::websocket::WebsocketClient;
29-
use swimos_remote::{AttachClient, RemoteTask};
30+
use swimos_remote::RemoteTask;
3031
use swimos_utilities::trigger;
3132
use tokio::select;
3233
use tokio::sync::{mpsc, oneshot};

client/swimos_client/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ use swimos_downlink::{
3838
};
3939
use swimos_form::Form;
4040
use swimos_remote::dns::Resolver;
41-
use swimos_remote::net::plain::TokioPlainTextNetworking;
4241
use swimos_remote::net::ClientConnections;
42+
use swimos_remote::plain::TokioPlainTextNetworking;
4343
use swimos_runtime::downlink::{DownlinkOptions, DownlinkRuntimeConfig};
4444
#[cfg(feature = "tls")]
4545
use swimos_tls::{ClientConfig as TlsConfig, RustlsClientNetworking, TlsError};

runtime/swimos_messages/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2021"
77
[dependencies]
88
bytes = { workspace = true }
99
futures = { workspace = true }
10-
tokio = { workspace = true }
10+
tokio = { workspace = true, features = ["sync"]}
1111
tokio-util = { workspace = true, features = ["codec"] }
1212
swimos_model = { path = "../../api/swimos_model" }
1313
swimos_api = { path = "../../api/swimos_api" }

0 commit comments

Comments
 (0)