Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(sn_client): Basic documentation #1946

Merged
merged 1 commit into from
Jul 15, 2024
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
11 changes: 11 additions & 0 deletions sn_client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions sn_client/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -67,7 +67,7 @@ impl Client {
///
/// Optionally specify the duration for the connection timeout.
///
/// Defaults to 180 seconds.
/// Defaults to [`CONNECTION_TIMEOUT`].
b-zee marked this conversation as resolved.
Show resolved Hide resolved
///
/// # Arguments
/// * 'signer' - [SecretKey]
Expand Down
32 changes: 31 additions & 1 deletion sn_client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading