Skip to main content

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.

Utilities

Finding Boards on the Network

Ethernet boards advertise themselves over mDNS (_nalu._udp.local.). There are three ways to list them:

  • Open http://127.0.0.1:7878/boards in a browser while the server is running.
  • Call the API: GET /connection/mdns-scan[?timeout_ms=3000].
  • From Python, without a running server: naludaq_rs.mdns_scan(timeout=3.0).

A board can then be connected to by host name instead of IP address: PUT /connection/udp?board=hdsocv2-04b041.local:4660&receiver=<IP>:<PORT>.

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

Metadata

Release files for naludaq-rs 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for naludaq-rs 0.3.0
File
naludaq_rs-0.3.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
naludaq_rs-0.3.0-cp39-abi3-win32.whl CPython 3.9 abi3 Windows x86-32 Details
naludaq_rs-0.3.0-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details
naludaq_rs-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details

Total release size: 35.2 MB

Release files / naludaq_rs-0.3.0-cp39-abi3-win_amd64.whl

Download URL naludaq_rs-0.3.0-cp39-abi3-win_amd64.whl
Size 8.6 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
acc61daf0649ebb572c3a8f257b32d46c0ce76050c9d86993117bb26ec795185
BLAKE2b-256 checksum
How to use checksums
ef2edd9587450b88b1f5e374a5a866867b6a1352389c66480a56e876a2fe173c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / naludaq_rs-0.3.0-cp39-abi3-win32.whl

Download URL naludaq_rs-0.3.0-cp39-abi3-win32.whl
Size 7.7 MB
Tags CPython 3.9 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
191960393d858b70d1a70e3f68f19e719b710f49ca3de02285a6a720c74b7cbe
BLAKE2b-256 checksum
How to use checksums
fde7f7105a442ba0163081fec1353109dc5ed9fea6621cb4040aadd93ae96af3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / naludaq_rs-0.3.0-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL naludaq_rs-0.3.0-cp39-abi3-musllinux_1_2_x86_64.whl
Size 9.7 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
69178017d3978dbc9577be3d278cea0dbedad0a47cea5378f41a8516b982d5ea
BLAKE2b-256 checksum
How to use checksums
fb1a2683cab57cb6e471fb23f491be255fd55b8b1807b8566a8c8528c1623279
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / naludaq_rs-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL naludaq_rs-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 9.2 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
9f62065b2d6ce622de77575414548c8ecc92979f05237debaa3459c16efcb2c5
BLAKE2b-256 checksum
How to use checksums
eff31be1f31080569c8db2149fedc8a4b5db655979cda9a29efd078ed8ebe697
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release history Release notifications | RSS feed

This release

0.3.0 This release

4 release files

0.2.13

5 release files

0.2.9

4 release files

0.2.8

4 release files

0.2.4

16 release files

0.2.3

15 release files

0.2.2

15 release files

0.2.1

15 release files

0.1.9

14 release files

0.1.8

13 release files

0.1.5

2 release files

0.1.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page