mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-12-23 08:32:23 +03:00
delete non-symlinked process_libs
This commit is contained in:
parent
2352a068f8
commit
82055bacf5
@ -1,105 +0,0 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::bindings::component::uq_process::types::*;
|
||||
use super::bindings::{Address, get_payload, Payload, SendError, send_request};
|
||||
|
||||
impl PartialEq for ProcessId {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(ProcessId::Id(i1), ProcessId::Id(i2)) => i1 == i2,
|
||||
(ProcessId::Name(s1), ProcessId::Name(s2)) => s1 == s2,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl PartialEq<&str> for ProcessId {
|
||||
fn eq(&self, other: &&str) -> bool {
|
||||
match self {
|
||||
ProcessId::Id(_) => false,
|
||||
ProcessId::Name(s) => s == other,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl PartialEq<u64> for ProcessId {
|
||||
fn eq(&self, other: &u64) -> bool {
|
||||
match self {
|
||||
ProcessId::Id(i) => i == other,
|
||||
ProcessId::Name(_) => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn send_and_await_response(
|
||||
target: &Address,
|
||||
inherit: bool,
|
||||
ipc: Option<Json>,
|
||||
metadata: Option<Json>,
|
||||
payload: Option<&Payload>,
|
||||
timeout: u64,
|
||||
) -> Result<(Address, Message), SendError> {
|
||||
super::bindings::send_and_await_response(
|
||||
target,
|
||||
&Request {
|
||||
inherit,
|
||||
expects_response: Some(timeout),
|
||||
ipc,
|
||||
metadata,
|
||||
},
|
||||
payload,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_state(our: String) -> Option<Payload> {
|
||||
match super::bindings::get_state() {
|
||||
Some(bytes) => Some(Payload {
|
||||
mime: None,
|
||||
bytes,
|
||||
}),
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_state(our: String, bytes: Vec<u8>) {
|
||||
super::bindings::set_state(&bytes);
|
||||
}
|
||||
|
||||
pub fn await_set_state<T>(our: String, state: &T)
|
||||
where
|
||||
T: serde::Serialize,
|
||||
{
|
||||
super::bindings::set_state(&bincode::serialize(state).unwrap());
|
||||
}
|
||||
|
||||
pub fn parse_message_ipc<T>(json_string: Option<String>) -> anyhow::Result<T>
|
||||
where
|
||||
for<'a> T: serde::Deserialize<'a>,
|
||||
{
|
||||
let parsed: T = serde_json::from_str(
|
||||
json_string
|
||||
.ok_or(anyhow::anyhow!("json payload empty"))?
|
||||
.as_str(),
|
||||
)?;
|
||||
Ok(parsed)
|
||||
}
|
||||
|
||||
// move these to better place!
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub enum FsAction {
|
||||
Write,
|
||||
Replace(u128),
|
||||
Append(Option<u128>),
|
||||
Read(u128),
|
||||
ReadChunk(ReadChunkRequest),
|
||||
Delete(u128),
|
||||
Length(u128),
|
||||
// process state management
|
||||
GetState,
|
||||
SetState,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct ReadChunkRequest {
|
||||
pub file_uuid: u128,
|
||||
pub start: u64,
|
||||
pub length: u64,
|
||||
}
|
@ -1,142 +0,0 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::bindings::component::uq_process::types::*;
|
||||
use super::bindings::{get_payload, send_request, Address, Payload};
|
||||
|
||||
impl PartialEq for ProcessId {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(ProcessId::Id(i1), ProcessId::Id(i2)) => i1 == i2,
|
||||
(ProcessId::Name(s1), ProcessId::Name(s2)) => s1 == s2,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl PartialEq<&str> for ProcessId {
|
||||
fn eq(&self, other: &&str) -> bool {
|
||||
match self {
|
||||
ProcessId::Id(_) => false,
|
||||
ProcessId::Name(s) => s == other,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl PartialEq<u64> for ProcessId {
|
||||
fn eq(&self, other: &u64) -> bool {
|
||||
match self {
|
||||
ProcessId::Id(i) => i == other,
|
||||
ProcessId::Name(_) => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn send_and_await_response(
|
||||
target: &Address,
|
||||
inherit: bool,
|
||||
ipc: Option<Json>,
|
||||
metadata: Option<Json>,
|
||||
payload: Option<&Payload>,
|
||||
timeout: u64,
|
||||
) -> Result<(Address, Message), SendError> {
|
||||
super::bindings::send_and_await_response(
|
||||
target,
|
||||
&Request {
|
||||
inherit,
|
||||
expects_response: Some(timeout),
|
||||
ipc,
|
||||
metadata,
|
||||
},
|
||||
payload,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_state(our: String) -> Option<Payload> {
|
||||
let _ = send_and_await_response(
|
||||
&Address {
|
||||
node: our,
|
||||
process: ProcessId::Name("filesystem".to_string()),
|
||||
},
|
||||
false,
|
||||
Some(serde_json::to_string(&FsAction::GetState).unwrap()),
|
||||
None,
|
||||
None,
|
||||
5, // TODO evaluate timeout
|
||||
);
|
||||
get_payload()
|
||||
}
|
||||
|
||||
pub fn set_state(our: String, bytes: Vec<u8>) {
|
||||
send_request(
|
||||
&Address {
|
||||
node: our,
|
||||
process: ProcessId::Name("filesystem".to_string()),
|
||||
},
|
||||
&Request {
|
||||
inherit: false,
|
||||
expects_response: Some(5), // TODO evaluate timeout
|
||||
ipc: Some(serde_json::to_string(&FsAction::SetState).unwrap()),
|
||||
metadata: None,
|
||||
},
|
||||
None,
|
||||
Some(&Payload { mime: None, bytes }),
|
||||
);
|
||||
}
|
||||
|
||||
pub fn await_set_state<T>(our: String, state: &T)
|
||||
where
|
||||
T: serde::Serialize,
|
||||
{
|
||||
// Request/Response stays local -> no SendError
|
||||
let (_, response) = send_and_await_response(
|
||||
&Address {
|
||||
node: our,
|
||||
process: ProcessId::Name("filesystem".to_string()),
|
||||
},
|
||||
false,
|
||||
Some(serde_json::to_string(&FsAction::SetState).unwrap()),
|
||||
None,
|
||||
Some(&Payload {
|
||||
mime: None,
|
||||
bytes: bincode::serialize(state).unwrap(),
|
||||
}),
|
||||
5, // TODO evaluate timeout
|
||||
)
|
||||
.unwrap();
|
||||
match response {
|
||||
Message::Request(_) => panic!("got request from filesystem"),
|
||||
Message::Response((response, _context)) => return,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_message_ipc<T>(json_string: Option<String>) -> anyhow::Result<T>
|
||||
where
|
||||
for<'a> T: serde::Deserialize<'a>,
|
||||
{
|
||||
let parsed: T = serde_json::from_str(
|
||||
json_string
|
||||
.ok_or(anyhow::anyhow!("json payload empty"))?
|
||||
.as_str(),
|
||||
)?;
|
||||
Ok(parsed)
|
||||
}
|
||||
|
||||
// move these to better place!
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub enum FsAction {
|
||||
Write,
|
||||
Replace(u128),
|
||||
Append(Option<u128>),
|
||||
Read(u128),
|
||||
ReadChunk(ReadChunkRequest),
|
||||
Delete(u128),
|
||||
Length(u128),
|
||||
// process state management
|
||||
GetState,
|
||||
SetState,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct ReadChunkRequest {
|
||||
pub file_uuid: u128,
|
||||
pub start: u64,
|
||||
pub length: u64,
|
||||
}
|
@ -1,142 +0,0 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::bindings::component::uq_process::types::*;
|
||||
use super::bindings::{get_payload, send_request, Address, Payload};
|
||||
|
||||
impl PartialEq for ProcessId {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(ProcessId::Id(i1), ProcessId::Id(i2)) => i1 == i2,
|
||||
(ProcessId::Name(s1), ProcessId::Name(s2)) => s1 == s2,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl PartialEq<&str> for ProcessId {
|
||||
fn eq(&self, other: &&str) -> bool {
|
||||
match self {
|
||||
ProcessId::Id(_) => false,
|
||||
ProcessId::Name(s) => s == other,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl PartialEq<u64> for ProcessId {
|
||||
fn eq(&self, other: &u64) -> bool {
|
||||
match self {
|
||||
ProcessId::Id(i) => i == other,
|
||||
ProcessId::Name(_) => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn send_and_await_response(
|
||||
target: &Address,
|
||||
inherit: bool,
|
||||
ipc: Option<Json>,
|
||||
metadata: Option<Json>,
|
||||
payload: Option<&Payload>,
|
||||
timeout: u64,
|
||||
) -> Result<(Address, Message), SendError> {
|
||||
super::bindings::send_and_await_response(
|
||||
target,
|
||||
&Request {
|
||||
inherit,
|
||||
expects_response: Some(timeout),
|
||||
ipc,
|
||||
metadata,
|
||||
},
|
||||
payload,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_state(our: String) -> Option<Payload> {
|
||||
let _ = send_and_await_response(
|
||||
&Address {
|
||||
node: our,
|
||||
process: ProcessId::Name("filesystem".to_string()),
|
||||
},
|
||||
false,
|
||||
Some(serde_json::to_string(&FsAction::GetState).unwrap()),
|
||||
None,
|
||||
None,
|
||||
5, // TODO evaluate timeout
|
||||
);
|
||||
get_payload()
|
||||
}
|
||||
|
||||
pub fn set_state(our: String, bytes: Vec<u8>) {
|
||||
send_request(
|
||||
&Address {
|
||||
node: our,
|
||||
process: ProcessId::Name("filesystem".to_string()),
|
||||
},
|
||||
&Request {
|
||||
inherit: false,
|
||||
expects_response: Some(5), // TODO evaluate timeout
|
||||
ipc: Some(serde_json::to_string(&FsAction::SetState).unwrap()),
|
||||
metadata: None,
|
||||
},
|
||||
None,
|
||||
Some(&Payload { mime: None, bytes }),
|
||||
);
|
||||
}
|
||||
|
||||
pub fn await_set_state<T>(our: String, state: &T)
|
||||
where
|
||||
T: serde::Serialize,
|
||||
{
|
||||
// Request/Response stays local -> no SendError
|
||||
let (_, response) = send_and_await_response(
|
||||
&Address {
|
||||
node: our,
|
||||
process: ProcessId::Name("filesystem".to_string()),
|
||||
},
|
||||
false,
|
||||
Some(serde_json::to_string(&FsAction::SetState).unwrap()),
|
||||
None,
|
||||
Some(&Payload {
|
||||
mime: None,
|
||||
bytes: bincode::serialize(state).unwrap(),
|
||||
}),
|
||||
5, // TODO evaluate timeout
|
||||
)
|
||||
.unwrap();
|
||||
match response {
|
||||
Message::Request(_) => panic!("got request from filesystem"),
|
||||
Message::Response((response, _context)) => return,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_message_ipc<T>(json_string: Option<String>) -> anyhow::Result<T>
|
||||
where
|
||||
for<'a> T: serde::Deserialize<'a>,
|
||||
{
|
||||
let parsed: T = serde_json::from_str(
|
||||
json_string
|
||||
.ok_or(anyhow::anyhow!("json payload empty"))?
|
||||
.as_str(),
|
||||
)?;
|
||||
Ok(parsed)
|
||||
}
|
||||
|
||||
// move these to better place!
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub enum FsAction {
|
||||
Write,
|
||||
Replace(u128),
|
||||
Append(Option<u128>),
|
||||
Read(u128),
|
||||
ReadChunk(ReadChunkRequest),
|
||||
Delete(u128),
|
||||
Length(u128),
|
||||
// process state management
|
||||
GetState,
|
||||
SetState,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct ReadChunkRequest {
|
||||
pub file_uuid: u128,
|
||||
pub start: u64,
|
||||
pub length: u64,
|
||||
}
|
@ -1,142 +0,0 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::bindings::component::uq_process::types::*;
|
||||
use super::bindings::{get_payload, send_request, Address, Payload};
|
||||
|
||||
impl PartialEq for ProcessId {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(ProcessId::Id(i1), ProcessId::Id(i2)) => i1 == i2,
|
||||
(ProcessId::Name(s1), ProcessId::Name(s2)) => s1 == s2,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl PartialEq<&str> for ProcessId {
|
||||
fn eq(&self, other: &&str) -> bool {
|
||||
match self {
|
||||
ProcessId::Id(_) => false,
|
||||
ProcessId::Name(s) => s == other,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl PartialEq<u64> for ProcessId {
|
||||
fn eq(&self, other: &u64) -> bool {
|
||||
match self {
|
||||
ProcessId::Id(i) => i == other,
|
||||
ProcessId::Name(_) => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn send_and_await_response(
|
||||
target: &Address,
|
||||
inherit: bool,
|
||||
ipc: Option<Json>,
|
||||
metadata: Option<Json>,
|
||||
payload: Option<&Payload>,
|
||||
timeout: u64,
|
||||
) -> Result<(Address, Message), SendError> {
|
||||
super::bindings::send_and_await_response(
|
||||
target,
|
||||
&Request {
|
||||
inherit,
|
||||
expects_response: Some(timeout),
|
||||
ipc,
|
||||
metadata,
|
||||
},
|
||||
payload,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_state(our: String) -> Option<Payload> {
|
||||
let _ = send_and_await_response(
|
||||
&Address {
|
||||
node: our,
|
||||
process: ProcessId::Name("filesystem".to_string()),
|
||||
},
|
||||
false,
|
||||
Some(serde_json::to_string(&FsAction::GetState).unwrap()),
|
||||
None,
|
||||
None,
|
||||
5, // TODO evaluate timeout
|
||||
);
|
||||
get_payload()
|
||||
}
|
||||
|
||||
pub fn set_state(our: String, bytes: Vec<u8>) {
|
||||
send_request(
|
||||
&Address {
|
||||
node: our,
|
||||
process: ProcessId::Name("filesystem".to_string()),
|
||||
},
|
||||
&Request {
|
||||
inherit: false,
|
||||
expects_response: Some(5), // TODO evaluate timeout
|
||||
ipc: Some(serde_json::to_string(&FsAction::SetState).unwrap()),
|
||||
metadata: None,
|
||||
},
|
||||
None,
|
||||
Some(&Payload { mime: None, bytes }),
|
||||
);
|
||||
}
|
||||
|
||||
pub fn await_set_state<T>(our: String, state: &T)
|
||||
where
|
||||
T: serde::Serialize,
|
||||
{
|
||||
// Request/Response stays local -> no SendError
|
||||
let (_, response) = send_and_await_response(
|
||||
&Address {
|
||||
node: our,
|
||||
process: ProcessId::Name("filesystem".to_string()),
|
||||
},
|
||||
false,
|
||||
Some(serde_json::to_string(&FsAction::SetState).unwrap()),
|
||||
None,
|
||||
Some(&Payload {
|
||||
mime: None,
|
||||
bytes: bincode::serialize(state).unwrap(),
|
||||
}),
|
||||
5, // TODO evaluate timeout
|
||||
)
|
||||
.unwrap();
|
||||
match response {
|
||||
Message::Request(_) => panic!("got request from filesystem"),
|
||||
Message::Response((response, _context)) => return,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_message_ipc<T>(json_string: Option<String>) -> anyhow::Result<T>
|
||||
where
|
||||
for<'a> T: serde::Deserialize<'a>,
|
||||
{
|
||||
let parsed: T = serde_json::from_str(
|
||||
json_string
|
||||
.ok_or(anyhow::anyhow!("json payload empty"))?
|
||||
.as_str(),
|
||||
)?;
|
||||
Ok(parsed)
|
||||
}
|
||||
|
||||
// move these to better place!
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub enum FsAction {
|
||||
Write,
|
||||
Replace(u128),
|
||||
Append(Option<u128>),
|
||||
Read(u128),
|
||||
ReadChunk(ReadChunkRequest),
|
||||
Delete(u128),
|
||||
Length(u128),
|
||||
// process state management
|
||||
GetState,
|
||||
SetState,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct ReadChunkRequest {
|
||||
pub file_uuid: u128,
|
||||
pub start: u64,
|
||||
pub length: u64,
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::bindings::component::uq_process::types::*;
|
||||
use super::bindings::{Address, get_payload, Payload, SendError, send_request};
|
||||
|
||||
impl PartialEq for ProcessId {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(ProcessId::Id(i1), ProcessId::Id(i2)) => i1 == i2,
|
||||
(ProcessId::Name(s1), ProcessId::Name(s2)) => s1 == s2,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl PartialEq<&str> for ProcessId {
|
||||
fn eq(&self, other: &&str) -> bool {
|
||||
match self {
|
||||
ProcessId::Id(_) => false,
|
||||
ProcessId::Name(s) => s == other,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl PartialEq<u64> for ProcessId {
|
||||
fn eq(&self, other: &u64) -> bool {
|
||||
match self {
|
||||
ProcessId::Id(i) => i == other,
|
||||
ProcessId::Name(_) => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn send_and_await_response(
|
||||
target: &Address,
|
||||
inherit: bool,
|
||||
ipc: Option<Json>,
|
||||
metadata: Option<Json>,
|
||||
payload: Option<&Payload>,
|
||||
timeout: u64,
|
||||
) -> Result<(Address, Message), SendError> {
|
||||
super::bindings::send_and_await_response(
|
||||
target,
|
||||
&Request {
|
||||
inherit,
|
||||
expects_response: Some(timeout),
|
||||
ipc,
|
||||
metadata,
|
||||
},
|
||||
payload,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_state(our: String) -> Option<Payload> {
|
||||
match super::bindings::get_state() {
|
||||
Some(bytes) => Some(Payload {
|
||||
mime: None,
|
||||
bytes,
|
||||
}),
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_state(our: String, bytes: Vec<u8>) {
|
||||
super::bindings::set_state(&bytes);
|
||||
}
|
||||
|
||||
pub fn await_set_state<T>(our: String, state: &T)
|
||||
where
|
||||
T: serde::Serialize,
|
||||
{
|
||||
super::bindings::set_state(&bincode::serialize(state).unwrap());
|
||||
}
|
||||
|
||||
pub fn parse_message_ipc<T>(json_string: Option<String>) -> anyhow::Result<T>
|
||||
where
|
||||
for<'a> T: serde::Deserialize<'a>,
|
||||
{
|
||||
let parsed: T = serde_json::from_str(
|
||||
json_string
|
||||
.ok_or(anyhow::anyhow!("json payload empty"))?
|
||||
.as_str(),
|
||||
)?;
|
||||
Ok(parsed)
|
||||
}
|
||||
|
||||
// move these to better place!
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub enum FsAction {
|
||||
Write,
|
||||
Replace(u128),
|
||||
Append(Option<u128>),
|
||||
Read(u128),
|
||||
ReadChunk(ReadChunkRequest),
|
||||
Delete(u128),
|
||||
Length(u128),
|
||||
// process state management
|
||||
GetState,
|
||||
SetState,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct ReadChunkRequest {
|
||||
pub file_uuid: u128,
|
||||
pub start: u64,
|
||||
pub length: u64,
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::bindings::component::uq_process::types::*;
|
||||
use super::bindings::{Address, get_payload, Payload, SendError, send_request};
|
||||
|
||||
impl PartialEq for ProcessId {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(ProcessId::Id(i1), ProcessId::Id(i2)) => i1 == i2,
|
||||
(ProcessId::Name(s1), ProcessId::Name(s2)) => s1 == s2,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl PartialEq<&str> for ProcessId {
|
||||
fn eq(&self, other: &&str) -> bool {
|
||||
match self {
|
||||
ProcessId::Id(_) => false,
|
||||
ProcessId::Name(s) => s == other,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl PartialEq<u64> for ProcessId {
|
||||
fn eq(&self, other: &u64) -> bool {
|
||||
match self {
|
||||
ProcessId::Id(i) => i == other,
|
||||
ProcessId::Name(_) => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn send_and_await_response(
|
||||
target: &Address,
|
||||
inherit: bool,
|
||||
ipc: Option<Json>,
|
||||
metadata: Option<Json>,
|
||||
payload: Option<&Payload>,
|
||||
timeout: u64,
|
||||
) -> Result<(Address, Message), SendError> {
|
||||
super::bindings::send_and_await_response(
|
||||
target,
|
||||
&Request {
|
||||
inherit,
|
||||
expects_response: Some(timeout),
|
||||
ipc,
|
||||
metadata,
|
||||
},
|
||||
payload,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_state(our: String) -> Option<Payload> {
|
||||
match super::bindings::get_state() {
|
||||
Some(bytes) => Some(Payload {
|
||||
mime: None,
|
||||
bytes,
|
||||
}),
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_state(our: String, bytes: Vec<u8>) {
|
||||
super::bindings::set_state(&bytes);
|
||||
}
|
||||
|
||||
pub fn await_set_state<T>(our: String, state: &T)
|
||||
where
|
||||
T: serde::Serialize,
|
||||
{
|
||||
super::bindings::set_state(&bincode::serialize(state).unwrap());
|
||||
}
|
||||
|
||||
pub fn parse_message_ipc<T>(json_string: Option<String>) -> anyhow::Result<T>
|
||||
where
|
||||
for<'a> T: serde::Deserialize<'a>,
|
||||
{
|
||||
let parsed: T = serde_json::from_str(
|
||||
json_string
|
||||
.ok_or(anyhow::anyhow!("json payload empty"))?
|
||||
.as_str(),
|
||||
)?;
|
||||
Ok(parsed)
|
||||
}
|
||||
|
||||
// move these to better place!
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub enum FsAction {
|
||||
Write,
|
||||
Replace(u128),
|
||||
Append(Option<u128>),
|
||||
Read(u128),
|
||||
ReadChunk(ReadChunkRequest),
|
||||
Delete(u128),
|
||||
Length(u128),
|
||||
// process state management
|
||||
GetState,
|
||||
SetState,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct ReadChunkRequest {
|
||||
pub file_uuid: u128,
|
||||
pub start: u64,
|
||||
pub length: u64,
|
||||
}
|
@ -1,142 +0,0 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::bindings::component::uq_process::types::*;
|
||||
use super::bindings::{get_payload, send_request, Address, Payload};
|
||||
|
||||
impl PartialEq for ProcessId {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(ProcessId::Id(i1), ProcessId::Id(i2)) => i1 == i2,
|
||||
(ProcessId::Name(s1), ProcessId::Name(s2)) => s1 == s2,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl PartialEq<&str> for ProcessId {
|
||||
fn eq(&self, other: &&str) -> bool {
|
||||
match self {
|
||||
ProcessId::Id(_) => false,
|
||||
ProcessId::Name(s) => s == other,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl PartialEq<u64> for ProcessId {
|
||||
fn eq(&self, other: &u64) -> bool {
|
||||
match self {
|
||||
ProcessId::Id(i) => i == other,
|
||||
ProcessId::Name(_) => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn send_and_await_response(
|
||||
target: &Address,
|
||||
inherit: bool,
|
||||
ipc: Option<Json>,
|
||||
metadata: Option<Json>,
|
||||
payload: Option<&Payload>,
|
||||
timeout: u64,
|
||||
) -> Result<(Address, Message), SendError> {
|
||||
super::bindings::send_and_await_response(
|
||||
target,
|
||||
&Request {
|
||||
inherit,
|
||||
expects_response: Some(timeout),
|
||||
ipc,
|
||||
metadata,
|
||||
},
|
||||
payload,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_state(our: String) -> Option<Payload> {
|
||||
let _ = send_and_await_response(
|
||||
&Address {
|
||||
node: our,
|
||||
process: ProcessId::Name("filesystem".to_string()),
|
||||
},
|
||||
false,
|
||||
Some(serde_json::to_string(&FsAction::GetState).unwrap()),
|
||||
None,
|
||||
None,
|
||||
5, // TODO evaluate timeout
|
||||
);
|
||||
get_payload()
|
||||
}
|
||||
|
||||
pub fn set_state(our: String, bytes: Vec<u8>) {
|
||||
send_request(
|
||||
&Address {
|
||||
node: our,
|
||||
process: ProcessId::Name("filesystem".to_string()),
|
||||
},
|
||||
&Request {
|
||||
inherit: false,
|
||||
expects_response: Some(5), // TODO evaluate timeout
|
||||
ipc: Some(serde_json::to_string(&FsAction::SetState).unwrap()),
|
||||
metadata: None,
|
||||
},
|
||||
None,
|
||||
Some(&Payload { mime: None, bytes }),
|
||||
);
|
||||
}
|
||||
|
||||
pub fn await_set_state<T>(our: String, state: &T)
|
||||
where
|
||||
T: serde::Serialize,
|
||||
{
|
||||
// Request/Response stays local -> no SendError
|
||||
let (_, response) = send_and_await_response(
|
||||
&Address {
|
||||
node: our,
|
||||
process: ProcessId::Name("filesystem".to_string()),
|
||||
},
|
||||
false,
|
||||
Some(serde_json::to_string(&FsAction::SetState).unwrap()),
|
||||
None,
|
||||
Some(&Payload {
|
||||
mime: None,
|
||||
bytes: bincode::serialize(state).unwrap(),
|
||||
}),
|
||||
5, // TODO evaluate timeout
|
||||
)
|
||||
.unwrap();
|
||||
match response {
|
||||
Message::Request(_) => panic!("got request from filesystem"),
|
||||
Message::Response((response, _context)) => return,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_message_ipc<T>(json_string: Option<String>) -> anyhow::Result<T>
|
||||
where
|
||||
for<'a> T: serde::Deserialize<'a>,
|
||||
{
|
||||
let parsed: T = serde_json::from_str(
|
||||
json_string
|
||||
.ok_or(anyhow::anyhow!("json payload empty"))?
|
||||
.as_str(),
|
||||
)?;
|
||||
Ok(parsed)
|
||||
}
|
||||
|
||||
// move these to better place!
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub enum FsAction {
|
||||
Write,
|
||||
Replace(u128),
|
||||
Append(Option<u128>),
|
||||
Read(u128),
|
||||
ReadChunk(ReadChunkRequest),
|
||||
Delete(u128),
|
||||
Length(u128),
|
||||
// process state management
|
||||
GetState,
|
||||
SetState,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct ReadChunkRequest {
|
||||
pub file_uuid: u128,
|
||||
pub start: u64,
|
||||
pub length: u64,
|
||||
}
|
@ -1 +0,0 @@
|
||||
../../../src/process_lib.rs
|
@ -9,6 +9,7 @@ use std::collections::HashSet;
|
||||
//
|
||||
|
||||
pub type Context = String; // JSON-string
|
||||
pub type NodeId = String; // QNS domain name
|
||||
|
||||
/// process ID is a formatted unique identifier that contains
|
||||
/// the publishing node's ID, the package name, and finally the process name.
|
||||
@ -22,14 +23,12 @@ pub struct ProcessId {
|
||||
publisher_node: NodeId,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
impl ProcessId {
|
||||
/// generates a random u64 number if process_name is not declared
|
||||
pub fn new(process_name: Option<&str>, package_name: &str, publisher_node: &str) -> Self {
|
||||
pub fn new(process_name: &str, package_name: &str, publisher_node: &str) -> Self {
|
||||
ProcessId {
|
||||
process_name: match process_name {
|
||||
Some(name) => name.to_string(),
|
||||
None => rand::random::<u64>().to_string(),
|
||||
},
|
||||
process_name: process_name.into(),
|
||||
package_name: package_name.into(),
|
||||
publisher_node: publisher_node.into(),
|
||||
}
|
||||
@ -75,6 +74,20 @@ impl ProcessId {
|
||||
pub fn publisher_node(&self) -> &str {
|
||||
&self.publisher_node
|
||||
}
|
||||
pub fn en_wit(&self) -> wit::ProcessId {
|
||||
wit::ProcessId {
|
||||
process_name: self.process_name.clone(),
|
||||
package_name: self.package_name.clone(),
|
||||
publisher_node: self.publisher_node.clone(),
|
||||
}
|
||||
}
|
||||
pub fn de_wit(wit: wit::ProcessId) -> ProcessId {
|
||||
ProcessId {
|
||||
process_name: wit.process_name,
|
||||
package_name: wit.package_name,
|
||||
publisher_node: wit.publisher_node,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub enum ProcessIdParseError {
|
||||
@ -82,44 +95,31 @@ pub enum ProcessIdParseError {
|
||||
MissingField,
|
||||
}
|
||||
|
||||
// #[derive(Clone, Debug, Eq, Hash, Serialize, Deserialize)]
|
||||
// pub enum ProcessId {
|
||||
// Id(u64),
|
||||
// Name(String),
|
||||
// }
|
||||
|
||||
// impl PartialEq for ProcessId {
|
||||
// fn eq(&self, other: &Self) -> bool {
|
||||
// match (self, other) {
|
||||
// (ProcessId::Id(i1), ProcessId::Id(i2)) => i1 == i2,
|
||||
// (ProcessId::Name(s1), ProcessId::Name(s2)) => s1 == s2,
|
||||
// _ => false,
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// impl PartialEq<&str> for ProcessId {
|
||||
// fn eq(&self, other: &&str) -> bool {
|
||||
// match self {
|
||||
// ProcessId::Id(_) => false,
|
||||
// ProcessId::Name(s) => s == other,
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// impl PartialEq<u64> for ProcessId {
|
||||
// fn eq(&self, other: &u64) -> bool {
|
||||
// match self {
|
||||
// ProcessId::Id(i) => i == other,
|
||||
// ProcessId::Name(_) => false,
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Address {
|
||||
pub node: NodeId,
|
||||
pub process: ProcessId,
|
||||
}
|
||||
|
||||
impl Address {
|
||||
pub fn en_wit(&self) -> wit::Address {
|
||||
wit::Address {
|
||||
node: self.node.clone(),
|
||||
process: self.process.en_wit(),
|
||||
}
|
||||
}
|
||||
pub fn de_wit(wit: wit::Address) -> Address {
|
||||
Address {
|
||||
node: wit.node,
|
||||
process: ProcessId {
|
||||
process_name: wit.process.process_name,
|
||||
package_name: wit.process.package_name,
|
||||
publisher_node: wit.process.publisher_node,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct Payload {
|
||||
pub mime: Option<String>, // MIME type
|
||||
@ -129,7 +129,7 @@ pub struct Payload {
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct Request {
|
||||
pub inherit: bool,
|
||||
pub expects_response: Option<u64>,
|
||||
pub expects_response: Option<u64>, // number of seconds until timeout
|
||||
pub ipc: Option<String>, // JSON-string
|
||||
pub metadata: Option<String>, // JSON-string
|
||||
}
|
||||
@ -177,7 +177,17 @@ pub enum SendErrorKind {
|
||||
pub enum OnPanic {
|
||||
None,
|
||||
Restart,
|
||||
Requests(Vec<(Address, Request)>),
|
||||
Requests(Vec<(Address, Request, Option<Payload>)>),
|
||||
}
|
||||
|
||||
impl OnPanic {
|
||||
pub fn is_restart(&self) -> bool {
|
||||
match self {
|
||||
OnPanic::None => false,
|
||||
OnPanic::Restart => true,
|
||||
OnPanic::Requests(_) => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
@ -203,11 +213,21 @@ pub enum KernelCommand {
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum KernelResponse {
|
||||
StartedProcess,
|
||||
StartProcessError,
|
||||
KilledProcess(ProcessId),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct PersistedProcess {
|
||||
pub wasm_bytes_handle: u128,
|
||||
// pub drive: String,
|
||||
// pub full_path: String,
|
||||
pub on_panic: OnPanic,
|
||||
pub capabilities: HashSet<Capability>,
|
||||
pub public: bool, // marks if a process allows messages from any process
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
@ -267,7 +287,8 @@ pub enum VfsResponse {
|
||||
Err(VfsError),
|
||||
GetPath(Option<String>),
|
||||
GetHash(Option<u128>),
|
||||
GetEntry { // file bytes in payload, if entry was a file
|
||||
GetEntry {
|
||||
// file bytes in payload, if entry was a file
|
||||
is_file: bool,
|
||||
children: Vec<String>,
|
||||
},
|
||||
@ -275,6 +296,14 @@ pub enum VfsResponse {
|
||||
GetEntryLength(u64),
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum VfsError {
|
||||
BadDriveName,
|
||||
BadDescriptor,
|
||||
NoCap,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
impl VfsError {
|
||||
pub fn kind(&self) -> &str {
|
||||
match *self {
|
||||
@ -285,19 +314,20 @@ impl VfsError {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum VfsError {
|
||||
BadDriveName,
|
||||
BadDescriptor,
|
||||
NoCap,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum KeyValueMessage {
|
||||
New { drive: String },
|
||||
Write { drive: String, key: Vec<u8> },
|
||||
Read { drive: String, key: Vec<u8> },
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum KeyValueError {
|
||||
BadDriveName,
|
||||
NoCap,
|
||||
NoBytes,
|
||||
}
|
||||
|
||||
impl KeyValueError {
|
||||
pub fn kind(&self) -> &str {
|
||||
match *self {
|
||||
@ -307,47 +337,11 @@ impl KeyValueError {
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum KeyValueError {
|
||||
BadDriveName,
|
||||
NoCap,
|
||||
NoBytes,
|
||||
}
|
||||
|
||||
//
|
||||
// conversions between wit types and kernel types (annoying!)
|
||||
//
|
||||
|
||||
pub fn en_wit_process_id(process_id: ProcessId) -> wit::ProcessId {
|
||||
wit::ProcessId {
|
||||
process_name: process_id.process().to_string(),
|
||||
package_name: process_id.package().to_string(),
|
||||
publisher_node: process_id.publisher().to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn de_wit_process_id(wit: wit::ProcessId) -> ProcessId {
|
||||
ProcessId {
|
||||
process_name: wit.process_name,
|
||||
package_name: wit.package_name,
|
||||
publisher_node: wit.publisher_node,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn en_wit_address(address: Address) -> wit::Address {
|
||||
wit::Address {
|
||||
node: address.node,
|
||||
process: en_wit_process_id(address.process),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn de_wit_address(wit: wit::Address) -> Address {
|
||||
Address {
|
||||
node: wit.node,
|
||||
process: de_wit_process_id(wit.process),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn de_wit_request(wit: wit::Request) -> Request {
|
||||
Request {
|
||||
inherit: wit.inherit,
|
||||
@ -402,7 +396,14 @@ pub fn en_wit_payload(load: Option<Payload>) -> Option<wit::Payload> {
|
||||
|
||||
pub fn de_wit_signed_capability(wit: wit::SignedCapability) -> SignedCapability {
|
||||
SignedCapability {
|
||||
issuer: de_wit_address(wit.issuer),
|
||||
issuer: Address {
|
||||
node: wit.issuer.node,
|
||||
process: ProcessId {
|
||||
process_name: wit.issuer.process.process_name,
|
||||
package_name: wit.issuer.process.package_name,
|
||||
publisher_node: wit.issuer.process.publisher_node,
|
||||
},
|
||||
},
|
||||
params: wit.params,
|
||||
signature: wit.signature,
|
||||
}
|
||||
@ -410,7 +411,7 @@ pub fn de_wit_signed_capability(wit: wit::SignedCapability) -> SignedCapability
|
||||
|
||||
pub fn en_wit_signed_capability(cap: SignedCapability) -> wit::SignedCapability {
|
||||
wit::SignedCapability {
|
||||
issuer: en_wit_address(cap.issuer),
|
||||
issuer: cap.issuer.en_wit(),
|
||||
params: cap.params,
|
||||
signature: cap.signature,
|
||||
}
|
||||
|
@ -1,32 +1,64 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::bindings::component::uq_process::types::*;
|
||||
use super::bindings::{Address, get_payload, Payload, SendError, send_request};
|
||||
use super::bindings::{Address, Payload, SendError};
|
||||
|
||||
impl PartialEq for ProcessId {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(ProcessId::Id(i1), ProcessId::Id(i2)) => i1 == i2,
|
||||
(ProcessId::Name(s1), ProcessId::Name(s2)) => s1 == s2,
|
||||
_ => false,
|
||||
#[allow(dead_code)]
|
||||
impl ProcessId {
|
||||
/// generates a random u64 number if process_name is not declared
|
||||
pub fn new(process_name: &str, package_name: &str, publisher_node: &str) -> Self {
|
||||
ProcessId {
|
||||
process_name: process_name.into(),
|
||||
package_name: package_name.into(),
|
||||
publisher_node: publisher_node.into(),
|
||||
}
|
||||
}
|
||||
pub fn from_str(input: &str) -> Result<Self, ProcessIdParseError> {
|
||||
// split string on colons into 3 segments
|
||||
let mut segments = input.split(':');
|
||||
let process_name = segments
|
||||
.next()
|
||||
.ok_or(ProcessIdParseError::MissingField)?
|
||||
.to_string();
|
||||
let package_name = segments
|
||||
.next()
|
||||
.ok_or(ProcessIdParseError::MissingField)?
|
||||
.to_string();
|
||||
let publisher_node = segments
|
||||
.next()
|
||||
.ok_or(ProcessIdParseError::MissingField)?
|
||||
.to_string();
|
||||
if segments.next().is_some() {
|
||||
return Err(ProcessIdParseError::TooManyColons);
|
||||
}
|
||||
Ok(ProcessId {
|
||||
process_name,
|
||||
package_name,
|
||||
publisher_node,
|
||||
})
|
||||
}
|
||||
pub fn to_string(&self) -> String {
|
||||
[
|
||||
self.process_name.as_str(),
|
||||
self.package_name.as_str(),
|
||||
self.publisher_node.as_str(),
|
||||
]
|
||||
.join(":")
|
||||
}
|
||||
pub fn process(&self) -> &str {
|
||||
&self.process_name
|
||||
}
|
||||
pub fn package(&self) -> &str {
|
||||
&self.package_name
|
||||
}
|
||||
pub fn publisher_node(&self) -> &str {
|
||||
&self.publisher_node
|
||||
}
|
||||
}
|
||||
impl PartialEq<&str> for ProcessId {
|
||||
fn eq(&self, other: &&str) -> bool {
|
||||
match self {
|
||||
ProcessId::Id(_) => false,
|
||||
ProcessId::Name(s) => s == other,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl PartialEq<u64> for ProcessId {
|
||||
fn eq(&self, other: &u64) -> bool {
|
||||
match self {
|
||||
ProcessId::Id(i) => i == other,
|
||||
ProcessId::Name(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub enum ProcessIdParseError {
|
||||
TooManyColons,
|
||||
MissingField,
|
||||
}
|
||||
|
||||
pub fn send_and_await_response(
|
||||
@ -51,10 +83,7 @@ pub fn send_and_await_response(
|
||||
|
||||
pub fn get_state(our: String) -> Option<Payload> {
|
||||
match super::bindings::get_state() {
|
||||
Some(bytes) => Some(Payload {
|
||||
mime: None,
|
||||
bytes,
|
||||
}),
|
||||
Some(bytes) => Some(Payload { mime: None, bytes }),
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
|
29
src/types.rs
29
src/types.rs
@ -581,13 +581,20 @@ pub enum VfsResponse {
|
||||
GetHash(Option<u128>),
|
||||
GetEntry {
|
||||
// file bytes in payload, if entry was a file
|
||||
exists: bool,
|
||||
is_file: bool,
|
||||
children: Vec<String>,
|
||||
},
|
||||
GetFileChunk, // chunk in payload, if file exists
|
||||
GetEntryLength(Option<u64>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum VfsError {
|
||||
BadDriveName,
|
||||
BadDescriptor,
|
||||
NoCap,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
impl VfsError {
|
||||
pub fn kind(&self) -> &str {
|
||||
@ -599,13 +606,6 @@ impl VfsError {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum VfsError {
|
||||
BadDriveName,
|
||||
BadDescriptor,
|
||||
NoCap,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum KeyValueMessage {
|
||||
New { drive: String },
|
||||
@ -613,6 +613,13 @@ pub enum KeyValueMessage {
|
||||
Read { drive: String, key: Vec<u8> },
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum KeyValueError {
|
||||
BadDriveName,
|
||||
NoCap,
|
||||
NoBytes,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
impl KeyValueError {
|
||||
pub fn kind(&self) -> &str {
|
||||
@ -623,12 +630,6 @@ impl KeyValueError {
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum KeyValueError {
|
||||
BadDriveName,
|
||||
NoCap,
|
||||
NoBytes,
|
||||
}
|
||||
|
||||
//
|
||||
// http_client.rs types
|
||||
|
12
src/vfs.rs
12
src/vfs.rs
@ -1255,13 +1255,7 @@ async fn match_request(
|
||||
};
|
||||
|
||||
let entry_not_found = (
|
||||
Some(
|
||||
serde_json::to_string(&VfsResponse::GetEntry {
|
||||
exists: false,
|
||||
children: vec![],
|
||||
})
|
||||
.unwrap(),
|
||||
),
|
||||
Some(serde_json::to_string(&VfsResponse::Err(VfsError::BadDescriptor)).unwrap()),
|
||||
None,
|
||||
);
|
||||
match key {
|
||||
@ -1275,7 +1269,7 @@ async fn match_request(
|
||||
} => (
|
||||
Some(
|
||||
serde_json::to_string(&VfsResponse::GetEntry {
|
||||
exists: true,
|
||||
is_file: false,
|
||||
children: paths,
|
||||
})
|
||||
.unwrap(),
|
||||
@ -1337,7 +1331,7 @@ async fn match_request(
|
||||
(
|
||||
Some(
|
||||
serde_json::to_string(&VfsResponse::GetEntry {
|
||||
exists: true,
|
||||
is_file: true,
|
||||
children: vec![],
|
||||
})
|
||||
.unwrap(),
|
||||
|
Loading…
Reference in New Issue
Block a user