Skip to content
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
6 changes: 3 additions & 3 deletions src/eth.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::*;
use crate::{Address as uqAddress, Request as uqRequest};
use crate::{Address as KiAddress, Request as KiRequest};
use alloy_rpc_types::Log;
pub use ethers_core::types::{
Address as EthAddress, BlockNumber, Filter, FilterBlockOption, Topic, ValueOrArray, H256, U64,
Expand Down Expand Up @@ -44,15 +44,15 @@ pub enum EthSubEvent {

#[derive(Debug)]
pub struct SubscribeLogsRequest {
pub request: uqRequest,
pub request: KiRequest,
pub id: u64,
pub filter: Filter,
}

impl SubscribeLogsRequest {
/// Start building a new `SubscribeLogsRequest`.
pub fn new(id: u64) -> Self {
let request = uqRequest::new().target(uqAddress::new(
let request = KiRequest::new().target(KiAddress::new(
"our",
ProcessId::new(Some("eth"), "distro", "sys"),
));
Expand Down
42 changes: 21 additions & 21 deletions src/http.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::vfs::{FileType, VfsAction, VfsRequest, VfsResponse};
use crate::{
get_blob, Address, LazyLoadBlob as uqBlob, Message, ProcessId, Request as uqRequest,
Response as uqResponse, SendError,
get_blob, Address, LazyLoadBlob as KiBlob, Message, ProcessId, Request as KiRequest,
Response as KiResponse, SendError,
};
pub use http::*;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -321,7 +321,7 @@ pub fn bind_http_path<T>(path: T, authenticated: bool, local_only: bool) -> anyh
where
T: Into<String>,
{
let res = uqRequest::new()
let res = KiRequest::new()
.target(("our", "http_server", "distro", "sys"))
.body(serde_json::to_vec(&HttpServerAction::Bind {
path: path.into(),
Expand Down Expand Up @@ -351,7 +351,7 @@ pub fn bind_http_static_path<T>(
where
T: Into<String>,
{
let res = uqRequest::new()
let res = KiRequest::new()
.target(("our", "http_server", "distro", "sys"))
.body(serde_json::to_vec(&HttpServerAction::Bind {
path: path.into(),
Expand Down Expand Up @@ -379,7 +379,7 @@ pub fn bind_ws_path<T>(path: T, authenticated: bool, encrypted: bool) -> anyhow:
where
T: Into<String>,
{
let res = uqRequest::new()
let res = KiRequest::new()
.target(("our", "http_server", "distro", "sys"))
.body(serde_json::to_vec(&HttpServerAction::WebSocketBind {
path: path.into(),
Expand All @@ -402,7 +402,7 @@ pub fn send_response(
headers: Option<HashMap<String, String>>,
body: Vec<u8>,
) -> anyhow::Result<()> {
uqResponse::new()
KiResponse::new()
.body(serde_json::to_vec(&HttpResponse {
status: status.as_u16(),
headers: headers.unwrap_or_default(),
Expand All @@ -420,7 +420,7 @@ pub fn send_request(
timeout: Option<u64>,
body: Vec<u8>,
) -> anyhow::Result<()> {
let req = uqRequest::new()
let req = KiRequest::new()
.target(("our", "http_client", "distro", "sys"))
.body(serde_json::to_vec(&HttpClientAction::Http(
OutgoingHttpRequest {
Expand All @@ -446,7 +446,7 @@ pub fn send_request_await_response(
timeout: u64,
body: Vec<u8>,
) -> std::result::Result<HttpClientResponse, HttpClientError> {
let res = uqRequest::new()
let res = KiRequest::new()
.target(("our", "http_client", "distro", "sys"))
.body(
serde_json::to_vec(&HttpClientAction::Http(OutgoingHttpRequest {
Expand Down Expand Up @@ -492,7 +492,7 @@ pub fn get_mime_type(filename: &str) -> String {

// Serve index.html
pub fn serve_index_html(our: &Address, directory: &str) -> anyhow::Result<(), anyhow::Error> {
let _ = uqRequest::new()
let _ = KiRequest::new()
.target("our@vfs:distro:sys".parse::<Address>()?)
.body(serde_json::to_vec(&VfsRequest {
path: format!("/{}/pkg/{}/index.html", our.package_id(), directory),
Expand Down Expand Up @@ -528,7 +528,7 @@ pub fn serve_ui(our: &Address, directory: &str) -> anyhow::Result<(), anyhow::Er
queue.push_back(initial_path.clone());

while let Some(path) = queue.pop_front() {
let directory_response = uqRequest::new()
let directory_response = KiRequest::new()
.target("our@vfs:distro:sys".parse::<Address>()?)
.body(serde_json::to_vec(&VfsRequest {
path,
Expand All @@ -555,7 +555,7 @@ pub fn serve_ui(our: &Address, directory: &str) -> anyhow::Result<(), anyhow::Er
continue;
}

let _ = uqRequest::new()
let _ = KiRequest::new()
.target("our@vfs:distro:sys".parse::<Address>()?)
.body(serde_json::to_vec(&VfsRequest {
path: entry.path.clone(),
Expand Down Expand Up @@ -610,7 +610,7 @@ pub fn handle_ui_asset_request(

let target_path = format!("{}/{}", directory, after_process.trim_start_matches('/'));

let _ = uqRequest::new()
let _ = KiRequest::new()
.target("our@vfs:distro:sys".parse::<Address>()?)
.body(serde_json::to_vec(&VfsRequest {
path: format!("{}/pkg/{}", our.package_id(), target_path),
Expand All @@ -622,7 +622,7 @@ pub fn handle_ui_asset_request(
let content_type = get_mime_type(path);
headers.insert("Content-Type".to_string(), content_type);

uqResponse::new()
KiResponse::new()
.body(
serde_json::json!(HttpResponse {
status: 200,
Expand All @@ -642,9 +642,9 @@ pub fn send_ws_push(
node: String,
channel_id: u32,
message_type: WsMessageType,
blob: uqBlob,
blob: KiBlob,
) -> anyhow::Result<()> {
uqRequest::new()
KiRequest::new()
.target(Address::new(
node,
"http_server:distro:sys".parse::<ProcessId>().unwrap(),
Expand All @@ -670,7 +670,7 @@ pub fn open_ws_connection(
headers: Option<HashMap<String, String>>,
channel_id: u32,
) -> anyhow::Result<()> {
uqRequest::new()
KiRequest::new()
.target(Address::new(
node,
ProcessId::from_str("http_client:distro:sys").unwrap(),
Expand All @@ -696,7 +696,7 @@ pub fn open_ws_connection_and_await(
headers: Option<HashMap<String, String>>,
channel_id: u32,
) -> std::result::Result<std::result::Result<Message, SendError>, anyhow::Error> {
uqRequest::new()
KiRequest::new()
.target(Address::new(
node,
ProcessId::from_str("http_client:distro:sys").unwrap(),
Expand All @@ -718,9 +718,9 @@ pub fn send_ws_client_push(
node: String,
channel_id: u32,
message_type: WsMessageType,
blob: uqBlob,
blob: KiBlob,
) -> std::result::Result<(), anyhow::Error> {
uqRequest::new()
KiRequest::new()
.target(Address::new(
node,
ProcessId::from_str("http_client:distro:sys").unwrap(),
Expand All @@ -739,7 +739,7 @@ pub fn send_ws_client_push(
}

pub fn close_ws_connection(node: String, channel_id: u32) -> anyhow::Result<()> {
uqRequest::new()
KiRequest::new()
.target(Address::new(
node,
ProcessId::from_str("http_client:distro:sys").unwrap(),
Expand All @@ -759,7 +759,7 @@ pub fn close_ws_connection_and_await(
node: String,
channel_id: u32,
) -> std::result::Result<std::result::Result<Message, SendError>, anyhow::Error> {
uqRequest::new()
KiRequest::new()
.target(Address::new(
node,
ProcessId::from_str("http_client:distro:sys").unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion src/vfs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub use file::*;
#[derive(Debug, Serialize, Deserialize)]
pub struct VfsRequest {
/// path is always prepended by package_id, the capabilities of the topmost folder are checked
/// "/your_package:publisher.uq/drive_folder/another_folder_or_file"
/// "/your_package:publisher.os/drive_folder/another_folder_or_file"
pub path: String,
pub action: VfsAction,
}
Expand Down