From fed311b76d03324c4ea2ee897bbc88850daf2176 Mon Sep 17 00:00:00 2001 From: Lautaro Mazzitelli Date: Mon, 15 Jul 2024 13:14:51 +0200 Subject: [PATCH] docs(sn_client): readme.md, genral lib and hyperlinked constant --- sn_client/README.md | 11 +++++++++++ sn_client/src/api.rs | 4 ++-- sn_client/src/lib.rs | 32 +++++++++++++++++++++++++++++++- 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/sn_client/README.md b/sn_client/README.md index f9bc76391a..1e3d5a8259 100644 --- a/sn_client/README.md +++ b/sn_client/README.md @@ -10,6 +10,7 @@ The `sn_client` library provides the core functionalities for interacting with t - [Installation](#installation) - [Usage](#usage) - [API Calls](#api-calls) +- [Running Tests](#running-tests) - [Contributing](#contributing) - [Conventional Commits](#conventional-commits) - [License](#license) @@ -32,6 +33,16 @@ use sn_client::Client; let client = Client::new(signer, peers, req_response_timeout, custom_concurrency_limit).await?; ``` +## Running Tests + +Prerequisites: +* A running local network. Refer to [`safe_network/README.md`](../README.md) to run a local test network. +* `SAFE_PEERS` environment variable or running the tests with `--feature=local-discovery`: + +```bash +$ cargo test --package sn_client --release --tests --features=local-discovery +``` + ## Contributing Please refer to the [Contributing Guidelines](../CONTRIBUTING.md) from the main directory for details on how to contribute to this project. diff --git a/sn_client/src/api.rs b/sn_client/src/api.rs index 0d78dea614..f7aaf74d04 100644 --- a/sn_client/src/api.rs +++ b/sn_client/src/api.rs @@ -52,7 +52,7 @@ use tracing::trace; use xor_name::XorName; /// The maximum duration the client will wait for a connection to the network before timing out. -const CONNECTION_TIMEOUT: Duration = Duration::from_secs(30); +pub const CONNECTION_TIMEOUT: Duration = Duration::from_secs(30); /// The timeout duration for the client to receive any response from the network. const INACTIVITY_TIMEOUT: Duration = Duration::from_secs(30); @@ -67,7 +67,7 @@ impl Client { /// /// Optionally specify the duration for the connection timeout. /// - /// Defaults to 180 seconds. + /// Defaults to [`CONNECTION_TIMEOUT`]. /// /// # Arguments /// * 'signer' - [SecretKey] diff --git a/sn_client/src/lib.rs b/sn_client/src/lib.rs index 87d6204a6d..5505008e43 100644 --- a/sn_client/src/lib.rs +++ b/sn_client/src/lib.rs @@ -6,11 +6,41 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. +//! > **Core functionalities for interacting with the SAFE Network** +//! +//! The `sn_client` crate is a part of the [Safe Network](https://safenetwork.tech/) (SN), +//! and plays a crucial role in this ecosystem by serving as the client library that allows +//! applications and users to interact with the Safe Network, and build applications that +//! leverage the Safe Network's capabilities, providing a high-level API that simplifies the development process. +//! +//! Here are the key functionalities provided by this crate: +//! +//! 1. **Network Communication**: It handles communication with the Safe Network, enabling clients to +//! send and receive messages from the decentralized nodes that make up the network. +//! +//! 2. **Data Storage and Retrieval**: to store and retrieve data on the Safe Network. +//! This includes both private and public data, ensuring privacy and security. +//! +//! 3. **Authentication and Access Control**: It provides mechanisms for authenticating users and +//! managing access to data, ensuring that only authorized users can access sensitive information. +//! +//! 4. **File Management**: The crate supports operations related to file management, such as uploading, +//! downloading, and managing files and directories on the Safe Network. +//! +//! 5. **Token Management**: It includes functionality for managing Safe Network tokens, which can be +//! used for various purposes within the network, including paying for storage and services. +//! +//! ## Quick links +//! - [Crates.io](https://crates.io/crates/sn_client) +//! - [Forum](https://forum.autonomi.community/) +//! - [Issues on GitHub](https://github.com/maidsafe/safe_network/issues) +//! + #[macro_use] extern crate tracing; pub mod acc_packet; -mod api; +pub mod api; mod audit; mod chunks; mod error;