From b81a0aa61c14091a36ba9a7c574f43a8ffb6effe Mon Sep 17 00:00:00 2001 From: Sameh Abouel-saad Date: Tue, 24 Jun 2025 17:47:50 +0300 Subject: [PATCH] refactor: rename rfs-client to sal-rfs-client and integrate with workspace dependencies --- Cargo.toml | 6 ++++-- rfs-client/Cargo.toml | 27 ++++++++++++++----------- rfs-client/examples/authentication.rs | 4 ++-- rfs-client/examples/block_management.rs | 4 ++-- rfs-client/examples/file_management.rs | 4 ++-- rfs-client/examples/flist_operations.rs | 5 ++--- rfs-client/examples/wait_for_flist.rs | 4 ++-- rfs-client/rust-toolchain.toml | 3 --- rfs-client/src/client.rs | 11 +++------- rust-toolchain.toml | 3 +++ src/lib.rs | 1 + 11 files changed, 36 insertions(+), 36 deletions(-) delete mode 100644 rfs-client/rust-toolchain.toml create mode 100644 rust-toolchain.toml diff --git a/Cargo.toml b/Cargo.toml index 5bcc125..6ca224d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,17 +11,18 @@ categories = ["os", "filesystem", "api-bindings"] readme = "README.md" [workspace] -members = [".", "vault", "git", "redisclient", "mycelium", "text", "os", "net", "zinit_client", "process", "virt", "postgresclient", "rhai", "herodo"] +members = [".", "vault", "git", "redisclient", "mycelium", "text", "os", "net", "zinit_client", "process", "virt", "postgresclient", "rhai", "herodo", "rfs-client"] resolver = "2" [workspace.metadata] # Workspace-level metadata -rust-version = "1.70.0" +rust-version = "1.85.0" [workspace.dependencies] # Core shared dependencies with consistent versions anyhow = "1.0.98" base64 = "0.22.1" +bytes = "1.4.0" dirs = "6.0.0" env_logger = "0.11.8" futures = "0.3.30" @@ -84,3 +85,4 @@ sal-virt = { path = "virt" } sal-postgresclient = { path = "postgresclient" } sal-vault = { path = "vault" } sal-rhai = { path = "rhai" } +sal-rfs-client = { path = "rfs-client" } diff --git a/rfs-client/Cargo.toml b/rfs-client/Cargo.toml index 8432d93..b45730a 100644 --- a/rfs-client/Cargo.toml +++ b/rfs-client/Cargo.toml @@ -1,18 +1,21 @@ [package] -name = "rfs-client" +name = "sal-rfs-client" version = "0.1.0" edition = "2021" -description = "Client library for RFS (Remote File System) server" -license = "MIT" +description = "SAL RFS Client - Client library for Remote File System server" +repository = "https://git.threefold.info/herocode/sal" +license = "Apache-2.0" +keywords = ["rfs", "client", "filesystem", "remote"] +categories = ["filesystem", "api-bindings"] [dependencies] openapi = { path = "./openapi" } -thiserror = "1.0" -url = "2.4" -reqwest = { version = "^0.12", features = ["json", "multipart"] } -tokio = { version = "1.28", features = ["full"] } -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" -log = "0.4" -bytes = "1.4" -futures = "0.3" +thiserror.workspace = true +url.workspace = true +reqwest = { workspace = true, features = ["json", "multipart"] } +tokio = { workspace = true, features = ["full"] } +serde = { workspace = true, features = ["derive"] } +serde_json.workspace = true +log.workspace = true +bytes.workspace = true +futures.workspace = true diff --git a/rfs-client/examples/authentication.rs b/rfs-client/examples/authentication.rs index 0f19001..43c86d5 100644 --- a/rfs-client/examples/authentication.rs +++ b/rfs-client/examples/authentication.rs @@ -1,5 +1,5 @@ -use rfs_client::RfsClient; -use rfs_client::types::{ClientConfig, Credentials}; +use sal_rfs_client::RfsClient; +use sal_rfs_client::types::{ClientConfig, Credentials}; #[tokio::main] async fn main() -> Result<(), Box> { diff --git a/rfs-client/examples/block_management.rs b/rfs-client/examples/block_management.rs index b029d7a..4bc6e3e 100644 --- a/rfs-client/examples/block_management.rs +++ b/rfs-client/examples/block_management.rs @@ -1,5 +1,5 @@ -use rfs_client::RfsClient; -use rfs_client::types::{ClientConfig, Credentials}; +use sal_rfs_client::RfsClient; +use sal_rfs_client::types::{ClientConfig, Credentials}; use openapi::models::{VerifyBlock, VerifyBlocksRequest}; #[tokio::main] diff --git a/rfs-client/examples/file_management.rs b/rfs-client/examples/file_management.rs index 40794ed..e039e17 100644 --- a/rfs-client/examples/file_management.rs +++ b/rfs-client/examples/file_management.rs @@ -1,5 +1,5 @@ -use rfs_client::RfsClient; -use rfs_client::types::{ClientConfig, Credentials, UploadOptions, DownloadOptions}; +use sal_rfs_client::RfsClient; +use sal_rfs_client::types::{ClientConfig, Credentials, UploadOptions, DownloadOptions}; #[tokio::main] async fn main() -> Result<(), Box> { diff --git a/rfs-client/examples/flist_operations.rs b/rfs-client/examples/flist_operations.rs index ad57cc5..7b411d1 100644 --- a/rfs-client/examples/flist_operations.rs +++ b/rfs-client/examples/flist_operations.rs @@ -1,6 +1,5 @@ -use rfs_client::RfsClient; -use rfs_client::types::{ClientConfig, Credentials, FlistOptions, WaitOptions}; -use std::path::Path; +use sal_rfs_client::RfsClient; +use sal_rfs_client::types::{ClientConfig, Credentials, FlistOptions, WaitOptions}; #[tokio::main] async fn main() -> Result<(), Box> { diff --git a/rfs-client/examples/wait_for_flist.rs b/rfs-client/examples/wait_for_flist.rs index e5ef4f0..345b90c 100644 --- a/rfs-client/examples/wait_for_flist.rs +++ b/rfs-client/examples/wait_for_flist.rs @@ -1,5 +1,5 @@ -use rfs_client::RfsClient; -use rfs_client::types::{ClientConfig, Credentials, WaitOptions}; +use sal_rfs_client::RfsClient; +use sal_rfs_client::types::{ClientConfig, Credentials, WaitOptions}; use openapi::models::FlistState; #[tokio::main] diff --git a/rfs-client/rust-toolchain.toml b/rfs-client/rust-toolchain.toml deleted file mode 100644 index 8b5d745..0000000 --- a/rfs-client/rust-toolchain.toml +++ /dev/null @@ -1,3 +0,0 @@ -[toolchain] -channel = "1.82.0" - diff --git a/rfs-client/src/client.rs b/rfs-client/src/client.rs index f96d1af..367b56c 100644 --- a/rfs-client/src/client.rs +++ b/rfs-client/src/client.rs @@ -12,8 +12,8 @@ use openapi::{ }, models::{ SignInBody, ListBlocksParams, - VerifyBlocksRequest, VerifyBlocksResponse, VerifyBlock, FlistBody, UserBlocksResponse, BlockDownloadsResponse, - BlocksResponse, PreviewResponse, FileInfo, FlistState, ResponseResult, FlistStateResponse, BlockUploadedResponse, FileUploadResponse, + VerifyBlocksRequest, VerifyBlocksResponse, FlistBody, UserBlocksResponse, BlockDownloadsResponse, + BlocksResponse, PreviewResponse, FileInfo, FlistState, FlistStateResponse, }, }; @@ -122,12 +122,7 @@ impl RfsClient { .map_err(map_openapi_error)?; // Extract the file hash from the response - match result { - FileUploadResponse { file_hash, .. } => { - Ok(file_hash.clone()) - }, - _ => Err(RfsError::Other("Unexpected response type from file upload".to_string())), - } + Ok(result.file_hash.clone()) } /// Download a file from the RFS server diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..13cec2c --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.85.0" + diff --git a/src/lib.rs b/src/lib.rs index f87146d..60fdce7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -43,6 +43,7 @@ pub use sal_os as os; pub use sal_postgresclient as postgresclient; pub use sal_process as process; pub use sal_redisclient as redisclient; +pub use sal_rfs_client as rfs_client; pub use sal_rhai as rhai; pub use sal_text as text; pub use sal_vault as vault;