| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A worker node for SQD Network, written in Rust. A worker downloads its assigned slice of the network's data lake from persistent storage (currently S3) and answers data queries that reference those chunks.
This is the Rust implementation of the worker. The previous Python version lives in subsquid/archive.py.
SQD Network is a decentralized data lake. The dataset is split into chunks that are distributed across many worker nodes. Each worker:
The crate is published as sqd-worker. It depends on shared network crates from subsquid/sqd-network (transport, messages, contract client, assignments) and query crates from subsquid/data.
For protocol details, see the network RFC.
If you want to operate a worker on SQD Network, follow the worker setup guide in the docs:
https://docs.sqd.dev/subsquid-network/participate/worker/
Requires the Rust toolchain pinned in rust-toolchain.toml (Rust 1.89). Native build dependencies: protobuf-compiler, pkg-config, libssl-dev, and libsqlite3-dev.
cargo build --releaseThe binary is produced at target/release/sqd-worker.
A Dockerfile is provided. It builds the worker with cargo-chef for layer caching and produces an image whose entrypoint is the worker binary:
docker build -t sqd-worker .The worker is configured through command-line flags or the equivalent environment variables (most flags also read from env). Key options:
| Flag | Env | Default | Description |
|---|---|---|---|
| --data-dir | DATA_DIR | (required) | Directory for the worker's data and state |
| --prometheus-port | PROMETHEUS_PORT | 8000 | Port for the HTTP status and metrics server |
| --p2p-port | LISTEN_PORT | 12345 | P2P (QUIC) port to listen on |
| --public-ip | PUBLIC_IP | (none) | Public IP address to advertise to peers |
| --parallel-queries | PARALLEL_QUERIES | 20 | Maximum number of queries processed in parallel |
| --concurrent-downloads | CONCURRENT_DOWNLOADS | 3 | Maximum number of concurrent chunk downloads |
| --query-threads | QUERY_THREADS | (CPU count) | Threads used by the query engine |
| --assignment-url | ASSIGNMENT_URL | network-dependent | URL of the chunk assignment / network state |
| --assignment-source | ASSIGNMENT_SOURCE | (the network's) | Pins which assignment the worker reads: legacy or split (see below) |
Network selection and boot nodes come from the transport arguments (see --help). When the network is set to mainnet or tethys, default boot nodes and the assignment URL are filled in automatically.
The network state names an assignment_type — legacy or split — and the worker reads the assignments it names, re-reading it on every poll. --assignment-source overrides that, which is how a single worker is switched over ahead of the network, or held back during the migration; left unset, the network decides and no worker has to be reconfigured to follow it.
Under split the worker reads the state's worker_assignment pointer and its schema_bundle instead of the legacy shared assignment, and never falls back to the legacy one. The state must also publish a portal_assignment: the worker does not read it, but a state that declares split without it is one the network has not finished publishing, and the worker waits — each such poll counting under network_state_unresolved{reason}, so a network stuck that way is alertable rather than silent. This changes five things:
Run sqd-worker --help for the full list of options.
The HTTP server (on --prometheus-port) exposes:
AGPL-3.0-or-later. See LICENSE.md.
| Back | FazBrowse Home | New Git URL |