Skip to main content

Rust backend for NaluDAQ

Project description

NaluDAQ_rs

Rust backend for NaluDaq.

Setup

Make sure the Rust toolchain is installed.

Clone the repository to a suitable location:

git clone https://github.com/NaluScientific/naludaq_rs.git

Done!

Building the backend for python

pip install maturin
maturin build

Building the Backend

The backend is easy to build:

cd naludaq_rs
cargo build --release

Developers may ommit the --release flag for unoptimized builds.

Building for RPI4

Building using docker:

docker build . -t cc/rpi4

to make the container, the build the app with:

docker run --rm -v ${pwd}:/app cc/rpi4

Running the Backend

To run the backend, run the following command:

cargo run  --release -- [<ROOT>] [--addr <ADDR>] [-d | --debug]  [--api]

Where the arguments are as follows:

  • <ROOT> is the root directory to run the server in. By default, it is the current working directory of the terminal it was run from.
  • --addr <ADDR> is the address to bind the server to in the format IP:PORT. If unspecified, the server is bound to an open port on the loopback address.
  • -d | --debug shows additional debug messages.
  • --api will open the Swagger UI in the system browser.

Documentation

The documentation can be built using the following command:

cargo doc --document-private-items --no-deps

The API

NaluDAQ_rs is controlled through its REST API over HTTP. This allows it to be controlled from any machine connected to a network.

The backend can be controlled on the fly via Swagger. Use the --api flag when starting the backend to display the Swagger UI.

Alternatively, the (non-interactive) Swagger UI may be viewed without the backend by running the following command:

cargo run --bin api -- [--output OUTPUT_FILE]

If the --output argument is provided, the OpenAPI JSON data describing the API is written to the file and the program will immediately exit.

Developers

Profiling

Use the build profile called `release-with-debug for building release mode with debug symbols.

cargo build --profile release-with-debug

On Windows machines with Intel processors you can use Intel VTune to profile the backend.

Building the Documentation

cargo doc --open

Tweaking Dependencies

The crate depends on a couple crates published to crates.io. If you are touching these dependencies and wish to test out your changes without publishing the crates, clone the dependencies and change these lines in Cargo.toml:

# naluacq = "X.X.X"
# ft60x_rs = "X.X.X"
naluacq = { "path" = "path/to/naluacq" }
ft60x_rs = { "path" = "path/to/ft60x-rs" }

Architecture

Below is a non-exhaustive diagram of the architecture of the backend highlighting only the main components and their interactions.

graph LR

    Board[Board]
    Connection[Connection]
    Disk[Disk]
    subgraph workers [Workers]
        Worker_Connection[Connection Worker]
        Worker_Package[Package Worker]
        Worker_Storage[Storage Worker]
        Worker_Answer[Answer Worker]
        Worker_Answer_Buffer[Answer Buffer]
    end
    subgraph server [Server Endpoints]
        Endpt_Configure_Workers[Configure Workers]
        Endpt_Send_Command[Send Command]
        Endpt_Recv_Answer[Receive Answer]
        Endpt_Fetch_Event[Fetch Event]
        Endpt_Manage_Connection[Manage Connection]
    end
    Board -->|Readout/Answer| Connection
    Connection -->|Board Output| Worker_Connection
    Connection -->|Command| Board
    Worker_Connection -->|Board Output| Worker_Package
    Worker_Package -->|Event| Worker_Storage
    Worker_Package -->|Answer| Worker_Answer
    Worker_Storage -->|Event| Disk
    Worker_Answer -->|Answer| Worker_Answer_Buffer

    Endpt_Send_Command -->|Command| Connection
    Worker_Answer_Buffer -->|Answer| Endpt_Recv_Answer
    Disk -->|Event| Endpt_Fetch_Event
    Endpt_Manage_Connection -->|Configuration| Connection
    Endpt_Configure_Workers -->|Configuration| Worker_Package
    Endpt_Configure_Workers -->|Configuration| Worker_Storage
    Endpt_Configure_Workers -->|Configuration| Worker_Answer

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

naludaq_rs-0.2.12-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.9 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

naludaq_rs-0.2.12-cp39-abi3-win_amd64.whl (8.0 MB view details)

Uploaded CPython 3.9+Windows x86-64

naludaq_rs-0.2.12-cp39-abi3-win32.whl (7.3 MB view details)

Uploaded CPython 3.9+Windows x86

naludaq_rs-0.2.12-cp39-abi3-musllinux_1_2_x86_64.whl (9.3 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ x86-64

naludaq_rs-0.2.12-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.9 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

File details

Details for the file naludaq_rs-0.2.12-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for naludaq_rs-0.2.12-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c02f8bd22385bc2e5b5224ef356128576af5beb9f61a74db8ade28fc7c036083
MD5 660d47e2ae426d8d6db3520328c9ef16
BLAKE2b-256 9665a9d64024924d2e093b289347a2d097864b6dd3da61056ccf883fa0fe7def

See more details on using hashes here.

File details

Details for the file naludaq_rs-0.2.12-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for naludaq_rs-0.2.12-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b4183575d0dafe5d74b4fb05fc418a0cfb85dfbba2b5c45a567c7325f246b0b9
MD5 07b8d6c624a96c73f9d85d3762ebb5b4
BLAKE2b-256 be6794633bd251ac0f05805ce99f6d3c55501e62a1a8a285ae65f78d09562895

See more details on using hashes here.

File details

Details for the file naludaq_rs-0.2.12-cp39-abi3-win32.whl.

File metadata

  • Download URL: naludaq_rs-0.2.12-cp39-abi3-win32.whl
  • Upload date:
  • Size: 7.3 MB
  • Tags: CPython 3.9+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for naludaq_rs-0.2.12-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 56279049cd7886f94e53f1e83d4132aabfdc1490a42671365799719ca02c78eb
MD5 0e82b17630386be4a7545966751c9052
BLAKE2b-256 f875bd8cdb29b5c063ed2fb5bcf8412e1346c28a2285a863584f996b9631d230

See more details on using hashes here.

File details

Details for the file naludaq_rs-0.2.12-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for naludaq_rs-0.2.12-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 086badbd60e0508dce3fc4ad2f059bacb4fafe9030137da260d3428eec52ef9e
MD5 a464ae236b3acd94dca9cd0dadd8e3a4
BLAKE2b-256 6daceb98dbddecc72d0c628ced199699ae4cf560c29aa49fe774936f398ffc85

See more details on using hashes here.

File details

Details for the file naludaq_rs-0.2.12-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for naludaq_rs-0.2.12-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c5fc90949b134a563f4cbd19a22b7dd1d68b5b4aad796734cbb8a4a5bfee6137
MD5 6d734dc26866606c31adb7b648e4f8d4
BLAKE2b-256 fb823e01010e717fc61308c735d3c88930b08c53f78b72b18db8ed8a2e132932

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page