first pass of merging in warp (doesn't build)
This commit is contained in:
@@ -18,7 +18,7 @@ rand.workspace = true
|
||||
serde.workspace = true
|
||||
thiserror.workspace = true
|
||||
uuid.workspace = true
|
||||
galaxyui.workspace = true
|
||||
galaxyui_core.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
parking_lot.workspace = true
|
||||
|
||||
+14
-12
@@ -1,17 +1,19 @@
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use futures::{channel::oneshot, future::FutureExt, io::BufReader, AsyncRead, AsyncWrite};
|
||||
use galaxyui::r#async::executor::Background;
|
||||
use futures::channel::oneshot;
|
||||
use futures::future::FutureExt;
|
||||
use futures::io::BufReader;
|
||||
use futures::{AsyncRead, AsyncWrite};
|
||||
use galaxyui_core::r#async::executor::Background;
|
||||
|
||||
use crate::{platform::client::connect_client, protocol::Request};
|
||||
|
||||
use super::{
|
||||
protocol::{
|
||||
receive_message, send_message, ConnectionAddress, ProtocolError, RequestId, Response,
|
||||
},
|
||||
service::service_id,
|
||||
Service,
|
||||
use super::protocol::{
|
||||
receive_message, send_message, ConnectionAddress, ProtocolError, RequestId, Response,
|
||||
};
|
||||
use super::service::service_id;
|
||||
use super::Service;
|
||||
use crate::platform::client::connect_client;
|
||||
use crate::protocol::Request;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum InitializationError {
|
||||
@@ -125,7 +127,7 @@ impl Client {
|
||||
let request = Request::new(service_id::<S>(), request_bytes);
|
||||
|
||||
// Create a channel for the response result. The sending end is sent to the outbound
|
||||
// message task. The outbound meessage task uses it to relay any error that might occur
|
||||
// message task. The outbound message task uses it to relay any error that might occur
|
||||
// when sending the message. If the message is sent successfully, the sending end is
|
||||
// forwarded to the _inbound_ message task, which will eventually use it to relay the
|
||||
// response bytes.
|
||||
|
||||
@@ -6,9 +6,10 @@ use futures::{AsyncRead, AsyncWrite};
|
||||
use crate::ConnectionAddress;
|
||||
|
||||
pub(crate) mod client {
|
||||
use interprocess::local_socket::tokio::LocalSocketStream;
|
||||
|
||||
use super::*;
|
||||
use crate::client::{ClientError, InitializationError, Result};
|
||||
use interprocess::local_socket::tokio::LocalSocketStream;
|
||||
|
||||
/// Returns a tuple containing structs for reading and writing to a local socket, which is the
|
||||
/// underlying IPC transport for native (non-wasm) platforms.
|
||||
@@ -24,9 +25,10 @@ pub(crate) mod client {
|
||||
}
|
||||
|
||||
pub(crate) mod server {
|
||||
use interprocess::local_socket::tokio::{LocalSocketListener, LocalSocketStream};
|
||||
|
||||
use super::*;
|
||||
use crate::server::{InitializationError, Result, ServerError};
|
||||
use interprocess::local_socket::tokio::{LocalSocketListener, LocalSocketStream};
|
||||
|
||||
pub struct ConnectionImpl {
|
||||
stream: LocalSocketStream,
|
||||
@@ -44,7 +46,7 @@ pub(crate) mod server {
|
||||
|
||||
impl ConnectionListenerImpl {
|
||||
pub fn new(connection_address: ConnectionAddress) -> Result<Self> {
|
||||
let listener = galaxyui::r#async::block_on(
|
||||
let listener = galaxyui_core::r#async::block_on(
|
||||
async move { LocalSocketListener::bind(connection_address.to_string()) }.compat(),
|
||||
)
|
||||
.map_err(|e| ServerError::Initialization(InitializationError::Io(e)))?;
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
use std::{
|
||||
fmt::{Debug, Display},
|
||||
marker::Unpin,
|
||||
};
|
||||
use std::fmt::{Debug, Display};
|
||||
use std::marker::Unpin;
|
||||
|
||||
use futures::{
|
||||
io::{AsyncReadExt, AsyncWriteExt, BufReader},
|
||||
AsyncRead, AsyncWrite,
|
||||
};
|
||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||
use futures::io::{AsyncReadExt, AsyncWriteExt, BufReader};
|
||||
use futures::{AsyncRead, AsyncWrite};
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
use super::service::ServiceId;
|
||||
|
||||
+10
-13
@@ -1,21 +1,18 @@
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_channel::{Receiver, Sender};
|
||||
use async_trait::async_trait;
|
||||
use futures::{io::BufReader, AsyncRead, AsyncWrite};
|
||||
use galaxyui::r#async::executor::{Background, BackgroundTask};
|
||||
use futures::io::BufReader;
|
||||
use futures::{AsyncRead, AsyncWrite};
|
||||
use galaxyui_core::r#async::executor::{Background, BackgroundTask};
|
||||
|
||||
use crate::{
|
||||
platform::server::{ConnectionImpl, ConnectionListenerImpl},
|
||||
service::ServiceImpl,
|
||||
};
|
||||
|
||||
use super::{
|
||||
protocol::{
|
||||
receive_message, send_message, ConnectionAddress, ProtocolError, Request, Response,
|
||||
},
|
||||
service::{service_id, Service, ServiceId},
|
||||
use super::protocol::{
|
||||
receive_message, send_message, ConnectionAddress, ProtocolError, Request, Response,
|
||||
};
|
||||
use super::service::{service_id, Service, ServiceId};
|
||||
use crate::platform::server::{ConnectionImpl, ConnectionListenerImpl};
|
||||
use crate::service::ServiceImpl;
|
||||
|
||||
/// Helper trait to enable storing a polymorphic collection of `ServiceImpl` implementions in
|
||||
/// `Server`.
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
use std::{marker::PhantomData, sync::Arc};
|
||||
use std::marker::PhantomData;
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
|
||||
use crate::{protocol::Message, Client, ClientError};
|
||||
use crate::protocol::Message;
|
||||
use crate::{Client, ClientError};
|
||||
|
||||
pub(crate) type ServiceId = String;
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@ use async_trait::async_trait;
|
||||
use itertools::Itertools;
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use crate::{service::service_id, ClientError, Service, ServiceCaller};
|
||||
use crate::service::service_id;
|
||||
use crate::{ClientError, Service, ServiceCaller};
|
||||
|
||||
// Use a `Mutex` so we can satisfy the immutable `&self` in the implementation of `ServiceCaller`.
|
||||
type ExpectationsMap<T, U> = Mutex<HashMap<T, Result<U, ClientError>>>;
|
||||
|
||||
@@ -6,9 +6,8 @@ use futures::{AsyncRead, AsyncWrite};
|
||||
use crate::ConnectionAddress;
|
||||
|
||||
pub(crate) mod client {
|
||||
use crate::client::{ClientError, InitializationError, Result};
|
||||
|
||||
use super::*;
|
||||
use crate::client::{ClientError, InitializationError, Result};
|
||||
|
||||
pub async fn connect_client(
|
||||
_connection_address: ConnectionAddress,
|
||||
@@ -20,7 +19,6 @@ pub(crate) mod client {
|
||||
}
|
||||
|
||||
pub(crate) mod server {
|
||||
use super::*;
|
||||
use crate::server::{InitializationError, Result, ServerError};
|
||||
|
||||
/// "Fake" implementation. Note that because a `ConnectionListenerImpl` can't be instantiated,
|
||||
|
||||
Reference in New Issue
Block a user