mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-12-02 08:02:23 +03:00
fix app_store bootstrapped modules reload
This commit is contained in:
parent
82b567033d
commit
417b442308
2
modules/app_store/app_store/Cargo.lock
generated
2
modules/app_store/app_store/Cargo.lock
generated
@ -423,7 +423,7 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
|
||||
[[package]]
|
||||
name = "uqbar_process_lib"
|
||||
version = "0.4.0"
|
||||
source = "git+ssh://git@github.com/uqbar-dao/process_lib.git?rev=b09d987#b09d9875edce1a230549cf56cf088f95e38d4abd"
|
||||
source = "git+ssh://git@github.com/uqbar-dao/process_lib.git?rev=7e96a12#7e96a120145f3813bde39e3bad47e73407ccbd9a"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
|
@ -17,7 +17,7 @@ rand = "0.8"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
sha2 = "0.10.8"
|
||||
uqbar_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", rev = "b09d987" }
|
||||
uqbar_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", rev = "7e96a12" }
|
||||
wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" }
|
||||
|
||||
[lib]
|
||||
|
@ -352,7 +352,7 @@ fn handle_local_request(
|
||||
.inherit(true)
|
||||
.ipc(serde_json::to_vec(&kt::VfsRequest {
|
||||
path: zip_path,
|
||||
action: kt::VfsAction::Write,
|
||||
action: kt::VfsAction::ReWrite,
|
||||
})?)
|
||||
.payload(payload)
|
||||
.send_and_await_response(5)?
|
||||
|
@ -972,11 +972,13 @@ pub enum VfsAction {
|
||||
CloseFile,
|
||||
WriteAll,
|
||||
Write,
|
||||
ReWrite,
|
||||
WriteAt(u64),
|
||||
Append,
|
||||
SyncAll,
|
||||
Read,
|
||||
ReadDir,
|
||||
ReadToEnd,
|
||||
ReadExact(u64),
|
||||
ReadToString,
|
||||
Seek(SeekFrom),
|
||||
|
32
src/vfs.rs
32
src/vfs.rs
@ -194,6 +194,21 @@ async fn handle_request(
|
||||
file.write_all(&payload.bytes).await?;
|
||||
(serde_json::to_vec(&VfsResponse::Ok).unwrap(), None)
|
||||
}
|
||||
VfsAction::ReWrite => {
|
||||
let Some(payload) = payload else {
|
||||
return Err(VfsError::BadRequest {
|
||||
error: "payload needs to exist for Write".into(),
|
||||
});
|
||||
};
|
||||
let file = open_file(open_files.clone(), path, true).await?;
|
||||
let mut file = file.lock().await;
|
||||
|
||||
file.seek(SeekFrom::Start(0)).await?;
|
||||
file.write_all(&payload.bytes).await?;
|
||||
file.set_len(payload.bytes.len() as u64).await?;
|
||||
|
||||
(serde_json::to_vec(&VfsResponse::Ok).unwrap(), None)
|
||||
}
|
||||
VfsAction::WriteAt(offset) => {
|
||||
let Some(payload) = payload else {
|
||||
return Err(VfsError::BadRequest {
|
||||
@ -237,6 +252,18 @@ async fn handle_request(
|
||||
Some(contents),
|
||||
)
|
||||
}
|
||||
VfsAction::ReadToEnd => {
|
||||
let file = open_file(open_files.clone(), path.clone(), false).await?;
|
||||
let mut file = file.lock().await;
|
||||
let mut contents = Vec::new();
|
||||
|
||||
file.read_to_end(&mut contents).await?;
|
||||
|
||||
(
|
||||
serde_json::to_vec(&VfsResponse::Read).unwrap(),
|
||||
Some(contents),
|
||||
)
|
||||
}
|
||||
VfsAction::ReadDir => {
|
||||
let mut dir = fs::read_dir(path).await?;
|
||||
let mut entries = Vec::new();
|
||||
@ -372,7 +399,10 @@ async fn handle_request(
|
||||
if is_file {
|
||||
let file = open_file(open_files.clone(), local_path, true).await?;
|
||||
let mut file = file.lock().await;
|
||||
|
||||
file.seek(SeekFrom::Start(0)).await?;
|
||||
file.write_all(&file_contents).await?;
|
||||
file.set_len(file_contents.len() as u64).await?;
|
||||
} else if is_dir {
|
||||
// If it's a directory, create it
|
||||
fs::create_dir_all(local_path).await?;
|
||||
@ -517,6 +547,7 @@ async fn check_caps(
|
||||
| VfsAction::CloseFile
|
||||
| VfsAction::WriteAll
|
||||
| VfsAction::Write
|
||||
| VfsAction::ReWrite
|
||||
| VfsAction::WriteAt(_)
|
||||
| VfsAction::Append
|
||||
| VfsAction::SyncAll
|
||||
@ -558,6 +589,7 @@ async fn check_caps(
|
||||
VfsAction::Read
|
||||
| VfsAction::ReadDir
|
||||
| VfsAction::ReadExact(_)
|
||||
| VfsAction::ReadToEnd
|
||||
| VfsAction::ReadToString
|
||||
| VfsAction::Seek(_)
|
||||
| VfsAction::Hash
|
||||
|
Loading…
Reference in New Issue
Block a user